Upgrade to Pro — share decks privately, control downloads, hide ads and more …

vert.x - asynchronous applications + big data

Avatar for Pid Pid
March 26, 2013

vert.x - asynchronous applications + big data

vert.x - asynchronous applications + big data

Avatar for Pid

Pid

March 26, 2013
Tweet

More Decks by Pid

Other Decks in Programming

Transcript

  1. s vert.x? al purpose application platform cially similar to Node.js

    – but not a clone! ronous APIs t – mix and match Java, JavaScript/CoffeeScript, Ruby, Gro (others to follow). but not Simplistic the new breed of application platforms
  2. cript – Mozilla Rhino tx.js’) reateHttpServer().requestHandler(function(req) { e = req.path

    === '/' ? 'index.html' : req.path; sponse.sendFile('webroot/' + file); 8080)
  3. – jruby.org vertx" ttpServer.new.request_handler do |req| req.uri == "/" ?

    "index.html" : req.uri sponse.send_file "webroot/#{file}” n(8080)
  4. y – groovy-lang.org reateHttpServer().requestHandler { req -> e = req.uri

    == "/" ? "index.html" : req.uri sponse.sendFile "webroot/$file” 080)
  5. tx.java.core.Handler; tx.java.core.http.HttpServerRequest; tx.java.deploy.Verticle; ver extends Verticle { tart() { eateHttpServer().requestHandler(new

    Handler<HttpServerRequest>() { void handle(HttpServerRequest req) { ng file = req.path.equals("/") ? "index.html" : req.path; response.sendFile("webroot/" + file); 080);
  6. – soon! reateHttpServer tHandler { req: HttpServerRequest => : String

    = if (req.path == “/”) “/index.html” else req.u ponse.sendFile("webroot/" + file) 8080)
  7. ding Model implements the Multi-Reactor Pattern nt loop is an

    OS thread s events for many handlers has multiple event loops. Typically one per core. block the event loop!
  8. Threading Model rce everything to run on an event loop

    verticles can block nicate with other verticles by message passing. us to leverage the huge ecosystem of blocking Java libs
  9. Bus ous system of Vert.x communicate using the event bus.

    mple API. point. Publish/Subscribe. Request/Response. ple strings, numbers or other primitive types. essages are preferred for structured data. ent clustering
  10. Bus – Example dler = function(message) { e.log('Received message '

    + message.msg) ventBus.registerHandler('example.address', handler) etPeriodic(1000, function() { eventBus.send('example.address', { msg: 'foo’ })
  11. Bus – Extended to Browser us extends to client side

    JavaScript too e same API on the client ul distributed event space spanning both client and se r modern “real-time” web applications
  12. es cation Manager pload rsistor ersistor Manager ▪  Web Server

    ▪  Work Queue ▪  AMQP ▪  More…
  13. web-server js’) = { ot": <web_root>, port>, l>, re_password": <key_store_password>,

    re_path": <key_store_path>, oyModule('vertx.web-server-v1.0', config, 1, function() { d
  14. osition ode using code are unit of composed code modules

    using a verticle de multiple verticles inside a module er: verticles communicate using the Event Bus.
  15. ple

  16. st Data me Analytics Dashboards & APIs ocket t Integration

    nguage independent format like JSON, XML for data nge messages using event bus
  17. st Data – Redis ructure Server” e store messaging aching

    verticle data, broadcasting to verticles
  18. st Data – GemFire e Grid / Distributed Cache ble

    Key-Value store arge partitioned caches, high performance compute, a to vert.x using CacheListeners, subscriptions, Asyn
  19. ata – Hadoop course! ries via JDBC worker verticle pattern

    via event bus d-hoc queries on large datasets
  20. ata – MQTT T is a machine-to-machine (M2M) / "Internet

    of Thing ctivity protocol. mely lightweight publish/subscribe messaging transpor eful for connections with remote locations where a int is required and/or network bandwidth is at a pre e Paho oon!
  21. ata – Intravert (@zznate - apigee) ors, filters and procedures

    allow you perform arbitrary pro mations on the server side before the results are returned procedures and join like logic in a single RPC request elim rips e transport and JSON API that runs over HTTP allows clie rom JSON, JSON compressed by smile, & even big fat sex EST interface (ever thought about what would a Cassandr PI look like?) with simple familiar objects like String or Integer instead of
  22. Deployment vides a JSON RPC API: er.js RpcServer.groovy ration.groovy –

    worker ring Integration message flow to RabbitMQ
  23. ary ps as set of loosely coupled components that live

    any – use the language(s) you want oncurrency – wave goodbye to most race conditions existing Java library ecosystem ystem – empower the community e.js apps too ve Vert.x is the platform for the new generation of p nd enterprise applications
  24. Q&A