31
RIAs with Comet and Critical Updates in Enterprise Environments Emil Ong Chief Evangelist Caucho Technology [email protected]

RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

RIAs with Comet and Critical Updates in

Enterprise Environments

Emil OngChief Evangelist

Caucho [email protected]

Page 2: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

What are critical updates?

Updates sent from the server to the client Time-sensitive updates Sources include

− Updates from a service external to the server− Updates from users− Updates from users and the server− Updates from internal network sources

Page 3: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Applications with Critical Updates:Financial

Updates from external service

Page 4: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Applications with Critical Updates:Chat

Updates from other users

Page 5: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Applications with Critical Updates:Games

Updates from other users and server

Page 6: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Applications with Critical Updates:Network administration

Updates from internal network sources

Page 7: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Approaches to Critical Updates:Polling

Polling− Client periodically checks with server for new

updates using RPC or web services− Poll too little: May get updates too late, may get

event “clumping”− Poll too much: May use server resources

unnecessarily when there are no new updates− Too much or too little depends on the events –

the client has no way of knowing!

Page 8: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Problems with Polling

Page 9: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Approaches to Critical Updates:Comet

Comet (a.k.a server-push, reverse Ajax)− Client makes initial registration request− Server sends updates to client− Updates get to client as they happen− Requires persistent connection

Page 10: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Comet in action

Page 11: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Developer-focused Comet

Comet is a new way of thinking for many application developers

− Resin Comet makes the transition easier with an evolutionary API based on Java Servlets

With a traditional server, you may get excessive threads or have to manage thread pool manually

− Resin Comet handles the thread management for you

Page 12: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Resin's Comet API and Infrastructure

Similar to Java Servlet API Resource management is automatic:

− Threads are pooled in the background− Developers can worry about client state instead of

threads Two main API classes:

− CometServlet – handles communication with client− CometController – encapsulates per-client state

Page 13: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Basic Comet Architecture

Page 14: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Event Generator:Implementation Examples

JMS messages SEDA pipeline

− Mule Network monitors

− SNMP− Firewall

Web services− SOAP

Page 15: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Basic Comet Architecture

Page 16: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometServlet

CometServlet – client communication Explicit code separation between initial and

subsequent communication− Handle the initial connection

service(ServletRequest,ServletResponse, CometController)

− Send updates to the client resume(ServletRequest,ServletResponse, CometController)

Page 17: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometServlet

Evolutionary API approach:− Uses Servlet as a foundation− Standard Servlet idioms still apply− Matching Filter API (adds doResume())

Idea of continuing communication built into API− Have formalized resume() rather than simply

holding open the client stream

Page 18: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Basic Comet Architecture

Page 19: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController

CometController - manages per-client state− State maintenance

getAttribute(String) setAttribute(String, Object)

− Send updates wake()

Page 20: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController

New concurrency primitive Essentially creates a blocking queue to the

client Think: java.util.concurrent Gives a handle to the client directly to the

service Client can be a “stage” in a SEDA

Page 21: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController offers Flexibility

Allows complex interactions with clients− Broadcast− Unicast− Subscription-based

Page 22: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController Flexibility:Broadcast

Chat room

Page 23: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController Flexibility:Unicast

Instant messaging

Page 24: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

CometController Flexibility:Subscription-based

News Stocks

Page 25: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Demo

Page 26: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Demo Architecture

Page 27: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Demo Architecture (cont.)

Page 28: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Conclusion

Comet approaches are becoming necessary for certain classes of applications

Resin's Comet API and infrastructure:− Are familiar to Java Servlet developers− Offer a concurrency primitive that is based on client

connections− Remove the need to worry about threads at

development time

Page 29: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Where to find Resin

http://www.caucho.com/

Page 30: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Questions?

Page 31: RIAs with Comet and Critical Updates in Enterprise Environments - … · 2013-03-30 · −Mule Network monitors −SNMP −Firewall Web services −SOAP. Basic Comet Architecture

Thank you!