SlideShare a Scribd company logo
Creating Polyglot and Scalable
              Applications on the JVM with Vert.x




                        Jettro Coenradie
                              @gridshore
dinsdag 30 oktober 12

The butterfly represents the lightweight scalable architecture
http://maps.google.com


dinsdag 30 oktober 12

Does this territory look familiar?
http://maps.google.com


dinsdag 30 oktober 12

Tripoint of countries: The netherlands, Germany and Belgium
People here speak multiple languages and are therefore Polyglot
Polyglot applications



                                                                           http://maps.google.com


dinsdag 30 oktober 12

- Polyglot applications is not about writing them in Dutch, German and French
- Discuss combining multiple jvm languages in one application
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               5      6           7

                        1996 1997 1998   2000    2002   2004   2006        2011


dinsdag 30 oktober 12

The history of the JVM and the introduction of Dynamic languages on the JVM and the
importance for a polyglot application on the JVM.
Polyglot applications on the JVM




dinsdag 30 oktober 12

Now the JVM supports creating Polyglot applications.
C10K Problem




                                             http://www.tumblr.com/tagged/rockconcert?before=1346635427
dinsdag 30 oktober 12

C10k problem
The crowd becomes to big for your platform
http://en.wikipedia.org/wiki/C10k_problem

dinsdag 30 oktober 12

Wikipedia page about the C10K problem showing the main characteristics of available
solutions: event-driven, non-blocking and asynchronous
Scalable applications on the JVM




dinsdag 30 oktober 12

Some of the mentioned solutions run on the JVM and the JVM is the right tools for the job
when you want to create non-blocking, event-driven, asynchronous applications.
Vert.x
                        ✦Netty
                        ✦JRuby
                        ✦Groovy
                        ✦Rhino
                        ✦Jython
                        ✦Hazelcast


                                     @timfox

dinsdag 30 oktober 12

Introduction of vertx, the creator and the main technologies used.
Polyglot application platform


                        JavaScript




dinsdag 30 oktober 12

The available languages for vert.x and the languages for which support is being created.
Scalable: Blocking to non-blocking




dinsdag 30 oktober 12

Blocking has the risk that the CPU is doing nothing while a thread is waiting for input
Non-blocking: can use the CPU more effectively if there is something to do, it does not fall
asleep
Easily Concurrent




dinsdag 30 oktober 12

- We can use the multiple cores of a machine within one JVM
- Easy concurrency due to thread bound modules and verticles => No Locking
- Synchronous calling of a request handler. Therefore no concurrency issues.
Vert.x Components
                             Event Loop 1                            Background Pool




                             Verticle


                                        Verticle




                                                                  Worker


                                                                             Worker
                                                                                        Core
                                                                                       Services




                                            Event Bus



                           Module                  Module                  Module


                                                   Event Loop 2




dinsdag 30 oktober 12

Go through all the different components of Vert.x
Vert.x Core
                                                          Event Loop 1                            Background Pool

       • Must be implemented by all languages




                                                          Verticle


                                                                     Verticle




                                                                                               Worker


                                                                                                          Worker
                                                                                                                     Core

       • Core services must be called direct
                                                                                                                    Services




       • Example Services                                                Event Bus


             • TCP/SSL, HTTP/HTTPS, WebSockets,         Module                  Module                  Module
               Logging, SockJS and more
                                                                                Event Loop 2




dinsdag 30 oktober 12

Core services must be called directly, no need for sending messages
Verticle
                                                                                  Background Pool
       • Unit of deployment in Vert.x
                                          Event Loop 1




                                          Verticle


                                                     Verticle




                                                                               Worker


                                                                                          Worker
                                                                                                     Core

       • Can contain other scripts                                                                  Services




       • Can contain libraries
                                                         Event Bus


       • Can start other verticles      Module                  Module                  Module


                                                                Event Loop 2




dinsdag 30 oktober 12

- Demo basic verticle
Module
                                                                                                 Background Pool
       • Modules communicate using messages
                                                         Event Loop 1




                                                         Verticle


                                                                    Verticle




                                                                                              Worker


                                                                                                         Worker
                                                                                                                    Core

       • A public module repository                                                                                Services




             • https://github.com/vert-x/vertx-mods/
                                                                        Event Bus
               tree/gh-pages/mods

                                                       Module                  Module                  Module


                                                                               Event Loop 2




