Last time I posted Using server push in general. This post I focus on Java server-side implementation.

First We talk about AJAX Push. Ajax Push enables real-time collaborative features, because everyone can be instantly aware of each others actions. The underlying mechanism for Ajax Push is HTTP protocol inversion (also known as long polling). This technique involves holding a connection open from the browser client to the server with a blocking request, and then fulfilling that request when some state change in the application triggers an update to the presentation. For more, see here.

How do we use it at Java web server? basically the server needs to implement so called Asynchronous Request Processing. What happens in synchronous HTTP where the server is blocking on incoming and outgoing I/O is that you end up having a thread consumed per client connection. This eats up memory and valuable thread resources. Therefore, each server has their way to handle those problem.

1. Apache Tomcat 6 Comet Processor and JBoss 4.2.3
Asynchronous HTTP Request Processing

2. Sun Glassfish Grizzly Plugin
Grizzly part III: Asynchronous Request Processing (ARP)

Reference:
Asynchronous Ajax for Revolutionary Web Applications

Update: 2009-06-02
Developing with Comet and Java

Advertisements