Vert.x is a reactive application framework for the JVM that is resource efficient, concurrent, asynchronous, flexible, simple, and has a mature ecosystem. It was created in 2011 by VMWare and is now maintained by the Eclipse Foundation. Vert.x uses event-driven architecture with non-blocking code and message passing between single-threaded verticle units to provide high performance and scalability.
4. Hello from Vert.x
import io.vertx.core.AbstractVerticle;
public class Server extends AbstractVerticle {
public void start() {
vertx.createHttpServer().requestHandler(req -> {
req.response()
.putHeader("content-type", "text/plain")
.end("Hello from Vert.x!");
}).listen(8080);
}
}
7. Programming Model
Small set of threads per vertx
instance
Verticles are executed using the
same thread
Message passing communication
using the event bus.
8. Vert.x Core
TCP/SSL, UDP Client and Servers
HTTP/HTTPS Client and Servers
Web sockets
Distributed Event bus access
DNS
File System
Logging
Etc
9. Verticle
Execution unit of vertx
Single threaded - less scope for race condition
Verticles communicate by message passing
Actor model
Should not block the event loop
10. Event Bus
Allows verticles to talk to each other.
Works cross language.
Works across the cluster.
Supports Point to point, Request/Response or PubSub model.
Pass strings, bu
ff
ers, primitive types or JSON
11. Benchmarks
Framework Package
size (MB)
Startup
time (ms)
GET (over 5 min) POST (over 10 min)
total failed mean (ms) throughput
(req/s)
total failed mean (ms) throughput
(req/s)
Spring
Boot /
Tomcat
14 6905 200000 0 274 685 200000 0 232 814
Spring
Boot / Jetty
13 6905 180000 196 300 590 200000 0 229 817
Spring
Boot /
Undertow
14 6905 82926 12 702 277 200000 0 226 824
vertx 5.1 200 200000 0 258 739 200000 0 210 891