際際滷

際際滷Share a Scribd company logo
Vert.x
Reactiveapplications on the JVM
Vert.x
 Created by VMWare 

 Currently maintained by the Eclipse Foundation.

 10 years old. Created in 2011
History
Features
 Resource e
ffi
cient

 Concurrent and asynchronous

 Flexible

 Simple

 Mature Ecosystem
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);
}
}
Core Concepts
 Verticle

 Vert.x instances

 Event Bus
JVMJVMJVM JVM
JAR/ Vertx Instance
Verticle 1 Verticle 2
Verticle 3
Programming Model
 Event loop Based (Similar to Node.js)

 Event Handlers
Programming Model
 Small set of threads per vertx
instance

 Verticles are executed using the
same thread

 Message passing communication
using the event bus.
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
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
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
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
Benchmarks
References
 Wikipedia: https://en.wikipedia.org/wiki/Vert.x

 O
ffi
cial Docs: https://vertx.io/

 Source Code: https://github.com/eclipse-vertx/vert.x

 Collection of vertx resources: https://github.com/vert-x3/vertx-awesome

More Related Content

Vertx Basics

  • 2. Vert.x Created by VMWare Currently maintained by the Eclipse Foundation. 10 years old. Created in 2011 History
  • 3. Features Resource e ffi cient Concurrent and asynchronous Flexible Simple Mature Ecosystem
  • 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); } }
  • 5. Core Concepts Verticle Vert.x instances Event Bus JVMJVMJVM JVM JAR/ Vertx Instance Verticle 1 Verticle 2 Verticle 3
  • 6. Programming Model Event loop Based (Similar to Node.js) Event Handlers
  • 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
  • 13. References Wikipedia: https://en.wikipedia.org/wiki/Vert.x O ffi cial Docs: https://vertx.io/ Source Code: https://github.com/eclipse-vertx/vert.x Collection of vertx resources: https://github.com/vert-x3/vertx-awesome