SlideShare a Scribd company logo
1 of 39
asynchronous event-driven web-
    applications on the JVM
      SBB Developer Day 2012

           Jonas Bandi
         CompuGroup Medical

                                            @jbandi
                               jonas.bandi@gmail.com
Agenda
• Background / Motivation
• Vert.x Platform
• Demos
The Evolution of the Web
Static      Form-driven    AJAX-driven
Pages       applications   applications
Static        Form-driven    AJAX-driven     Real-time
Pages         applications   applications   applications




         http://www.mmoasteroids.com/
The Real Time Web
http://wordsquared.com/
www.cloud9ide.com
The C10k Problem
    It's time for web servers to handle ten
  thousand clients simultaneously, don't you
  think? After all, the web is a big place now.
                                                    (Dan Kegel, 2003)

"Real-time will become the default. It won't be
  this newfangled tech that only Google and
  Facebook and Twitter can afford to build.”
                                                 (ArsTechnica, 2012)
                                      http://en.wikipedia.org/wiki/C10k_problem
                                                 http://www.kegel.com/c10k.htm
     http://arstechnica.com/business/2012/05/say-hello-to-the-real-real-time-web
Connection


Client
         Request 1   Request 2       Request 3



          Thread 1    Thread 2        Thread 1



Server
Waiting …
 route                                               process               format
request                                              results              response




                       query db or                             Write to
                       web service                             log file

Scaling:




Problems: Context Switching, Stack Memory, Concurrency
Demo
(Tomcat blocking on 100 concurrent
      longrunning requests)

siege -c100 -b -r100 "http://localhost:8080/my-webapp/demo?blocking"
Addressing the Problem
• event-driven / asynchronous architecture
   – Many long lived connections are a feature of modern
     applications
   – OS threads are a precious resource
   – Blocked OS threads are bad!

• => Service many connections with a small number of
  threads
• Reactor Pattern (Douglas C. Schmidt, 1995)
   – Event Loop
• different programming model
  => on which abstraction?

                               http://en.wikipedia.org/wiki/Reactor_pattern
Different Programming Model

Clients
                                        delegate long    Workers
                                        running jobs
                                            & IO
                          Event Loop
                             (single
            request       thread, non
                           blocking)
                                              callback




               response
Scaling
Threads:




 Problems: Context Switching, Stack Memory, Concurrency


Event Loop:




                                   Async IO APIs (OS)
Established Solutions
• Nginx
• Jetty                       Infrastructure
• Apache AWF

• EventMachine (Ruby)
                              Application
• Tornado, Twisted (Python)   Frameworks
• Node.js (JavaScript)
Success of Node
• Written in JavaScript, based on V8
• Huge community & ecosystem

• DIRTy Applications: Data Intensive Real Time
• Mostly IO
• Shuffling data from one pipe to another
Meet
Demo
   (vert.x not blocking on 100
concurrent longrunning requests)
    siege -c100 -b -r100 "http://localhost:8081/?longrunning"
What is vert.x?
• General purpose application platform on the JVM
• Provides primarily asynchronous APIs
• Polyglot: Java, JavaScript/CoffeeScript, Groovy,
  Ruby, Python
• Simple but not Simplistic
• Popular for “modern” web applications
• Similarities with Node.js & Akka
• New approach to problems traditionally served
  by classic application servers
The Vert.x Project
•   Open-source (on Github, ASL 2.0)
•   Age: ~1.5 years
•   Sponsor: VMWare
•   Based on: Netty, Hazelcast, SockJS



                     sockjs

                                         Rhino
Core APIs
• TCP/SSL clients and servers
• HTTP/HTTPS clients and servers
  – including WebSockets
• Event bus
• File system
• 100% asynchronous
Verticle 3
                                Background Workers




                                                     Verticle 3
                                                     Verticle 3
Architecture




                                                     Verticle 3
                                                     Verticle 3
               Vertx Instance




                                                                           Event Bus
                                                                  Module




                                                                                       JVM
                                                     Verticle 2
                                                     Verticle 2
                                Event Loop

                                                     Verticle 2
                                                     Verticle 1
                                                     Verticle 1
Scaling
•   Scale by creating more Verticle instances
•   Use message passing to communicate
•   Fine-tune “pools” of verticles
•   For TCP and HTTP servers Vert.x does
    automatic load-balancing
