Vert.x



Michael Kuty


Michael Kuty

  • Web application developer
  • TCP Cloud - Django, SaltStack, ..
  • Robotice - Python, Celery, ..
  • https://github.com/michaelkuty

Node.js for JVM

vertx

Why ?

async

Addressing the Problem

  • C10K problem
  • Server push
  • Many long lived connections

2008

Request waiting ... Response

async
Thread per Request/Response

Reactor pattern

  • Event loop
  • (Douglas C. Schmidt, 1995)

1995

... Loop

async
async

Solutions

    servers

  • Nginx
  • Jetty

  • platforms

  • Node.js (JavaScript, JXCore)
  • Tornado, Eventlet (Python)
  • EventMachine (Ruby)

2009 - Node.js

2011 - Vert.x

General

  • Asynchronous by nature
  • Simillarities with Node.js but not a clone !
  • High-Performing
  • Slim and leightweight core
  • Polyglot
  • Inspired also from Erlang, RabbitMQ

Core API

  • TCP / SSL
  • HTTP(s) and compression
  • WebSockets / SockJS
  • File System
  • Event Bus
  • Timers, Buffers
  • Streaming and Pumps
  • UDP
  • DNS
  • ...

Internals

  • Build on top of Netty 4
  • Hazelcast for group management of cluster members
  • Java7+
  • Jackson for JSON

Polyglot

  • Java
  • JS (Rhino, Nashorn)
  • Groovy
  • Ruby
  • Python
  • Scala
  • Clojure
  • PHP

Verticle

  • Execution unit of Vert.x
  • Single threaded
  • Verticles communicate via message passing
  • Sounds like the Actor Model

Demo

Vert.x Instance

Event Loops

  • EventLoops (Usually one per Core)
  • Multi-reactor pattern
  • No concurrency issues (synchronization, locking, ..)
Never block the EventLoop!

Event Bus

  • Pub/Sub/P2P
  • Bridges - (AMQP, 0MQ, Kafka, ..)
  • JSON, BSON, Byte[], ...
Nervous system

Event Bus

Clustered Event Bus

  • Connects multiple Vert.x instances(JVM)
  • Hazelcast as cluster manager(pluggable)
  • Cluster manager used for group management not transport !!

Clustered Event Bus

Event bus & Browser

Demo

Blocking tasks

The background pool

  • Hybrid model
  • Worker Verticles
  • blocking calls (jdbc, ...)
vertx.pool.worker.size

Workers

event driven

Callbacks hell

callback hell

Callbacks help

  • Rx (Reactive Extensions)
  • https://github.com/vert-x/mod-rxvertx

Modules

  • Even new language support is done via modules!
  • No changes to core needed
  • Runnable modules vs. includable modules
  • Repositories (Maven, Bintray, ..)

High Availability

  • Automatic failover
  • HA groups
  • Network partitions - Quora

Clusters

Demo

Developing with Vert.x

  • IDEs..
  • Text editor
  • Maven, Gradle, ..
  • Auto-redeploy

Deploying Vert.x

  • Fat Jar, ZIP, verticles
  • Modules, versions, configs
  • Vert.x and Java version ?

Project info

Tim Fox
  • Tim Fox - father of Vert.x
  • VMware - incubator
  • Eclipse Foundation
  • Employed by Red Hat

Security

Enterprise ready ?

3.0 +

  • Remove Vert.x platform
  • Event bus encryption
  • Code generation tool
  • Simplify cluster configuration
  • Wildcards on eventbus
  • Server management - GUI
  • ...
coming soon

Summary

  • Horizontal & vertical scaling
  • High availability
  • Polyglot
  • Easily extendable
  • Growing ecosystem

Questions ?

Thanks

http://spkr8.com/t/42891

Image credits

  • jbandi - http://www.slideshare.net/jbandi/vertx-asynchronous-eventdriven-web-applications-on-the-jvm
  • Matt Stine - http://www.slideshare.net/mstine/vertx-14673790
  • Sascha Möllering - http://www.slideshare.net/saschamoellering/vertx-in-productionfinal