Your SlideShare is downloading. ×
0
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Vert.x devoxx london 2013
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Vert.x devoxx london 2013

3,871

Published on

vert.x overview at Devoxx UK 2013

vert.x overview at Devoxx UK 2013

Published in: Technology
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,871
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
79
Comments
0
Likes
11
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. vert.xasynchronous applications + big data Pid – Stuart Williams Consulting Architect SpringSource @pidster
  • 2. Pid (Stuart Williams) Speaker Bio ■ Consulting Architect at SpringSource / Pivotal Application architecture, performance (and hand-waving) ■ Projects ■ Communities ■ vert.x ■ Apache Tomcat ■ Apache Oltu (OAuth) ■ Groovy 3
  • 3. vert.x project Project Lead @timfox Committers @pidster @normanm (netty) 4
  • 4. What is vert.x?  General purpose application platform  Superficially similar to Node.js – but not a clone!  Asynchronous APIs  Polyglot – mix and match Java, JavaScript/CoffeeScript, Ruby, Groovy and Python (others to follow).  Simple but not Simplistic  Part of the new breed of application platforms 5
  • 5. Key Features Hybrid Reactor Polyglot Container TCP/SSL clients and servers HTTP/HTTPS clients and servers – including WebSockets File system Event bus 100% asynchronous 6
  • 6. Code! Super simple HTTP server Serves files by matching request path One example for each language 7
  • 7. JavaScript – Mozilla Rhino load(vertx.js’) vertx.createHttpServer().requestHandler(function(req) { var file = req.path === / ? index.html : req.path; req.response.sendFile(webroot/ + file); }).listen(8080) 8
  • 8. Python – www.jython.org import vertx server = vertx.create_http_server() @server.request_handler def request_handler(req): file = "index.html" if req.uri == "/" else req.uri req.response.send_file("webroot/%s"%file) server.listen(8080) 9
  • 9. Ruby – jruby.org require "vertx" Vertx::HttpServer.new.request_handler do |req| file = req.uri == "/" ? "index.html" : req.uri req.response.send_file "webroot/#{file}” end.listen(8080) 10
  • 10. Groovy – groovy-lang.org vertx.createHttpServer().requestHandler { req -> def file = req.uri == "/" ? "index.html" : req.uri req.response.sendFile "webroot/$file” }.listen(8080) 11
  • 11. Java import org.vertx.java.core.Handler; import org.vertx.java.core.http.HttpServerRequest; import org.vertx.java.deploy.Verticle; public class Server extends Verticle { public void start() { vertx.createHttpServer().requestHandler(new Handler<HttpServerRequest>() { public void handle(HttpServerRequest req) { String file = req.path.equals("/") ? "index.html" : req.path; req.response.sendFile("webroot/" + file); } }).listen(8080); } } 12
  • 12. Scala – soon! vertx.createHttpServer .requestHandler { req: HttpServerRequest => val file : String = if (req.path == “/”) “/index.html” else req.uri req.response.sendFile("webroot/" + file) } .listen(8080) 13
  • 13. More languages? DynJS 100% InvokeDynamic Alternative to Rhino for JavaScript Node.js Compatibility for vert.x Clojure? What language support do you want see? 14
  • 14. Thread Pools Non-blocking Event Loops Core Loop Acceptors Blocking Worker Pool 15
  • 15. Threading Model  Vert.x implements the Multi-Reactor Pattern  An event loop is an OS thread  Handles events for many handlers  Vert.x has multiple event loops. Typically one per core.  Dont block the event loop! 16
  • 16. Hybrid Threading Model  Dont force everything to run on an event loop  Worker verticles can block  Communicate with other verticles by message passing.  Allows us to leverage the huge ecosystem of blocking Java libs 17
  • 17. Components Server & Client TCP HTTP WebSocket SockJS Event Bus Point-to-point, publish-subscribe Transparent clustering 18
  • 18. Event Bus The nervous system of Vert.x Verticles communicate using the event bus. Super simple API. Point to point. Publish/Subscribe. Request/Response. Pass simple strings, numbers or other primitive types. JSON messages are preferred for structured data. Transparent clustering 19
  • 19. Event Bus – Example var handler = function(message) { console.log(Received message + message.msg) } vertx.eventBus.registerHandler(example.address, handler) vertx.setPeriodic(1000, function() { vertx.eventBus.send(example.address, { msg: foo’ }) }) 20
  • 20. Event Bus – Extended to Browser Event bus extends to client side JavaScript too Uses the same API on the client Powerful distributed event space spanning both client and server nodes Ideal for modern “real-time” web applications 21
  • 21. Modules Authentication Manager ■ Web Server Form Upload ■ Work Queue JDBC Persistor ■ AMQP Mailer ■ More… Mongo Persistor Session Manager 22
  • 22. mod-web-server load(vertx.js’) var config = { "web_root": <web_root>, "port", <port>, "ssl": <ssl>, "key_store_password": <key_store_password>, "key_store_path": <key_store_path>, } vertx.deployModule(vertx.web-server-v1.0, config, 1, function() { // deployed }); 23
  • 23. Composition Deploy code using code Modules are unit of composed code Deploy modules using a verticle Or provide multiple verticles inside a module Remember: verticles communicate using the Event Bus. 24
  • 24. Architecture I/O verticles Logic verticles Separation of concerns Workers if required Event Bus Polyglot Worker verticle 25
  • 25. Example …. 26
  • 26. Big Fast Data Realtime Analytics Dashboards & APIs WebSocket SockJS Polyglot Integration Use language independent format like JSON, XML for data Exchange messages using event bus 27
  • 27. Fast Data – RabbitMQ AMQP message broker Use for queuing, routing messages and WAN clustering 28
  • 28. Big/Fast Data – Redis “Data Structure Server” Key-Value store Pub-sub messaging Use for caching verticle data, broadcasting to verticles 29
  • 29. Big/Fast Data – GemFire Compute Grid / Distributed Cache Embeddable Key-Value store Use for large partitioned caches, high performance compute, WANs Send data to vert.x using CacheListeners, subscriptions, AsyncQueues 30
  • 30. Big Data – Hadoop Hive – of course! SQL queries via JDBC worker verticle Standard pattern via event bus Use for ad-hoc queries on large datasets 31
  • 31. Big Data – MQTT  MQTT is a machine-to-machine (M2M) / "Internet of Things” connectivity protocol.  Extremely lightweight publish/subscribe messaging transport.  It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.  Eclipse Paho Coming soon! 32
  • 32. Big Data – Intravert (@zznate - apigee)  Processors, filters and procedures allow you perform arbitrary programmatic transformations on the server side before the results are returned to the client.  Execute procedures and join like logic in a single RPC request eliminating round-trips  A simple transport and JSON API that runs over HTTP allows clients to choose from JSON, JSON compressed by smile, & even big fat sexy XML  A real REST interface (ever thought about what would a Cassandra hyper media API look like?)  Work with simple familiar objects like String or Integer instead of bytes 33
  • 33. v2.0 – Features  New ClassLoader  Netty 4.0  Languages as modules  Flexible Module repositories, including Maven  Management 34
  • 34. v2.0 – Developer experience  Gradle template project  Maven archetype and plugins  Zero setup IDE debugging  Zero setup IDE testing  Test Tools project 35
  • 35. Management Management Agent Publishes metrics on Event Bus in JSON format Management GUI JMX Demo 36
  • 36. Real Deployment vert.x provides a JSON RPC API:  deployer.js  JsonRpcServer.groovy  Integration.groovy – worker  Spring Integration message flow to RabbitMQ Dynamically deploys components to consume queues:  Consumer.groovy – worker, Spring Integration message flow  JsonRpcClient.groovy 37
  • 37. Real Deployment I/O verticles Worker Verticles HTTP Spring Integration JSON RPC AMQP publisher Event Bus HTTP Spring Integration (Groovy DSL) JSON RPC Client AMQP Consumer 38
  • 38. Summary Write apps as set of loosely coupled components that live anywhere Polyglot – use the language(s) you want Simple concurrency – wave goodbye to most race conditions Leverage existing Java library ecosystem Module system – empower the community Run Node.js apps too We believe Vert.x is the platform for the new generation of polyglot web and enterprise applications 39
  • 39. Q&A

×