Event Loops are no Silver Bullet
• Don’t block the event loop!
• Long running calculations
• Blocking APIs (i.e. JDBC)
• Most traditional Java libraries have blocking
  APIs
• => Hybrid Threading Model
    – Worker Verticles can block
    – Communication by message passing (Event Bus)
    – Leverage ecosystem of Java libraries
Concurrency Model
• A verticle instance is always single-threaded
• Very different approach from “Java-Style”
  multi-threaded concurrency
  – No more synchronized, volatile or locking
  – Avoid many classic race conditions
Event Bus Demo
                        Vertx Instance

           Event Loop                       Background Workers




                                       Worker

                                                Worker

                                                         Worker

                                                                  Worker

                                                                           Worker
Server

         Server




                           Event Bus



                             JVM
Distributed Event Bus
• Connect multiple Vert.x JVM instances
• Applications are loosely coupled components
  distributed across the network

• Event bus extends to client side JavaScript
• Use the same API on the client
• Distributed event space spans client and server
  nodes
• Ideal for modern “real-time” web applications
Distributed Event Bus Demo

Vertx Instance                                  Vertx Instance
                    Telnet
Event Loop                               Event Loop       Workers
                              Browser
   (JavaScript)




                                          WebSocket
   TCP Server




                                           HTTP &



                                                            Worker

                                                                     Worker
                                           Server
                             Event Bus


    JVM                                               JVM
Web Application Demo
                      Vertx Instance

                 Module          Module      Module
Browser

                  vertx.         vertx.       vertx.
                web-server      aut-mgr      mongo-      Mongo DB
                                             persistor




(WebSocket)                      Event Bus


                                   JVM
The Future
• Scala & Closure support
• Management, including GUI console
• Developer experience – IDE integration,
  testing
• Promises API?
• Direct-style API using continuations?
Summary
 • Polyglot – use the language(s) you want
 • Simple concurrency – wave goodbye to most race
   conditions
 • Leverage existing Java library ecosystem
 • Powerful distributed event bus which spans client
   and server
 • Powerful module system

Vert.x is the platform for a new generation of polyglot web
                 and enterprise applications.
Vert.x vs. Node.JS

          Polyglot    vs.   JavaScript
              JVM     vs.   V8
huge ecosystem of           big ecosystem of
                      vs.
     Java libraries         node modules
 small community      vs.   big community
The big picture
• Alternative approaches (Java):
  – Servlet 3.0
  – NIO connections
Who is using it?




     game-gorilla.com




                         gvmtool.net



 Helsinki Trip Planner
Would I use it now?

• Maybe -> where the distributed architecture
  really fits
• Might get interesting in the future…

• I don’t buy the polyglot story…
• I don’t fully buy the concurrency story …
Discussions?

More Related Content

What's hot

Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...HostedbyConfluent
 
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...Geert van der Cruijsen
 
Bringing code to the data: from MySQL to RocksDB for high volume searches
Bringing code to the data: from MySQL to RocksDB for high volume searchesBringing code to the data: from MySQL to RocksDB for high volume searches
Bringing code to the data: from MySQL to RocksDB for high volume searchesIvan Kruglov
 
Open HFT libraries in @Java
Open HFT libraries in @JavaOpen HFT libraries in @Java
Open HFT libraries in @JavaPeter Lawrey
 
SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersShivanand Arur
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentationBhavin Shah
 
Service discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudService discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudMarcelo Serpa
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineVMware Tanzu
 
How I started to love design patterns
How I started to love design patternsHow I started to love design patterns
How I started to love design patternsSamuel ROZE
 
Everything you want to know about Ingress
Everything you want to know about IngressEverything you want to know about Ingress
Everything you want to know about IngressJanakiram MSV
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache TomcatAuwal Amshi
 
Lessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimLessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimNatan Silnitsky
 
IoT & Azure (EventHub)
IoT & Azure (EventHub)IoT & Azure (EventHub)
IoT & Azure (EventHub)Mirco Vanini
 
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseApplication Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseVictoriaMetrics
 
GKE Tip Series how do i choose between gke standard, autopilot and cloud run
GKE Tip Series   how do i choose between gke standard, autopilot and cloud run GKE Tip Series   how do i choose between gke standard, autopilot and cloud run
GKE Tip Series how do i choose between gke standard, autopilot and cloud run Sreenivas Makam
 
