WHIM_Presentation.Yu_Song

Download Report

Transcript WHIM_Presentation.Yu_Song

WHIM Presentation
Topic : Comet and Jetty 6
Yu Song [email protected]
April 17 2007
Before Introduction
• Usual Client ~ Server interaction
• When an Internet Application needs to
be updated, the only possible choice is
to use polling.
• Clients send requests over HTTP
protocol and Server sends back data
and then close the session.
Before Introduction contd.
• The HTTP protocol makes it impossible
to have the server "push" data to the
client. The faster the client needs to be
updated, the faster the poll must be. Of
course, there are limits, for example
due to the network speed, the load, etc.
• Web chat application was impractical
due to it’s huge amount of pollings.
Introduction
• What's COMET?
• Like Ajax, COMET, rather than a new
program or a protocol , is a concept or
implementation of a way to manage the
HTTP connection.
So, what’s new?
• Clients send HTTP requests.
• Server side doesn’t send back responses
right away.
• Server side keeps these connections.
• When the server was “kicked”, it sends
data back to all clients using the those
connections.
Comet vs. Ajax
• Ajax is a technology which separates
browser display and browser~server
interaction. (ex. Google Map)
• Comet is a technology separates clients
polling and browser~server interaction.
(ex. Gmail, GTalk, and Renkoo)
Comet vs. Ajax contd.
implementation
Figure from http://dylan.io/
Comet vs. Ajax contd.
• “Comet application fight lag by avoiding
HTTP and TCP/IP set-up and tear-down
and a single connection is re-used. But
the big kicker for AJAX is polling
latency which Comet avoids. The big
takeaway: transfer only the necessary
data, exactly when it’s most relevant.”
[cited] Comet: Beyond Ajax – by Dr. Phil Windley 2006
http://www.irishdev.com/NewsArticle.aspx?id=2173
Example Demo
• Lingr … Web-browser Chat System
• http://www.lingr.com/
• You can paste not just smiley but also
real pictures and even YouTube videos.
• http://www.columbia.edu/images/slidesho
w/cu_home_aerial_winter.jpg
• http://www.youtube.com/watch?v=6HPgxK
S5c4U
Demo Screenshot
Lingr
• Web server
(kicks Chat server)
• Chat server
• Jetty 6
(thread solution)
• JSONP
(cross-domain
Problem solution)
Lingr Contd.
•
•
•
•
•
•
•
•
Merits
Lightness … don’t need install
Chat room … real-time social network
Anonymous access … don’t need log-in
Image, Viedo support … jpg, YouTube
Chat log … can be used as database
Hot tag … can search chat room by tag
API … create your own Web-chat app
Issues with Comet
• Appache server allocates one thread to
each HTTP connection
• Server has to keep all these threads till
it returns response.
• Consuming server resources when idle.
• May crash server when there are lots of
clients even no HTTP interactions.
Solution
• Use Jetty 6 server.
• This new-mainstream-server supports
Continuations functionality.
• It manage thread separately from HTTP
connection.
Conclusion
•
•
•
•
Ajax will be used with Comet.
Comet will be used with Jetty 6
Jetty 6 will be used with JSONP
From now on more and more web
applications will take advantage of these
combinations of new technologies.
Thank you !