Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Simone Bordet
sbordet@intalio.com
Cloud-Ready
Web Messagging
with CometD
CloudConf – Torino
April 3rd, 2014
Simone Bordet
sbordet@intalio.com
Who Am I
 Simone Bordet
 sbordet@intalio.com
 @simonebordet
 Open Source Contributor...
Simone Bordet
sbordet@intalio.com
Agenda
 What is CometD ?
 CometD Use Cases
 CometD Features
 Questions & Answers
Simone Bordet
sbordet@intalio.com
What is CometD ?
Simone Bordet
sbordet@intalio.com
What is CometD
 CometD is a web messaging framework
 Implements a publish/subscribe pa...
Simone Bordet
sbordet@intalio.com
CometD Use Cases
Simone Bordet
sbordet@intalio.com
CometD Use Cases
 Social Networking
 Chat and Notifications
Simone Bordet
sbordet@intalio.com
CometD Use Cases
 Online Gaming
 Not First Person Shooters – yet :)
Simone Bordet
sbordet@intalio.com
CometD Use Cases
 Auctions & Trading
 Updating bids, prices and availability
Simone Bordet
sbordet@intalio.com
CometD Use Cases
 Systems Monitoring
 Alerts and System Status
Simone Bordet
sbordet@intalio.com
CometD Use Cases
 Online Collaboration/Productivity Tools
Simone Bordet
sbordet@intalio.com
Comet Web Applications
 A new kind of web applications
 Server-side event driven
 Hig...
Simone Bordet
sbordet@intalio.com
CometD Overview
Simone Bordet
sbordet@intalio.com
CometD Features
 CometD provides libraries
 Build your own solutions with the CometD l...
Simone Bordet
sbordet@intalio.com
CometD Performance
 CometD Load Test (using a real chat application)
 HTTP
 20k clien...
Simone Bordet
sbordet@intalio.com
CometD Performance
 CometD 3
 Roughly 25% to 100% better than CometD 2
 Depending on ...