Saturn 2018: Managing data consistency in a microservice architecture using S...
Saturn 2018: Managing data consistency in a microservice architecture using S...Saturn 2018: Managing data consistency in a microservice architecture using S...
Saturn 2018: Managing data consistency in a microservice architecture using S...Chris Richardson
 

What's hot (20)

Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
 
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
Techdays Helsinki - Creating the distributed apps of the future using dapr - ...
 
Bringing code to the data: from MySQL to RocksDB for high volume searches
Bringing code to the data: from MySQL to RocksDB for high volume searchesBringing code to the data: from MySQL to RocksDB for high volume searches
Bringing code to the data: from MySQL to RocksDB for high volume searches
 
Open HFT libraries in @Java
Open HFT libraries in @JavaOpen HFT libraries in @Java
Open HFT libraries in @Java
 
Intro to signalR
Intro to signalRIntro to signalR
Intro to signalR
 
Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
SignalR for ASP.NET Developers
SignalR for ASP.NET DevelopersSignalR for ASP.NET Developers
SignalR for ASP.NET Developers
 
MVC ppt presentation
MVC ppt presentationMVC ppt presentation
MVC ppt presentation
 
Service discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring CloudService discovery with Eureka and Spring Cloud
Service discovery with Eureka and Spring Cloud
 
Introducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring StatemachineIntroducing Saga Pattern in Microservices with Spring Statemachine
Introducing Saga Pattern in Microservices with Spring Statemachine
 
How I started to love design patterns
How I started to love design patternsHow I started to love design patterns
How I started to love design patterns
 
Everything you want to know about Ingress
Everything you want to know about IngressEverything you want to know about Ingress
Everything you want to know about Ingress
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 
Lessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - ReversimLessons Learned from 2000 Event Driven Microservices - Reversim
Lessons Learned from 2000 Event Driven Microservices - Reversim
 
IoT & Azure (EventHub)
IoT & Azure (EventHub)IoT & Azure (EventHub)
IoT & Azure (EventHub)
 
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouseApplication Monitoring using Open Source: VictoriaMetrics - ClickHouse
Application Monitoring using Open Source: VictoriaMetrics - ClickHouse
 
GKE Tip Series how do i choose between gke standard, autopilot and cloud run
GKE Tip Series   how do i choose between gke standard, autopilot and cloud run GKE Tip Series   how do i choose between gke standard, autopilot and cloud run
GKE Tip Series how do i choose between gke standard, autopilot and cloud run
 
Saturn 2018: Managing data consistency in a microservice architecture using S...
Saturn 2018: Managing data consistency in a microservice architecture using S...Saturn 2018: Managing data consistency in a microservice architecture using S...
Saturn 2018: Managing data consistency in a microservice architecture using S...
 

Similar to vert.x - asynchronous event-driven web applications on the JVM

Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure InteroperabilityMihai Dan Nadas
 
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 presentationStuart (Pid) Williams
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8amix3k
 
Is OSGi modularity always worth it?
Is OSGi modularity always worth it?Is OSGi modularity always worth it?
Is OSGi modularity always worth it?glynnormington
 
Vert.x introduction
Vert.x introductionVert.x introduction
Vert.x introductionGR8Conf
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeJAXLondon2014
 
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web DevelopmentXebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web DevelopmentMichaël Figuière
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmDmitri Zimine
 
Evented Ruby VS Node.js
Evented Ruby VS Node.jsEvented Ruby VS Node.js
Evented Ruby VS Node.jsNitin Gupta
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?jbandi
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivRon Perlmuter
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS drupalcampest
 

Similar to vert.x - asynchronous event-driven web applications on the JVM (20)

Windows Azure Interoperability
Windows Azure InteroperabilityWindows Azure Interoperability
Windows Azure Interoperability
 
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
 
Comet with node.js and V8
Comet with node.js and V8Comet with node.js and V8
Comet with node.js and V8
 
Is OSGi modularity always worth it?
Is OSGi modularity always worth it?Is OSGi modularity always worth it?
Is OSGi modularity always worth it?
 
Vert.x introduction
Vert.x introductionVert.x introduction
Vert.x introduction
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Server Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David DelabasseeServer Side JavaScript on the Java Platform - David Delabassee
Server Side JavaScript on the Java Platform - David Delabassee
 
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web DevelopmentXebia Knowledge Exchange (feb 2011) - Large Scale Web Development
Xebia Knowledge Exchange (feb 2011) - Large Scale Web Development
 
