vert.x                         Polyglot and Scalable Apps on the JVM                              Álvaro Videla | VMwareTu...
About Me                     •   Developer Advocate for Cloud Foundry                     •   Blog: http://videlalvaro.git...
About Me                     •   Developer Advocate for Cloud Foundry                     •   Blog: http://videlalvaro.git...
About Me                         Co-authored                RabbitMQ in Action               http://bit.ly/rabbitmqTuesday...
vert.xTuesday, October 9, 12
vert.x                     • VMware sponsored OS projectTuesday, October 9, 12
vert.x                     • VMware sponsored OS project                     • JVM BasedTuesday, October 9, 12
vert.x                     • VMware sponsored OS project                     • JVM Based                     • 1+ yearTues...
vert.x                     • VMware sponsored OS project                     • JVM Based                     • 1+ year    ...
vert.x                          Framework to write                                 polyglot,                         highl...
vert.x                          Framework to write                                polyglot,                         highly...
Javascript             load(vertx.js)             vertx.createHttpServer().requestHandler(function(req) {                 ...
Javascript             load(vertx.js)             vertx.createHttpServer().requestHandler(function(req) {                 ...
Javascript             load(vertx.js)             vertx.createHttpServer().requestHandler(function(req) {                 ...
Ruby             require "vertx"             Vertx::HttpServer.new.request_handler do |req|                 file = req.uri...
Python             import vertx             server = vertx.create_http_server()             @server.request_handler       ...
Groovy             vertx.createHttpServer().requestHandler { req ->                 def file = req.uri == "/" ? "index.htm...
Java                import org.vertx.java.core.Handler;                import org.vertx.java.core.http.HttpServerRequest; ...
vert.x                          Framework to write                               polyglot,                         highly ...
Core ConceptsTuesday, October 9, 12
Core Concepts                     • VerticleTuesday, October 9, 12
Core Concepts                     • Verticle                     • vert.x instancesTuesday, October 9, 12
Core Concepts                     • Verticle                     • vert.x instances                     • Event BusTuesday...
Verticles run inside a                             vert.x instance.                         A single vert.x instance      ...
Tuesday, October 9, 12
vertx run server.js -instances 32Tuesday, October 9, 12
Programming Model                     • Event Based (similar to node.js)                     • Event Handlers             ...
vert.x coreTuesday, October 9, 12
vert.x core                     •   TCP/SSL ServersTuesday, October 9, 12
vert.x core                     •   TCP/SSL Servers                     •   HTTP/HTTPS ServersTuesday, October 9, 12
vert.x core                     •   TCP/SSL Servers                     •   HTTP/HTTPS Servers                     •   Web...
vert.x core                     •   TCP/SSL Servers                     •   HTTP/HTTPS Servers                     •   Web...
vert.x core                     •   TCP/SSL Servers                     •   HTTP/HTTPS Servers                     •   Web...
vert.x core                     •   TCP/SSL Servers                     •   HTTP/HTTPS Servers                     •   Web...
Event BusTuesday, October 9, 12
Event Bus                     •   Allows Verticles to talk to each otherTuesday, October 9, 12
Event Bus                     •   Allows Verticles to talk to each other                     •   Works cross languageTuesd...
Event Bus                     •   Allows Verticles to talk to each other                     •   Works cross language     ...
Event Bus                     •   Allows Verticles to talk to each other                     •   Works cross language     ...
Event Bus - How                     •   Register HandlersTuesday, October 9, 12
Event Bus - How                     •   Register Handlers                     •   Unregister HandlersTuesday, October 9, 12
Event Bus - How                     •   Register Handlers                     •   Unregister Handlers                     ...
Event Bus - How                     •   Register Handlers                     •   Unregister Handlers                     ...
Register Handler                         var eb = vertx.eventBus;                         var myHandler = function(message...
Register Handler                         var eb = vertx.eventBus;                         var myHandler = function(message...
Publish Subscribe       eb.publish(test.address, hello world);Tuesday, October 9, 12
Point to Point       eb.send(test.address, hello world);Tuesday, October 9, 12
RPC Server                         var myHandler = function(message, replier) {                           log.info(I recei...
RPC Client         eb.send(test.address, This is a message, function(reply) {             log.info(I received a reply  + r...
Shared Data                     •   Shared MapsTuesday, October 9, 12
Shared Data                     •   Shared Maps                     •   Shared SetsTuesday, October 9, 12
Shared Set Example    load(vertx.js)    var	  conns	  =	  vertx.getSet(conns)    var	  server	  =	  vertx.createNetServer(...
BenchmarksTuesday, October 9, 12
Benchmarks I           http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, Octo...
Benchmarks II           http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, Oct...
InternalsTuesday, October 9, 12
Internals                     • Netty for network IO                     • JRuby for the Ruby Engine                     •...
http://vertx.io/Tuesday, October 9, 12
Questions?Tuesday, October 9, 12
Thanks!                             http://twitter.com/old_sound                            https://github.com/videlalvaro...
Upcoming SlideShare
Loading in...5
×

Vertx

5,744

Published on

Talk about vert.x given at @webtuesday

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

No Downloads
Views
Total Views
5,744
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
116
Comments
0
Likes
12
Embeds 0
No embeds

No notes for slide

Vertx

  1. 1. vert.x Polyglot and Scalable Apps on the JVM Álvaro Videla | VMwareTuesday, October 9, 12
  2. 2. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_soundTuesday, October 9, 12
  3. 3. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound • I created gifsockets™Tuesday, October 9, 12
  4. 4. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmqTuesday, October 9, 12
  5. 5. vert.xTuesday, October 9, 12
  6. 6. vert.x • VMware sponsored OS projectTuesday, October 9, 12
  7. 7. vert.x • VMware sponsored OS project • JVM BasedTuesday, October 9, 12
  8. 8. vert.x • VMware sponsored OS project • JVM Based • 1+ yearTuesday, October 9, 12
  9. 9. vert.x • VMware sponsored OS project • JVM Based • 1+ year • By @timfox from HornetMQ fameTuesday, October 9, 12
  10. 10. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 12
  11. 11. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 12
  12. 12. Javascript load(vertx.js) vertx.createHttpServer().requestHandler(function(req) { var file = req.path === / ? index.html : req.path; req.response.sendFile(webroot/ + file); }).listen(8080)Tuesday, October 9, 12
  13. 13. Javascript load(vertx.js) vertx.createHttpServer().requestHandler(function(req) { var file = req.path === / ? index.html : req.path; req.response.sendFile(webroot/ + file); }).listen(8080) $ vertx run server.jsTuesday, October 9, 12
  14. 14. Javascript load(vertx.js) vertx.createHttpServer().requestHandler(function(req) { var file = req.path === / ? index.html : req.path; req.response.sendFile(webroot/ + file); }).listen(8080) $ vertx run server.js -instances 32Tuesday, October 9, 12
  15. 15. Ruby 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) $ vertx run server.rb -instances 32Tuesday, October 9, 12
  16. 16. Python 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) $ vertx run server.py -instances 32Tuesday, October 9, 12
  17. 17. Groovy vertx.createHttpServer().requestHandler { req -> def file = req.uri == "/" ? "index.html" : req.uri req.response.sendFile "webroot/$file" }.listen(8080) $ vertx run Server.groovy -instances 32Tuesday, October 9, 12
  18. 18. 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); } } $ vertx run Server.java -instances 32Tuesday, October 9, 12
  19. 19. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 12
  20. 20. Core ConceptsTuesday, October 9, 12
  21. 21. Core Concepts • VerticleTuesday, October 9, 12
  22. 22. Core Concepts • Verticle • vert.x instancesTuesday, October 9, 12
  23. 23. Core Concepts • Verticle • vert.x instances • Event BusTuesday, October 9, 12
  24. 24. Verticles run inside a vert.x instance. A single vert.x instance runs inside its own JVM instance.Tuesday, October 9, 12
  25. 25. Tuesday, October 9, 12
  26. 26. vertx run server.js -instances 32Tuesday, October 9, 12
  27. 27. Programming Model • Event Based (similar to node.js) • Event Handlers • Small set of threads per vert.x instance • Verticles are executed using the same thread. • Message Passing CommunicationTuesday, October 9, 12
  28. 28. vert.x coreTuesday, October 9, 12
  29. 29. vert.x core • TCP/SSL ServersTuesday, October 9, 12
  30. 30. vert.x core • TCP/SSL Servers • HTTP/HTTPS ServersTuesday, October 9, 12
  31. 31. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.jsTuesday, October 9, 12
  32. 32. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.js • Distributed Event Bus AccessTuesday, October 9, 12
  33. 33. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.js • Distributed Event Bus Access • Shared Maps and SetsTuesday, October 9, 12
  34. 34. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.js • Distributed Event Bus Access • Shared Maps and Sets • LoggingTuesday, October 9, 12
  35. 35. Event BusTuesday, October 9, 12
  36. 36. Event Bus • Allows Verticles to talk to each otherTuesday, October 9, 12
  37. 37. Event Bus • Allows Verticles to talk to each other • Works cross languageTuesday, October 9, 12
  38. 38. Event Bus • Allows Verticles to talk to each other • Works cross language • Works across the clusterTuesday, October 9, 12
  39. 39. Event Bus • Allows Verticles to talk to each other • Works cross language • Works across the cluster • Spans from server to client sideTuesday, October 9, 12
  40. 40. Event Bus - How • Register HandlersTuesday, October 9, 12
  41. 41. Event Bus - How • Register Handlers • Unregister HandlersTuesday, October 9, 12
  42. 42. Event Bus - How • Register Handlers • Unregister Handlers • AddressesTuesday, October 9, 12
  43. 43. Event Bus - How • Register Handlers • Unregister Handlers • Addresses • Messages (Transient)Tuesday, October 9, 12
  44. 44. Register Handler var eb = vertx.eventBus; var myHandler = function(message)) { log.info(I received a message + message); } eb.registerHandler(test.address, myHandler);Tuesday, October 9, 12
  45. 45. Register Handler var eb = vertx.eventBus; var myHandler = function(message)) { log.info(I received a message + message); } eb.registerHandler(test.address, myHandler); eb.unregisterHandler(test.address, myHandler);Tuesday, October 9, 12
  46. 46. Publish Subscribe eb.publish(test.address, hello world);Tuesday, October 9, 12
  47. 47. Point to Point eb.send(test.address, hello world);Tuesday, October 9, 12
  48. 48. RPC Server var myHandler = function(message, replier) { log.info(I received a message + message); // Do some stuff // Now reply to it replier(This is a reply); } eb.registerHandler(test.address, myHandler);Tuesday, October 9, 12
  49. 49. RPC Client eb.send(test.address, This is a message, function(reply) { log.info(I received a reply + reply); });Tuesday, October 9, 12
  50. 50. Shared Data • Shared MapsTuesday, October 9, 12
  51. 51. Shared Data • Shared Maps • Shared SetsTuesday, October 9, 12
  52. 52. Shared Set Example load(vertx.js) var  conns  =  vertx.getSet(conns) var  server  =  vertx.createNetServer().connectHandler(function(socket)  {    conns.add(socket.writeHandlerID)    socket.dataHandler(function(data)  {        var  aconns  =  conns.toArray();        for  (var  i  =  0;  i  <  aconns.length;  i++)  {            vertx.eventBus.send(aconns[i],  data)        }    });    socket.closedHandler(function()  {  conns.remove(  socket.writeHandlerID)  }); }).listen(1234)Tuesday, October 9, 12
  53. 53. BenchmarksTuesday, October 9, 12
  54. 54. Benchmarks I http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, October 9, 12
  55. 55. Benchmarks II http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, October 9, 12
  56. 56. InternalsTuesday, October 9, 12
  57. 57. Internals • Netty for network IO • JRuby for the Ruby Engine • Groovy • Mozilla Rhino for JS • Jython for Python support • Hazelcast for clusteringTuesday, October 9, 12
  58. 58. http://vertx.io/Tuesday, October 9, 12
  59. 59. Questions?Tuesday, October 9, 12
  60. 60. Thanks! http://twitter.com/old_sound https://github.com/videlalvaro/ http://www.slideshare.net/old_soundTuesday, October 9, 12
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×