Your SlideShare is downloading. ×
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
Vertx
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

Vertx

5,505

Published on

Talk about vert.x given at @webtuesday

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,505
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
112
Comments
0
Likes
12
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.x Polyglot and Scalable Apps on the JVM Álvaro Videla | VMwareTuesday, October 9, 12
  • 2. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_soundTuesday, October 9, 12
  • 3. About Me • Developer Advocate for Cloud Foundry • Blog: http://videlalvaro.github.com/ • Twitter: @old_sound • I created gifsockets™Tuesday, October 9, 12
  • 4. About Me Co-authored RabbitMQ in Action http://bit.ly/rabbitmqTuesday, October 9, 12
  • 5. vert.xTuesday, October 9, 12
  • 6. vert.x • VMware sponsored OS projectTuesday, October 9, 12
  • 7. vert.x • VMware sponsored OS project • JVM BasedTuesday, October 9, 12
  • 8. vert.x • VMware sponsored OS project • JVM Based • 1+ yearTuesday, October 9, 12
  • 9. vert.x • VMware sponsored OS project • JVM Based • 1+ year • By @timfox from HornetMQ fameTuesday, October 9, 12
  • 10. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 12
  • 11. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 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. 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. 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. 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. 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. 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. 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. vert.x Framework to write polyglot, highly concurrent apps.Tuesday, October 9, 12
  • 20. Core ConceptsTuesday, October 9, 12
  • 21. Core Concepts • VerticleTuesday, October 9, 12
  • 22. Core Concepts • Verticle • vert.x instancesTuesday, October 9, 12
  • 23. Core Concepts • Verticle • vert.x instances • Event BusTuesday, October 9, 12
  • 24. Verticles run inside a vert.x instance. A single vert.x instance runs inside its own JVM instance.Tuesday, October 9, 12
  • 25. Tuesday, October 9, 12
  • 26. vertx run server.js -instances 32Tuesday, October 9, 12
  • 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. vert.x coreTuesday, October 9, 12
  • 29. vert.x core • TCP/SSL ServersTuesday, October 9, 12
  • 30. vert.x core • TCP/SSL Servers • HTTP/HTTPS ServersTuesday, October 9, 12
  • 31. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.jsTuesday, October 9, 12
  • 32. vert.x core • TCP/SSL Servers • HTTP/HTTPS Servers • Websockets and Sock.js • Distributed Event Bus AccessTuesday, October 9, 12
  • 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. 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. Event BusTuesday, October 9, 12
  • 36. Event Bus • Allows Verticles to talk to each otherTuesday, October 9, 12
  • 37. Event Bus • Allows Verticles to talk to each other • Works cross languageTuesday, October 9, 12
  • 38. Event Bus • Allows Verticles to talk to each other • Works cross language • Works across the clusterTuesday, October 9, 12
  • 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. Event Bus - How • Register HandlersTuesday, October 9, 12
  • 41. Event Bus - How • Register Handlers • Unregister HandlersTuesday, October 9, 12
  • 42. Event Bus - How • Register Handlers • Unregister Handlers • AddressesTuesday, October 9, 12
  • 43. Event Bus - How • Register Handlers • Unregister Handlers • Addresses • Messages (Transient)Tuesday, October 9, 12
  • 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. 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. Publish Subscribe eb.publish(test.address, hello world);Tuesday, October 9, 12
  • 47. Point to Point eb.send(test.address, hello world);Tuesday, October 9, 12
  • 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. RPC Client eb.send(test.address, This is a message, function(reply) { log.info(I received a reply + reply); });Tuesday, October 9, 12
  • 50. Shared Data • Shared MapsTuesday, October 9, 12
  • 51. Shared Data • Shared Maps • Shared SetsTuesday, October 9, 12
  • 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. BenchmarksTuesday, October 9, 12
  • 54. Benchmarks I http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, October 9, 12
  • 55. Benchmarks II http://vertxproject.wordpress.com/2012/05/09/vert-x-vs-node-js-simple-http-benchmarks/Tuesday, October 9, 12
  • 56. InternalsTuesday, October 9, 12
  • 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. http://vertx.io/Tuesday, October 9, 12
  • 59. Questions?Tuesday, October 9, 12
  • 60. Thanks! http://twitter.com/old_sound https://github.com/videlalvaro/ http://www.slideshare.net/old_soundTuesday, October 9, 12

×