Vert.x devoxx london 2013
Vert.x devoxx london 2013Vert.x devoxx london 2013
Vert.x devoxx london 2013
 
Node js internal
Node js internalNode js internal
Node js internal
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Scala and Lift
Scala and LiftScala and Lift
Scala and Lift
 
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker SwarmGenomic Computation at Scale with Serverless, StackStorm and Docker Swarm
Genomic Computation at Scale with Serverless, StackStorm and Docker Swarm
 
Asif
AsifAsif
Asif
 
Evented Ruby VS Node.js
Evented Ruby VS Node.jsEvented Ruby VS Node.js
Evented Ruby VS Node.js
 
Kann JavaScript elegant sein?
Kann JavaScript elegant sein?Kann JavaScript elegant sein?
Kann JavaScript elegant sein?
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
Vertx Basics
Vertx BasicsVertx Basics
Vertx Basics
 
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
 

More from jbandi

From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reactionjbandi
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reactionjbandi
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?jbandi
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
 
Java & JavaScript: Best Friends?
Java & JavaScript: Best Friends?Java & JavaScript: Best Friends?
Java & JavaScript: Best Friends?jbandi
 
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014jbandi
 
Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)jbandi
 
NDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDNDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDjbandi
 
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETNDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETjbandi
 
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?jbandi
 
Testing: Chances and Challenges in an agile World
Testing: Chances and Challenges in an agile WorldTesting: Chances and Challenges in an agile World
Testing: Chances and Challenges in an agile Worldjbandi
 

More from jbandi (11)

From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
From User Action to Framework Reaction
From User Action to Framework ReactionFrom User Action to Framework Reaction
From User Action to Framework Reaction
 
Angular 2: What's New?
Angular 2: What's New?Angular 2: What's New?
Angular 2: What's New?
 
The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015The curious Life of JavaScript - Talk at SI-SE 2015
The curious Life of JavaScript - Talk at SI-SE 2015
 
Java & JavaScript: Best Friends?
Java & JavaScript: Best Friends?Java & JavaScript: Best Friends?
Java & JavaScript: Best Friends?
 
There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014There is something about JavaScript - Choose Forum 2014
There is something about JavaScript - Choose Forum 2014
 
Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)Professional JavaScript Development (An Introduction for Java Developers)
Professional JavaScript Development (An Introduction for Java Developers)
 
NDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDDNDC 2011 - Building .NET Applications with BDD
NDC 2011 - Building .NET Applications with BDD
 
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NETNDC 2011 - SpecFlow: Pragmatic BDD for .NET
NDC 2011 - SpecFlow: Pragmatic BDD for .NET
 
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?
Testing Heute: ein Relikt aus dem Zeitalter des goldenen Wasserfalls?
 
Testing: Chances and Challenges in an agile World
Testing: Chances and Challenges in an agile WorldTesting: Chances and Challenges in an agile World
Testing: Chances and Challenges in an agile World
 

Recently uploaded

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 