Simone Bordet
sbordet@intalio.com
CometD Features
Simone Bordet
sbordet@intalio.com
CometD Features – JavaScript
require(['dojox/cometd', 'dojo/domReady!'],
function(cometd...
Simone Bordet
sbordet@intalio.com
CometD Features – JavaScript
 Easy to make Comet “Hello Worlds”
 Very difficult to mak...
Simone Bordet
sbordet@intalio.com
CometD Features – Server
 Spring Framework integration
 Confidentiality
 HTTPS and WS...
Simone Bordet
sbordet@intalio.com
CometD Features – Server
 Transport independence (both client and server)
 Application...
Simone Bordet
sbordet@intalio.com
CometD Cloud Features
Simone Bordet
sbordet@intalio.com
CometD Cloud Features
 The Cloud:
 Dynamic horizontal scaling under load
 Various deg...
Simone Bordet
sbordet@intalio.com
CometD Features – Clustering
 Oort
 CometD's scalability clustering solution
 Shards ...
Simone Bordet
sbordet@intalio.com
CometD Features – Clustering
Simone Bordet
sbordet@intalio.com
CometD Features – Oort
 Oort cluster messages auto re-broadcasting
 For example, chat ...
Simone Bordet
sbordet@intalio.com
CometD Features – Seti
 Seti
 Clustered peer-to-peer communication
 Oort performs bro...
Simone Bordet
sbordet@intalio.com
CometD Features – Seti
B
A C
Client A Client B Client C
Simone Bordet
sbordet@intalio.com
CometD Features – OortObjects
 Distributed OortObjects
 Distribution of object state a...
Simone Bordet
sbordet@intalio.com
CometD Features – OortObjects
A1, A2
B1
NodeA
C1A C2A
users
A1, A2
B1
NodeB
C1B
users
Simone Bordet
sbordet@intalio.com
CometD Features – OortServices
 Distributed OortServices
 Forwarding of service action...
Simone Bordet
sbordet@intalio.com
CometD Features – OortServices
NodeA
P1
game_service
forward(...)
NodeB
P2
game_service
...
Simone Bordet
sbordet@intalio.com
CometD Features – OortObjects
 OortObject and OortService allow sharding
 Geographical...
Simone Bordet
sbordet@intalio.com
Questions
&
Answers
Simone Bordet
sbordet@intalio.com
References
 CometD
 http://cometd.org
 http://docs.cometd.org
 Jetty
 http://eclips...
Upcoming SlideShare
Loading in …5
×

Cloud-Ready Web Messaging With CometD by S. Bordet

1,483 views

Published on

Slides by the speech of S. Bordet at Cloud Conference 2014

Published in: Internet
  • Be the first to comment

Cloud-Ready Web Messaging With CometD by S. Bordet

  1. 1. Simone Bordet sbordet@intalio.com Cloud-Ready Web Messagging with CometD CloudConf – Torino April 3rd, 2014
  2. 2. Simone Bordet sbordet@intalio.com Who Am I  Simone Bordet  sbordet@intalio.com  @simonebordet  Open Source Contributor  Jetty, CometD, MX4J, Foxtrot, LiveTribe, JBoss, Larex  Lead Architect at Intalio/Webtide  Jetty's SPDY, FastCGI and HTTP client maintainer  CometD project leader  Web messaging framework
  3. 3. Simone Bordet sbordet@intalio.com Agenda  What is CometD ?  CometD Use Cases  CometD Features  Questions & Answers
  4. 4. Simone Bordet sbordet@intalio.com What is CometD ?
  5. 5. Simone Bordet sbordet@intalio.com What is CometD  CometD is a web messaging framework  Implements a publish/subscribe pattern on the web  Web applications use a request/response paradigm  Because historically web applications run over HTTP  CometD uses a messaging paradigm  For example: 1 “request” message, 3 “response” messages  Server push – no “request”, 1-N “response” messages  Cloud-ready  Either stateless or easily clusterable
  6. 6. Simone Bordet sbordet@intalio.com CometD Use Cases
  7. 7. Simone Bordet sbordet@intalio.com CometD Use Cases  Social Networking  Chat and Notifications
  8. 8. Simone Bordet sbordet@intalio.com CometD Use Cases  Online Gaming  Not First Person Shooters – yet :)
  9. 9. Simone Bordet sbordet@intalio.com CometD Use Cases  Auctions & Trading  Updating bids, prices and availability
  10. 10. Simone Bordet sbordet@intalio.com CometD Use Cases  Systems Monitoring  Alerts and System Status
  11. 11. Simone Bordet sbordet@intalio.com CometD Use Cases  Online Collaboration/Productivity Tools
  12. 12. Simone Bordet sbordet@intalio.com Comet Web Applications  A new kind of web applications  Server-side event driven  Highly dynamic using AJAX / WebSocket on the client  Asynchronous and concurrent by definition  Big impacts on servers  Servers must support async I/O  Thread-per-request model does not scale  Servers must support WebSocket  With an easy fall-back to HTTP
  13. 13. Simone Bordet sbordet@intalio.com CometD Overview
  14. 14. Simone Bordet sbordet@intalio.com CometD Features  CometD provides libraries  Build your own solutions with the CometD libraries  No out of the box products  CometD JavaScript Libraries  CometD Java Libraries
  15. 15. Simone Bordet sbordet@intalio.com CometD Performance  CometD Load Test (using a real chat application)  HTTP  20k clients  50k messages/s  200 ms median latency  WebSocket  100k clients  50k messages/s  4 ms median latency
  16. 16. Simone Bordet sbordet@intalio.com CometD Performance  CometD 3  Roughly 25% to 100% better than CometD 2  Depending on the load  CometD 3 based on Servlet 3.1  Ships new HTTP transport based on Servlet 3.1 Async I/O  Jetty 9.1 implements Servlet 3.1  Implementation already very stable
  17. 17. Simone Bordet sbordet@intalio.com CometD Features
  18. 18. Simone Bordet sbordet@intalio.com CometD Features – JavaScript require(['dojox/cometd', 'dojo/domReady!'], function(cometd) { cometd.init('http://myserver/cometd'); cometd.subscribe('/my/channel', function(message) { var data = message.data; // Do something with the data }); cometd.publish('/my/channel', { chatText: 'hello!' }); cometd.disconnect(); });
  19. 19. Simone Bordet sbordet@intalio.com CometD Features – JavaScript  Easy to make Comet “Hello Worlds”  Very difficult to make it fail nicely in real scenarios – CometD does it  Network disconnection detection  Applications notified via function callback  Message batching  Sending multiple messages to server efficiently  Page reload extension  Reload a page in the browser without losing connectivity
  20. 20. Simone Bordet sbordet@intalio.com CometD Features – Server  Spring Framework integration  Confidentiality  HTTPS and WSS supported out of the box  Authentication  Controlled via SecurityPolicy  OAuth integration  Authorization  Coarse grained via SecurityPolicy  Fine grained via channel Authorizers
  21. 21. Simone Bordet sbordet@intalio.com CometD Features – Server  Transport independence (both client and server)  Applications do not hardcode to a specific transport  Lazy messages  Deliver non important messages on first occasion  Save I/O and CPU when it matters  Acknowledge Extension  Provides server-to-client ordering and acknowledgement of messages  Activity Extension  Disconnect idle clients after a period of inactivity
  22. 22. Simone Bordet sbordet@intalio.com CometD Cloud Features
  23. 23. Simone Bordet sbordet@intalio.com CometD Cloud Features  The Cloud:  Dynamic horizontal scaling under load  Various degrees of support for fail-over  Almost always requires application support  Applications have to be aware of multiple nodes  Data sharing / replication
  24. 24. Simone Bordet sbordet@intalio.com CometD Features – Clustering  Oort  CometD's scalability clustering solution  Shards clients among nodes  Not a high availability solution  On node failure clients reconnect automatically  But may have lost information  Oort cluster members autodiscovery  Multicast based  Static based on “well known” nodes  Existing nodes forward topology to new nodes
  25. 25. Simone Bordet sbordet@intalio.com CometD Features – Clustering
  26. 26. Simone Bordet sbordet@intalio.com CometD Features – Oort  Oort cluster messages auto re-broadcasting  For example, chat applications work out of the box  No code needed ! B A C Client A Client B Client C
  27. 27. Simone Bordet sbordet@intalio.com CometD Features – Seti  Seti  Clustered peer-to-peer communication  Oort performs broadcasting communication  Seti maps a user ID token to a session ID  Presence information is broadcasted on the cluster  Each Seti knows the location of all user IDs  Efficient peer-to-peer communication  Multiple session IDs for the same user ID  For example, connecting from desktop and mobile
  28. 28. Simone Bordet sbordet@intalio.com CometD Features – Seti B A C Client A Client B Client C
  29. 29. Simone Bordet sbordet@intalio.com CometD Features – OortObjects  Distributed OortObjects  Distribution of object state across nodes  OortObject<T>  A composite, uniquely named, object made of “parts”  Only one “part” is owned by the node, others are read-only  Trades more memory for smaller data access latency  Typical Examples  The number of users on each node  The list of chat rooms a friend has joined  The friends of a friend in a social application
  30. 30. Simone Bordet sbordet@intalio.com CometD Features – OortObjects A1, A2 B1 NodeA C1A C2A users A1, A2 B1 NodeB C1B users
  31. 31. Simone Bordet sbordet@intalio.com CometD Features – OortServices  Distributed OortServices  Forwarding of service actions across nodes  OortService<R, C>  One uniquely named service in each node  Forwards actions to owner node (possibly itself)  Trades less memory for higher data access latencies  Typical Examples  Precise counters (even unique-across-cluster)  Update actions (e.g. chess moves)
  32. 32. Simone Bordet sbordet@intalio.com CometD Features – OortServices NodeA P1 game_service forward(...) NodeB P2 game_service onForward(...) onForwardSucceeded(...)
  33. 33. Simone Bordet sbordet@intalio.com CometD Features – OortObjects  OortObject and OortService allow sharding  Geographical-based, load-based, business-based  Typical examples  US users vs EU users  Play games locally for better performance
  34. 34. Simone Bordet sbordet@intalio.com Questions & Answers
  35. 35. Simone Bordet sbordet@intalio.com References  CometD  http://cometd.org  http://docs.cometd.org  Jetty  http://eclipse.org/jetty  Intalio/Webtide  https://webtide.com

×