Real-time Updates on Web Pages - WebLogic Server 10gR3 New Feature

I was excited to learn via the popular blog TechCrunch that FriendFeed announced a beta of "Real-time" updates for their html pages using long polling or server push.  This is showcased on a page highlighting the Presidential debate.  One of the quotes I like was from Robert Scoble who said “This is wild. It’s like the web has been turned into a chat room.”

Comet

Why is this relevant to WebLogic Server and enterprise customers?  Well, you can build sites like this using WebLogic completely with out of the box features that are also enterprise-ready.  WebLogic Server 10gR3 now includes an enterprise class HTTP Publish and Subscribe Server that implements the Bayeux protocol. This protocol provides the ability to apply the Ajax concept known as Comet. This means that simple web clients based only on html and javascript can be notified nearly instantly as events are observed by the server; no Applets, Flash, or Silverlight required.

The HTTP Publish and Subscribe Server takes advantage of the groundwork laid in previous releases with the Future Response Servlet and Abstract Asynchronous Servlet.  A stock tracking example ships with the server shows real-time updates to market data directly in the browser and on a chart.  Click the image to enlarge.  When you see this example in action, observe that the stock ticker properties and chart are truly "live" and are constantly changing with new market data updates.
stockExample

Consider how often this comes up in web applications.  I'd be shocked if you've never found yourself repeatedly hitting refresh on your browser to
    - check the status of an online auction
    - try and buy tickets to popular concert at a ticket broker that had a waiting room
    - see whether your stock trade went through
    - see if you have new web mail
    - see if new articles have been posted on a busy news site

Just like the manual refresh situations described above, many web applications have handled stale data checks by automatically refreshing the entire page.  MyYahoo and DrudgeReport are both extremely popular sites still perform a periodic complete refresh.  Ajax has helped improve this situation to some degree by providing a mechanism to only update a page partially without a complete page refresh, which can be faster and more efficient to the client, network, and server resources than request all the page resources again.  However, the AJAX technique often involved periodic server polling techniques, asking the basic question over and over again, "Anything new yet?".  The quicker the page needs display new updates, the more often the client still needs to check for them.  It should remind you of the long road trip cliche "Are we there yet?"

This can result in very inefficient behavior creating a lot of unnecessary network traffic and server load. Creative javascript and server-side developers started coming up with ways to push server events to clients using standard HTTP.   One of the members of the Dojo Toolkit javascript framework coined the term Comet, a play on the Ajax name, to describe the concept.  With the Bayeux protocol, they have found a way to mitigate some of the concerns polling to make it more efficient on the client and server.

In fact, many applications are now being built that take advantage of Comet techniques.  Take a chat application for example, Google Talk, YahooIM, and Meebo all have basic html and javascript clients that can participate in live chats.  In fact, previous versions of WebLogic Server included a chat example that applied this technique in a raw way.  See my previous post about it.

You can find the information about the stock example and run it with the samples domain.
<WEBLOGIC_INSTALLATION>\wlserver_10.3\samples\server\examples\src\examples\webapp\pubsub\stock

- Note, use IE or another non-FF browser as the sample application does work with latest version of Firefox, I tried FF 3.0.3. The reason is that the html client code uses an old version of the Dojo Toolkit (0.4) that no longer behaves nicely with FF3.  You can tell that this sample was actually built awhile ago in web time. Several new Dojo releases have come out since then, as of this post the latest is 1.1.1, but it's still useful for demonstrating the concept.

A sample application I created with Dojo 1.1.1 worked fine in both IE and Firefox.  I'll plan on writing about in a follow-up entry as there is enough to say to make this a series of posts.  Dojo and WebLogic together provide a very compelling solution, but there are other javascript frameworks out there like JQuery that are also providing client software for this and the WebLogic implementation is compatible with any Bayeux client.  More to come soon.

Comments:

Hey James, does WLS uses "continuation" style of releasing threads like Jetty or WL guys invented their own way on how to support 10 000 comet users?

Posted by artemv on October 06, 2010 at 06:13 AM PDT #

Julio, I believe it's fundamentally similar to Jetty continuations, but WLS leverages it's own implementation of something called the Abstract Asynchronous Servlet, which has an implementation called Future Response Servlet. See this documentation for some detail: http://download.oracle.com/docs/cd/E14571_01/web.1111/e13712/progservlet.htm#i179697 Thanks, James

Posted by james.bayer on October 06, 2010 at 06:43 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

James Bayer Image
I was formerly a Product Manager on the WebLogic Server team based out of Oracle HQ. You can find my new blog at http://iamjambay.com.
Follow Me on Twitter
Oracle WebLogic

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today