Recently uploaded (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

vert.x - asynchronous event-driven web applications on the JVM

  • 1. asynchronous event-driven web- applications on the JVM SBB Developer Day 2012 Jonas Bandi CompuGroup Medical @jbandi jonas.bandi@gmail.com
  • 2. Agenda • Background / Motivation • Vert.x Platform • Demos
  • 3. The Evolution of the Web Static Form-driven AJAX-driven Pages applications applications
  • 4. Static Form-driven AJAX-driven Real-time Pages applications applications applications http://www.mmoasteroids.com/
  • 8. The C10k Problem It's time for web servers to handle ten thousand clients simultaneously, don't you think? After all, the web is a big place now. (Dan Kegel, 2003) "Real-time will become the default. It won't be this newfangled tech that only Google and Facebook and Twitter can afford to build.” (ArsTechnica, 2012) http://en.wikipedia.org/wiki/C10k_problem http://www.kegel.com/c10k.htm http://arstechnica.com/business/2012/05/say-hello-to-the-real-real-time-web
  • 9. Connection Client Request 1 Request 2 Request 3 Thread 1 Thread 2 Thread 1 Server
  • 10. Waiting … route process format request results response query db or Write to web service log file Scaling: Problems: Context Switching, Stack Memory, Concurrency
  • 11. Demo (Tomcat blocking on 100 concurrent longrunning requests) siege -c100 -b -r100 "http://localhost:8080/my-webapp/demo?blocking"
  • 12. Addressing the Problem • event-driven / asynchronous architecture – Many long lived connections are a feature of modern applications – OS threads are a precious resource – Blocked OS threads are bad! • => Service many connections with a small number of threads • Reactor Pattern (Douglas C. Schmidt, 1995) – Event Loop • different programming model => on which abstraction? http://en.wikipedia.org/wiki/Reactor_pattern
  • 13. Different Programming Model Clients delegate long Workers running jobs & IO Event Loop (single request thread, non blocking) callback response
  • 14. Scaling Threads: Problems: Context Switching, Stack Memory, Concurrency Event Loop: Async IO APIs (OS)
  • 15. Established Solutions • Nginx • Jetty Infrastructure • Apache AWF • EventMachine (Ruby) Application • Tornado, Twisted (Python) Frameworks • Node.js (JavaScript)
  • 16.
  • 17.
  • 18.
  • 19. Success of Node • Written in JavaScript, based on V8 • Huge community & ecosystem • DIRTy Applications: Data Intensive Real Time • Mostly IO • Shuffling data from one pipe to another
  • 20. Meet
  • 21. Demo (vert.x not blocking on 100 concurrent longrunning requests) siege -c100 -b -r100 "http://localhost:8081/?longrunning"
  • 22. What is vert.x? • General purpose application platform on the JVM • Provides primarily asynchronous APIs • Polyglot: Java, JavaScript/CoffeeScript, Groovy, Ruby, Python • Simple but not Simplistic • Popular for “modern” web applications • Similarities with Node.js & Akka • New approach to problems traditionally served by classic application servers
  • 23. The Vert.x Project • Open-source (on Github, ASL 2.0) • Age: ~1.5 years • Sponsor: VMWare • Based on: Netty, Hazelcast, SockJS sockjs Rhino
  • 24. Core APIs • TCP/SSL clients and servers • HTTP/HTTPS clients and servers – including WebSockets • Event bus • File system • 100% asynchronous
  • 25. Verticle 3 Background Workers Verticle 3 Verticle 3 Architecture Verticle 3 Verticle 3 Vertx Instance Event Bus Module JVM Verticle 2 Verticle 2 Event Loop Verticle 2 Verticle 1 Verticle 1
  • 26. Scaling • Scale by creating more Verticle instances • Use message passing to communicate • Fine-tune “pools” of verticles • For TCP and HTTP servers Vert.x does automatic load-balancing
  • 27. Event Loops are no Silver Bullet • Don’t block the event loop! • Long running calculations • Blocking APIs (i.e. JDBC) • Most traditional Java libraries have blocking APIs • => Hybrid Threading Model – Worker Verticles can block – Communication by message passing (Event Bus) – Leverage ecosystem of Java libraries
  • 28. Concurrency Model • A verticle instance is always single-threaded • Very different approach from “Java-Style” multi-threaded concurrency – No more synchronized, volatile or locking – Avoid many classic race conditions
  • 29. Event Bus Demo Vertx Instance Event Loop Background Workers Worker Worker Worker Worker Worker Server Server Event Bus JVM
  • 30. Distributed Event Bus • Connect multiple Vert.x JVM instances • Applications are loosely coupled components distributed across the network • Event bus extends to client side JavaScript • Use the same API on the client • Distributed event space spans client and server nodes • Ideal for modern “real-time” web applications
  • 31. Distributed Event Bus Demo Vertx Instance Vertx Instance Telnet Event Loop Event Loop Workers Browser (JavaScript) WebSocket TCP Server HTTP & Worker Worker Server Event Bus JVM JVM
  • 32. Web Application Demo Vertx Instance Module Module Module Browser vertx. vertx. vertx. web-server aut-mgr mongo- Mongo DB persistor (WebSocket) Event Bus JVM
  • 33. The Future • Scala & Closure support • Management, including GUI console • Developer experience – IDE integration, testing • Promises API? • Direct-style API using continuations?
  • 34. Summary • Polyglot – use the language(s) you want • Simple concurrency – wave goodbye to most race conditions • Leverage existing Java library ecosystem • Powerful distributed event bus which spans client and server • Powerful module system Vert.x is the platform for a new generation of polyglot web and enterprise applications.
  • 35. Vert.x vs. Node.JS Polyglot vs. JavaScript JVM vs. V8 huge ecosystem of big ecosystem of vs. Java libraries node modules small community vs. big community
  • 36. The big picture • Alternative approaches (Java): – Servlet 3.0 – NIO connections
  • 37. Who is using it? game-gorilla.com gvmtool.net Helsinki Trip Planner
  • 38. Would I use it now? • Maybe -> where the distributed architecture really fits • Might get interesting in the future… • I don’t buy the polyglot story… • I don’t fully buy the concurrency story …

Editor's Notes

  1. http://www.mmoasteroids.comhttp://wordsquared.com/https://npmjs.org/https://github.com/popular/starredVertx module repositoryDEMO 1http://localhost:8080/my-webapp/demohttp://localhost:8080/my-webapp/demo?n=45&blockingsiege -c100 -b -r100 "http://localhost:8080/my-webapp/demo?blocking”DEMO 2siege -c100 -b -r100 "http://localhost:8081/?longrunning"
  2. First WWW page: August 1991XMLHTTP Request: 1996 (iframe, asynchronous content loading)AJAX as a term: 2005XMLHttpRequest spec by W3C in 2006
  3. Google TalkVs. Real Time Computing- Receiver not known / ensuredpush vs. pullusers receive information when publishedno need for active requiring informationthick clients in the browserdata is exchanged, not finished web page
  4. Herausforderung an unsere Internet-InfrastrukturVielmehrlanglebigeconnecctions connection / peristente connectionsMobile und grundsätzlicheVernetzungInternet of ThingsEs hat sichgezeigt, dass 10’000 connections so eine “magisce” Grenzeist, die eszuknackengibt.
  5. This can involve a combination of operating system constraints and web server software limitations.While there are some specialized web servers that can handle more than ten thousand client connections, most web servers currently handle at most ten thousand clients simultaneously.http://stackoverflow.com/questions/763579/how-many-threads-can-a-java-vm-supportSo under 32-bit Windows, for example, where each process has a user address space of 2GB, giving each thread a 128K stack size, you'd expect an absolute maximum of 16384 threads (=2*1024*1024 / 128). In practice, I find I can start up about 13,000 under XP.
  6. Long running requestsBlocking threads
  7. In a lot of typical server applications threads are mostly waiting on IO.
  8. Reactor Pattern: 1995threads are one of the bottlenecks for scaling
  9. ÜberleitungzuNode.jsTwisted: Apple Calendar, NASA, Twilio …Node: LinkedIn, Walmart, Microsoft, Yammer, Browserling.MS: Azure Mobile Services uses Node in the Backend http://www.windowsazure.com/en-us/develop/mobile/
  10. Node is simple. The learning-curve is not steep (if you accept JavaScript)Node embraces JavaScript (Devs, JSON, Browser-Platforms, Mobile)JavaScript is Event-Driven, non-blocking and single-threaded in the Client Node mixes runtime platform with application framework.-> This fits the cloud model
  11. Event basierteprogrammier-model schlägvolldurch. KeineAbstraktion!Reading & Debugging (vs. sequential code)
  12. JavaScript:Huge amount of Web-DevelopersJavaScript fits Event-Based Architecture (Single threaded Event-Loop in Browser), existing concepts and libraries can be reusedEvent-Based API is known by those developersSimple, easy to learnPerformant und skalierteinigermassenNode jumped into the space of real-time web applications. Mostly PHP Devs … on the edge of Web & Enterprise Übergang z vertx
  13. 15’
  14. Web-Server non blockingsiege -c100 -b -r100 "http://localhost:8081/?longrunning" Running_ From IDE, from commandline
  15. Not really a framework, rather comparable with Tomcat or Jetty than with JSF or EJB
  16. Verticles have their own classloaderMessages are passed by value
  17. DEMO: Blocking WebServer
  18. Most new functionality should be provided as modules
  19. DEMO: Instances
  20. BlockingScalingMessage Passing
  21. 30’Event bus enables easy creation of real-time web applicationsMobile applications, gamesClint side library very small, can be used with any JS libraries
  22. Distributed System very easy, same programming concepts
  23. Building abstractionsAllowing long lived connections on a higher abstraction level than event-based APIs.
  24. Loosely coupled Microservices
  25. Vs. Real Time Computing- Receiver not known / ensured