dinsdag 30 oktober 12
Worker Verticle
                                                                                              Background Pool
       • For tasks that require blocking
                                                      Event Loop 1




                                                      Verticle


                                                                 Verticle




                                                                                           Worker


                                                                                                      Worker
                                                                                                                 Core

       • For tasks that take a lot of computation                                                               Services




       • Uses thread of the background pool
                                                                     Event Bus


       • They are never executed by more than one   Module                  Module                  Module
         thread
                                                                            Event Loop 2




dinsdag 30 oktober 12
Verticle or Module
                                                                                             Background Pool
       • Verticle is easy to use
                                                     Event Loop 1




                                                     Verticle


                                                                Verticle




                                                                                          Worker


                                                                                                     Worker
                                                                                                                Core

       • Verticle needs to be configured with its                                                               Services



         classpath when running

                                                                    Event Bus
       • A module is a package of vert.x stuff
         complete with dependencies.
                                                   Module                  Module                  Module


                                                                           Event Loop 2




dinsdag 30 oktober 12
Communicating between modules

       • Send messages over the Event bus


       • Vert.x will automatically convert messages between modules



                           Java                       JsonObject

                         Groovy                           Map

                          Ruby                           Hash

                        JavaScript                      Object

                         Python                          Hash


dinsdag 30 oktober 12

Messages can contain contain raw types, but JSON is recommended to be used for
information sending using messages.
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


dinsdag 30 oktober 12
Demo: Office events
                                              Event Loop 1            Background Pool




                                                                              Backup
                                                    App
                                                                                                     Core
                                                                                                    Services




                                                    Event Bus


                                                                                         Mongo
                        Invitations      Website             Notifications
                                                                                        Persistor

                                          Event Loop 2                                  Event Loop 1



                                 https://github.com/jettro/vertx-samples/tree/master/office-events
dinsdag 30 oktober 12

The office events demo is available on github. It is used to show modules, verticles and
worker verticles in different languages.
Module layout

       • Module naming: prefix.<name>-v<version>


       • mod.json


       • scripts or classes


       • lib/ - libraries required by the module




dinsdag 30 oktober 12

mod.json is the configuration for the module containing the main item, worker or not and
some other options.
Configuration

       • Pass configuration when deploying a verticle or module


       • Use a json object


       • json is used according the language as discussed before




dinsdag 30 oktober 12
Events

       • Publish/Subscribe


       • Peer-to-Peer


       • Replying to messages


       • Distributed event-bus




dinsdag 30 oktober 12

More info about event usage in Vert.x
Logging

       • Default uses java utils logging


       • Use other logging framework: log4j for example


       • <home>/bin/vertx


       • DEFAULT_JVM_OPTS="-Dorg.vertx.logger-delegate-factory-class-
         name=org.vertx.java.core.logging.impl.Log4jLogDelegateFactory"


       • Add the library to the vertx lib folder


       • Create a log4j.properties file




dinsdag 30 oktober 12
There is more

       • Shared data


       • Embedded mode


       • Clustered mode




dinsdag 30 oktober 12
More info

 Vert.x
 Tim Fox                @timfox         Jettro
 http://vertx.io Downloads and          Coenradie
 documentation

 http://groups.google.com/group/vertx
                                        @jettroCoenradie
 https://github.com/jettro/vertx-
 samples/ office-events                  @gridshore
                                        http://www.linkedin.com/in/jettro
                                        http://www.gridshore.nl
                                        http://www.trifork.nl
                                        https://github.com/jettro/

dinsdag 30 oktober 12
Questions ??



                                                 Rock ?? Concert by Rod Stewart with 3.500.000 visitors
dinsdag 30 oktober 12

Now we can scale our rock concert to around 3.5 million users.

More Related Content

What's hot

Building microservices with vert.x 3.0
Building microservices with vert.x 3.0Building microservices with vert.x 3.0
Building microservices with vert.x 3.0
Agraj Mangal
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
 
Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
kscaldef
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Saeed Zarinfam
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Steve Pember
 
Node js internal
Node js internalNode js internal
Node js internal
Chinh Ngo Nguyen
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMs
Maarten Smeets
 
cfengine3 at #lspe
cfengine3 at #lspecfengine3 at #lspe
cfengine3 at #lspe
Chris Westin
 
Are hypermedia API's Just Hype?
Are hypermedia API's Just Hype?Are hypermedia API's Just Hype?
Are hypermedia API's Just Hype?
Daniel Feist
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)
jaxLondonConference
 
Microservices with Micronaut
Microservices with MicronautMicroservices with Micronaut
Microservices with Micronaut
QAware GmbH
 
