Off-board Comet: When separate web-servers handle normal connections and Comet connections.
On-board Comet: When the web-server that serves your normal content also handles your Comet connections.
What difference does it make?
More than you might think. While there are some fuzzy parts to these differences, it affects your architecture.
- Favors a more disconnected bus-like architecture
- Works well with a multi-language system
- Libraries can offer scaling more easily
- Easier to get started
- Easier management of state shared with normal content
- Development platform can be more unified
What libraries help me do on-board and off-board?
Cometd, Lightstreamer, Caplin Liberator and Orbited are examples of off-board systems. DWR and web-servers with built-in Comet like Jetty, Grizzy and Tomcat are examples of on-board systems, although web-server based options could be used in an off-board way too.
For our Comet talk at JavaOne we had a Twitter clone implemented with DWR. We were able to add Comet updates in 2 lines of configuration and under 50 lines of source code. To have done the same using Cometd would have taken much more effort. On the other hand if, like Facebook, we’d wanted to use Erlang to overcome threading problems, DWR would have been a non-starter.
How do I choose?
Some indicators that you need off-board Comet:
- You are looking for Facebook or Google levels of scalability.
- You are using PHP or another language that doesn’t play particularly well with Comet.
- You have a large existing system, and your use-case for Comet is fairly separate from your main business.
Some indicators that you might need on-board Comet:
- Your Comet needs are tightly integrated with your main business.
- You are looking to get started with some simple use-cases.
- You want Comet features without significant server changes.
If you would like some help or advice with Comet then it’s worth asking SitePen as we provide professional Comet support from investigating an architecture, to developing a solution.
The JavaOne talk
I’ve uploaded the slides that Alex Russell and I used at JavaOne to SlideShare.
You don’t get to see the demo on these slides, but if you want you can try it out yourself. BlabberOne is a Twitter clone which demonstrates (amongst other things) how easy it can be with on-board Comet to add asynchronous updates. The source code is available from DWR’s SVN repository.