Presentation Creating Polyglot and Scalable Applications on the JVM with Vert.x
The JVM has become the runtime for a lot of different languages. Nowadays developers program in more than one language. Of course java is still used the most on the JVM, but other languages are winning terrain. The next step for developers is to create polyglot applications, taking the best out of each language, such as JavaScript, Groovy, Ruby and Java. Vert.x is a framework that runs on the JVM. Vert.x enables developers to create polyglot applications that run on the JVM.
That is not the only thing Vert.x brings. It also has been built to be scalable and it has a very simple approach for concurrency that can be compared to the Node.js method. Another important feature of Vert.x is the distributed event bus that is also available from the clients. Using this technology you can receive events in the browser that are generated by the server and vice versa.
During this presentation you’ll get introduced in the possibilities of this new framework called Vert.x. I’ll explain the foundat
Published on: 2012-11-30T09:14:31.000Z
Channel: NLJUG (all)
Tags: Polyglot Vert.x jvm
Speakers:
Jettro Coenradie
I am a regular visitor and speaker at the different NLJug events. I am doing Java for more than a decade and I am constantly seeking for tools and frameworks to make my life as a software developer easier. Currently I am working for Orange11 as a Software Architect. I am an integration specialist, but I have knowledge in large variety of topics like content management, CQRS and mobile. At the moment I am involved with technologies like Hippocms, Axonframework, MongoDB, Spring integration, Twitter Bootstrap and on the lookout for other interesting projects like Vert.x.
PDF: slides.pdf
Slides:
Creating Polyglot and Scalable Applications on the JVM with Vert.x
Creating Polyglot and Scalable Applications on the JVM with Vert.x
Jettro Coenradie @gridshore
http://maps.google.com
http://maps.google.com
Polyglot applications
Polyglot applications
http://maps.google.com
JDBC, Reflection JIT Compiler, Collections framework Hotspot JVM, JNDI Reg Exp, NIO, XML parsing Generics, Varargs, enums Scripting Language Support Dynamic languages on JVM
JDBC, Reflection JIT Compiler, Collections framework Hotspot JVM, JNDI Reg Exp, NIO, XML parsing Generics, Varargs, enums Scripting Language Support Dynamic languages on JVM
1 1.1 1.2 1.3 1.4
1996 1997 1998 2000 2002
5
2004
6
2006
7
2011
Polyglot applications on the JVM
Polyglot applications on the JVM
C10K Problem
C10K Problem
http://www.tumblr.com/tagged/rockconcert?before=1346635427
http://en.wikipedia.org/wiki/C10k_problem
http://en.wikipedia.org/wiki/C10k_problem
Scalable applications on the JVM
Scalable applications on the JVM
Vert.x
Vert.x
Netty JRuby Groovy Rhino Jython Hazelcast
@timfox
Polyglot application platform JavaScript
Polyglot application platform JavaScript
Scalable: Blocking to non-blocking
Scalable: Blocking to non-blocking
Easily Concurrent
Easily Concurrent
Vert.x Components
Vert.x Components
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Module
Event Loop 2
Vert.x Core
Vert.x Core
· Must be implemented by all languages · Core services must be called direct · Example Services · TCP/SSL, HTTP/HTTPS, WebSockets, Logging, SockJS and more
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Module
Event Loop 2
Verticle
Verticle
· Unit of deployment in Vert.x · Can contain other scripts · Can contain libraries · Can start other verticles
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Module
Event Loop 2
Module
Module
· Modules communicate using messages · A public module repository · https://github.com/vert-x/vertx-mods/ tree/gh-pages/mods
Module
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Event Loop 2
Worker Verticle
Worker Verticle
· For tasks that require blocking · For tasks that take a lot of computation · Uses thread of the background pool · They are never executed by more than one thread
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Module
Event Loop 2
Verticle or Module
Verticle or Module
· Verticle is easy to use · Verticle needs to be configured with its classpath when running · A module is a package of vert.x stuff complete with dependencies.
Module
Event Loop 1
Background Pool
Verticle
Verticle
Worker
Worker
Core Services
Event Bus
Module
Module
Event Loop 2
Communicating between modules
Communicating between modules
· Send messages over the Event bus · Vert.x will automatically convert messages between modules
Java Groovy Ruby JavaScript Python
JsonObject Map Hash Object Hash
Threads Event loop
Threads Event loop
· Amount equals number of cores · Verticles/modules are assigned to an event loop
Background Pool
· A thread pool for worker verticles · Actions can block or take longer CPU time
Demo: Office events
Demo: Office events
Event Loop 1 Background Pool
Backup
App
Core Services
Event Bus
Invitations
Website
Notifications
Mongo Persistor
Event Loop 1
Event Loop 2
https://github.com/jettro/vertx-samples/tree/master/office-events
Demo
Demo: Office events
Demo: Office events
Event Loop 1 Background Pool
Backup
App
Core Services
Event Bus
Invitations
Website
Notifications
Mongo Persistor
Event Loop 1
Event Loop 2
https://github.com/jettro/vertx-samples/tree/master/office-events
Demo
Module layout
Module layout
· Module naming: prefix.-v · mod.json · scripts or classes · lib/ - libraries required by the module
Configuration
Configuration
· Pass configuration when deploying a verticle or module · Use a json object · json is used according the language as discussed before
Events
Events
· Publish/Subscribe · Peer-to-Peer · Replying to messages · Distributed event-bus
Logging
Logging
· Default uses java utils logging · Use other logging framework: log4j for example · /bin/vertx · DEFAULT_JVM_OPTS="-Dorg.vertx.logger-delegate-factory-classname=org.vertx.java.core.logging.impl.Log4jLogDelegateFactory" · Add the library to the vertx lib folder · Create a log4j.properties file
There is more
There is more
· Shared data · Embedded mode · Clustered mode
More info Vert.x Tim Fox
More info Vert.x Tim Fox
@timfox
http://vertx.io Downloads and documentation
http://groups.google.com/group/vertx https://github.com/jettro/vertxsamples/ office-events
Jettro Coenradie @jettroCoenradie @gridshore
http://www.linkedin.com/in/jettro http://www.gridshore.nl http://www.trifork.nl https://github.com/jettro/
Questions ??
Questions ??
Rock ?? Concert by Rod Stewart with 3.500.000 visitors