O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a navegar o site, você aceita o uso de cookies. Leia nosso Contrato do Usuário e nossa Política de Privacidade.
O SlideShare utiliza cookies para otimizar a funcionalidade e o desempenho do site, assim como para apresentar publicidade mais relevante aos nossos usuários. Se você continuar a utilizar o site, você aceita o uso de cookies. Leia nossa Política de Privacidade e nosso Contrato do Usuário para obter mais detalhes.
First WWW page: August 1991XMLHTTP Request: 1996 (iframe, asynchronous content loading)AJAX as a term: 2005XMLHttpRequest spec by W3C in 2006
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
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.
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.
Long running requestsBlocking threads
In a lot of typical server applications threads are mostly waiting on IO.
Reactor Pattern: 1995threads are one of the bottlenecks for scaling
Ü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/
Event basierteprogrammier-model schlägvolldurch. KeineAbstraktion!Reading & Debugging (vs. sequential code)
Web-Server non blockingsiege -c100 -b -r100 "http://localhost:8081/?longrunning" Running_ From IDE, from commandline
Not really a framework, rather comparable with Tomcat or Jetty than with JSF or EJB
Verticles have their own classloaderMessages are passed by value
DEMO: Blocking WebServer
Most new functionality should be provided as modules
30’Event bus enables easy creation of real-time web applicationsMobile applications, gamesClint side library very small, can be used with any JS libraries
Distributed System very easy, same programming concepts
Building abstractionsAllowing long lived connections on a higher abstraction level than event-based APIs.
Loosely coupled Microservices
Vs. Real Time Computing- Receiver not known / ensured
vert.x - asynchronous event-driven web applications on the JVM
asynchronous event-driven web- applications on the JVM SBB Developer Day 2012 Jonas Bandi CompuGroup Medical @jbandi firstname.lastname@example.org
The C10k Problem Its time for web servers to handle ten thousand clients simultaneously, dont you think? After all, the web is a big place now. (Dan Kegel, 2003)"Real-time will become the default. It wont 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
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 ModelClients delegate long Workers running jobs & IO Event Loop (single request thread, non blocking) callback response
Demo (vert.x not blocking on 100concurrent longrunning requests) siege -c100 -b -r100 "http://localhost:8081/?longrunning"
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
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 WorkerServer Server Event Bus JVM
Web Application Demo Vertx Instance Module Module ModuleBrowser 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 systemVert.x is the platform for a new generation of polyglot web and enterprise applications.
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 …