The container revolution, and what it means to operators open stack southba...
The container revolution, and what it means to operators   open stack southba...The container revolution, and what it means to operators   open stack southba...
The container revolution, and what it means to operators open stack southba...
Robert Starmer
 
Micronaut Deep Dive - Codeone 2019
Micronaut Deep Dive - Codeone 2019Micronaut Deep Dive - Codeone 2019
Micronaut Deep Dive - Codeone 2019
graemerocher
 
Hypervisor "versus" Linux Containers with Docker !
Hypervisor "versus" Linux Containers with Docker !Hypervisor "versus" Linux Containers with Docker !
Hypervisor "versus" Linux Containers with Docker !
Francisco Gonçalves
 
Cassandra on Docker
Cassandra on DockerCassandra on Docker
Cassandra on Docker
Instaclustr
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
ravisankar munusamy
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Era
graemerocher
 
Scaling and Managing Cassandra with docker, CoreOS and Presto
Scaling and Managing Cassandra with docker, CoreOS and PrestoScaling and Managing Cassandra with docker, CoreOS and Presto
Scaling and Managing Cassandra with docker, CoreOS and Presto
Vali-Marius Malinoiu
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
graemerocher
 
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and KnativeBuild and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Omar Al-Safi
 

What's hot (20)

Building microservices with vert.x 3.0
Building microservices with vert.x 3.0Building microservices with vert.x 3.0
Building microservices with vert.x 3.0
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Innovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXCInnovating faster with SBT, Continuous Delivery, and LXC
Innovating faster with SBT, Continuous Delivery, and LXC
 
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed ZarinfamVert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
Vert.x - Tehran JUG meeting Aug-2014 - Saeed Zarinfam
 
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...Why Reactive Architecture Will Take Over The World (and why we should be wary...
Why Reactive Architecture Will Take Over The World (and why we should be wary...
 
Node js internal
Node js internalNode js internal
Node js internal
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMs
 
cfengine3 at #lspe
cfengine3 at #lspecfengine3 at #lspe
cfengine3 at #lspe
 
Are hypermedia API's Just Hype?
Are hypermedia API's Just Hype?Are hypermedia API's Just Hype?
Are hypermedia API's Just Hype?
 
JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)JVM Support for Multitenant Applications - Steve Poole (IBM)
JVM Support for Multitenant Applications - Steve Poole (IBM)
 
Microservices with Micronaut
Microservices with MicronautMicroservices with Micronaut
Microservices with Micronaut
 
The container revolution, and what it means to operators open stack southba...
The container revolution, and what it means to operators   open stack southba...The container revolution, and what it means to operators   open stack southba...
The container revolution, and what it means to operators open stack southba...
 
Micronaut Deep Dive - Codeone 2019
Micronaut Deep Dive - Codeone 2019Micronaut Deep Dive - Codeone 2019
Micronaut Deep Dive - Codeone 2019
 
Hypervisor "versus" Linux Containers with Docker !
Hypervisor "versus" Linux Containers with Docker !Hypervisor "versus" Linux Containers with Docker !
Hypervisor "versus" Linux Containers with Docker !
 
Cassandra on Docker
Cassandra on DockerCassandra on Docker
Cassandra on Docker
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
 
Micronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless EraMicronaut: Evolving Java for the Microservices and Serverless Era
Micronaut: Evolving Java for the Microservices and Serverless Era
 
Scaling and Managing Cassandra with docker, CoreOS and Presto
Scaling and Managing Cassandra with docker, CoreOS and PrestoScaling and Managing Cassandra with docker, CoreOS and Presto
Scaling and Managing Cassandra with docker, CoreOS and Presto
 
Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019Introduction to Micronaut - JBCNConf 2019
Introduction to Micronaut - JBCNConf 2019
 
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and KnativeBuild and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
Build and Deploy Cloud Native Camel Quarkus routes with Tekton and Knative
 

Similar to Creating polyglot and scalable applications on the jvm using Vert.x

Building Server Applications with EclipseRT
Building Server Applications with EclipseRTBuilding Server Applications with EclipseRT
Building Server Applications with EclipseRT
Gunnar Wagenknecht
 
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav TulachJDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
PROIDEA
 
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPMJBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
Mauricio (Salaboy) Salatino
 
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
cwensel
 
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier SpoorOWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
SURF Events
 
Go at Swiss Post for Automation and Testing
Go at Swiss Post for Automation and TestingGo at Swiss Post for Automation and Testing
Go at Swiss Post for Automation and Testing
philipsahli
 
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
stackconf 2022: It’s Time to Debloat the Cloud with Unikraftstackconf 2022: It’s Time to Debloat the Cloud with Unikraft
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
NETWAYS
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
Samuel Dratwa
 
Papyrus for RealTime - Executable Modeling on Eclipse
Papyrus for RealTime - Executable Modeling on EclipsePapyrus for RealTime - Executable Modeling on Eclipse
Papyrus for RealTime - Executable Modeling on Eclipse
Charles Rivet
 
Building Server-Side Eclipse based web applications 2010
Building Server-Side Eclipse based web applications 2010Building Server-Side Eclipse based web applications 2010
Building Server-Side Eclipse based web applications 2010
Gunnar Wagenknecht
 
Lean Engineering. Applying Lean Principles to Building Experiences
Lean Engineering. Applying Lean Principles to Building ExperiencesLean Engineering. Applying Lean Principles to Building Experiences
Lean Engineering. Applying Lean Principles to Building Experiences
Bill Scott
 
Papyrus for System Engineering - Papyrus for Real Time v1.0
Papyrus for System Engineering - Papyrus for Real Time v1.0Papyrus for System Engineering - Papyrus for Real Time v1.0
Papyrus for System Engineering - Papyrus for Real Time v1.0
Charles Rivet
 
Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
Mihai Dan Nadas
 
Stackato v3
Stackato v3Stackato v3
Stackato v3
Jonas Brømsø
 
Seattle Scalability - GigaSpaces / Cassandra
Seattle Scalability - GigaSpaces / CassandraSeattle Scalability - GigaSpaces / Cassandra
Seattle Scalability - GigaSpaces / Cassandra
clive boulton
 
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
Russell Pavlicek
 
Cont0519
Cont0519Cont0519
Cont0519
Samuel Dratwa
 
Usernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userUsernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root user
Akihiro Suda
 
How to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIMLHow to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIML
Jo Vermeulen
 
OpenTravel XML Object Suite - Component Model
OpenTravel XML Object Suite - Component ModelOpenTravel XML Object Suite - Component Model
OpenTravel XML Object Suite - Component Model
OpenTravel Alliance
 

Similar to Creating polyglot and scalable applications on the jvm using Vert.x (20)

Building Server Applications with EclipseRT
Building Server Applications with EclipseRTBuilding Server Applications with EclipseRT
Building Server Applications with EclipseRT
 
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav TulachJDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
 
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPMJBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
JBCNConf: jBPM & Vert.x Reactive and Polyglot BPM
 
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
SAM SIG: Hadoop architecture, MapReduce patterns, and best practices with Cas...
 
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier SpoorOWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
OWD2011 - 7 - Uw datacentrum naar de cloud - Rogier Spoor
 
Go at Swiss Post for Automation and Testing
Go at Swiss Post for Automation and TestingGo at Swiss Post for Automation and Testing
Go at Swiss Post for Automation and Testing
 
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
stackconf 2022: It’s Time to Debloat the Cloud with Unikraftstackconf 2022: It’s Time to Debloat the Cloud with Unikraft
stackconf 2022: It’s Time to Debloat the Cloud with Unikraft
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Papyrus for RealTime - Executable Modeling on Eclipse
Papyrus for RealTime - Executable Modeling on EclipsePapyrus for RealTime - Executable Modeling on Eclipse
Papyrus for RealTime - Executable Modeling on Eclipse
 
Building Server-Side Eclipse based web applications 2010
Building Server-Side Eclipse based web applications 2010Building Server-Side Eclipse based web applications 2010
Building Server-Side Eclipse based web applications 2010
 
Lean Engineering. Applying Lean Principles to Building Experiences
Lean Engineering. Applying Lean Principles to Building ExperiencesLean Engineering. Applying Lean Principles to Building Experiences
Lean Engineering. Applying Lean Principles to Building Experiences
 
Papyrus for System Engineering - Papyrus for Real Time v1.0
Papyrus for System Engineering - Papyrus for Real Time v1.0Papyrus for System Engineering - Papyrus for Real Time v1.0
Papyrus for System Engineering - Papyrus for Real Time v1.0
 
Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
 
Stackato v3
Stackato v3Stackato v3
Stackato v3
 
Seattle Scalability - GigaSpaces / Cassandra
Seattle Scalability - GigaSpaces / CassandraSeattle Scalability - GigaSpaces / Cassandra
Seattle Scalability - GigaSpaces / Cassandra
 
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
OSAC16: Unikernel-powered Transient Microservices: Changing the Face of Softw...
 
Cont0519
Cont0519Cont0519
Cont0519
 
Usernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root userUsernetes: Kubernetes as a non-root user
Usernetes: Kubernetes as a non-root user
 
How to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIMLHow to Survive Multi-Device User Interface Design with UIML
How to Survive Multi-Device User Interface Design with UIML
 
OpenTravel XML Object Suite - Component Model
OpenTravel XML Object Suite - Component ModelOpenTravel XML Object Suite - Component Model
OpenTravel XML Object Suite - Component Model
 

More from Jettro Coenradie

Learning to rank search results
Learning to rank search resultsLearning to rank search results
Learning to rank search results
Jettro Coenradie
 
Combining machine learning and search through learning to rank
Combining machine learning and search through learning to rankCombining machine learning and search through learning to rank
Combining machine learning and search through learning to rank
Jettro Coenradie
 
Combining machine learning and search through learning to rank
Combining machine learning and search through learning to rankCombining machine learning and search through learning to rank
Combining machine learning and search through learning to rank
Jettro Coenradie
 
Real-time data analysis using ELK
Real-time data analysis using ELKReal-time data analysis using ELK
Real-time data analysis using ELK
Jettro Coenradie
 
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
Jettro Coenradie
 
Sharing content between hippo and solr
Sharing content between hippo and solrSharing content between hippo and solr
Sharing content between hippo and solr
Jettro Coenradie
 

More from Jettro Coenradie (6)

Learning to rank search results
Learning to rank search resultsLearning to rank search results
Learning to rank search results
 
Combining machine learning and search through learning to rank
Combining machine learning and search through learning to rankCombining machine learning and search through learning to rank
Combining machine learning and search through learning to rank
 
Combining machine learning and search through learning to rank
Combining machine learning and search through learning to rankCombining machine learning and search through learning to rank
Combining machine learning and search through learning to rank
 
Real-time data analysis using ELK
Real-time data analysis using ELKReal-time data analysis using ELK
Real-time data analysis using ELK
 
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
Search: the right tool, but what is the job. At nosqlmatters amsterdam 2013
 
Sharing content between hippo and solr
Sharing content between hippo and solrSharing content between hippo and solr
Sharing content between hippo and solr
 

Creating polyglot and scalable applications on the jvm using Vert.x

  • 1. Creating Polyglot and Scalable Applications on the JVM with Vert.x Jettro Coenradie @gridshore dinsdag 30 oktober 12 The butterfly represents the lightweight scalable architecture
  • 2. http://maps.google.com dinsdag 30 oktober 12 Does this territory look familiar?
  • 3. http://maps.google.com dinsdag 30 oktober 12 Tripoint of countries: The netherlands, Germany and Belgium People here speak multiple languages and are therefore Polyglot
  • 4. Polyglot applications http://maps.google.com dinsdag 30 oktober 12 - Polyglot applications is not about writing them in Dutch, German and French - Discuss combining multiple jvm languages in one application
  • 5. 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 5 6 7 1996 1997 1998 2000 2002 2004 2006 2011 dinsdag 30 oktober 12 The history of the JVM and the introduction of Dynamic languages on the JVM and the importance for a polyglot application on the JVM.
  • 6. Polyglot applications on the JVM dinsdag 30 oktober 12 Now the JVM supports creating Polyglot applications.
  • 7. C10K Problem http://www.tumblr.com/tagged/rockconcert?before=1346635427 dinsdag 30 oktober 12 C10k problem The crowd becomes to big for your platform
  • 8. http://en.wikipedia.org/wiki/C10k_problem dinsdag 30 oktober 12 Wikipedia page about the C10K problem showing the main characteristics of available solutions: event-driven, non-blocking and asynchronous
  • 9. Scalable applications on the JVM dinsdag 30 oktober 12 Some of the mentioned solutions run on the JVM and the JVM is the right tools for the job when you want to create non-blocking, event-driven, asynchronous applications.
  • 10. Vert.x ✦Netty ✦JRuby ✦Groovy ✦Rhino ✦Jython ✦Hazelcast @timfox dinsdag 30 oktober 12 Introduction of vertx, the creator and the main technologies used.
  • 11. Polyglot application platform JavaScript dinsdag 30 oktober 12 The available languages for vert.x and the languages for which support is being created.
  • 12. Scalable: Blocking to non-blocking dinsdag 30 oktober 12 Blocking has the risk that the CPU is doing nothing while a thread is waiting for input Non-blocking: can use the CPU more effectively if there is something to do, it does not fall asleep
  • 13. Easily Concurrent dinsdag 30 oktober 12 - We can use the multiple cores of a machine within one JVM - Easy concurrency due to thread bound modules and verticles => No Locking - Synchronous calling of a request handler. Therefore no concurrency issues.
  • 14. Vert.x Components Event Loop 1 Background Pool Verticle Verticle Worker Worker Core Services Event Bus Module Module Module Event Loop 2 dinsdag 30 oktober 12 Go through all the different components of Vert.x
  • 15. Vert.x Core Event Loop 1 Background Pool • Must be implemented by all languages Verticle Verticle Worker Worker Core • Core services must be called direct Services • Example Services Event Bus • TCP/SSL, HTTP/HTTPS, WebSockets, Module Module Module Logging, SockJS and more Event Loop 2 dinsdag 30 oktober 12 Core services must be called directly, no need for sending messages
  • 16. Verticle Background Pool • Unit of deployment in Vert.x Event Loop 1 Verticle Verticle Worker Worker Core • Can contain other scripts Services • Can contain libraries Event Bus • Can start other verticles Module Module Module Event Loop 2 dinsdag 30 oktober 12 - Demo basic verticle
  • 17. Module Background Pool • Modules communicate using messages Event Loop 1 Verticle Verticle Worker Worker Core • A public module repository Services • https://github.com/vert-x/vertx-mods/ Event Bus tree/gh-pages/mods Module Module Module Event Loop 2 dinsdag 30 oktober 12
  • 18. Worker Verticle Background Pool • For tasks that require blocking Event Loop 1 Verticle Verticle Worker Worker Core • For tasks that take a lot of computation Services • Uses thread of the background pool Event Bus • They are never executed by more than one Module Module Module thread Event Loop 2 dinsdag 30 oktober 12
  • 19. Verticle or Module Background Pool • Verticle is easy to use Event Loop 1 Verticle Verticle Worker Worker Core • Verticle needs to be configured with its Services classpath when running Event Bus • A module is a package of vert.x stuff complete with dependencies. Module Module Module Event Loop 2 dinsdag 30 oktober 12
  • 20. Communicating between modules • Send messages over the Event bus • Vert.x will automatically convert messages between modules Java JsonObject Groovy Map Ruby Hash JavaScript Object Python Hash dinsdag 30 oktober 12 Messages can contain contain raw types, but JSON is recommended to be used for information sending using messages.
  • 21. 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 dinsdag 30 oktober 12
  • 22. Demo: Office events Event Loop 1 Background Pool Backup App Core Services Event Bus Mongo Invitations Website Notifications Persistor Event Loop 2 Event Loop 1 https://github.com/jettro/vertx-samples/tree/master/office-events dinsdag 30 oktober 12 The office events demo is available on github. It is used to show modules, verticles and worker verticles in different languages.
  • 23. Module layout • Module naming: prefix.<name>-v<version> • mod.json • scripts or classes • lib/ - libraries required by the module dinsdag 30 oktober 12 mod.json is the configuration for the module containing the main item, worker or not and some other options.
  • 24. Configuration • Pass configuration when deploying a verticle or module • Use a json object • json is used according the language as discussed before dinsdag 30 oktober 12
  • 25. Events • Publish/Subscribe • Peer-to-Peer • Replying to messages • Distributed event-bus dinsdag 30 oktober 12 More info about event usage in Vert.x
  • 26. Logging • Default uses java utils logging • Use other logging framework: log4j for example • <home>/bin/vertx • DEFAULT_JVM_OPTS="-Dorg.vertx.logger-delegate-factory-class- name=org.vertx.java.core.logging.impl.Log4jLogDelegateFactory" • Add the library to the vertx lib folder • Create a log4j.properties file dinsdag 30 oktober 12
  • 27. There is more • Shared data • Embedded mode • Clustered mode dinsdag 30 oktober 12
  • 28. More info Vert.x Tim Fox @timfox Jettro http://vertx.io Downloads and Coenradie documentation http://groups.google.com/group/vertx @jettroCoenradie https://github.com/jettro/vertx- samples/ office-events @gridshore http://www.linkedin.com/in/jettro http://www.gridshore.nl http://www.trifork.nl https://github.com/jettro/ dinsdag 30 oktober 12
  • 29. Questions ?? Rock ?? Concert by Rod Stewart with 3.500.000 visitors dinsdag 30 oktober 12 Now we can scale our rock concert to around 3.5 million users.