New Technology, New Problems: Delayed Push Operations

by Jean-Francois ArcandApril 1st, 2008

Web applications using Comet (a.k.a. Ajax Push) are growing in popularity. Although there is a growing number of articles on Comet, the current literature mostly focuses on how to build a JavaScript client, how a web application can be developed using a particular web server, or why you should use Comet, etc. Little has been said so far on the new problems that push operations might introduce. Problems unfortunately do exist, and might not be discovered until very late in the development cycle. In this article, I would like to discuss one issue I’ve frequently seen over the last year, which is what I call Delayed Push Operations (DPO). But before that, let’s just refresh our mind with some basic things.

Polling, Long Polling and HTTP Streaming

The most popular technique used with Ajax currently is called polling. With polling, an Ajax application will poll the server for data every time the content of the page requires an update. Most of the responses the server returns will not contain any data (blank response).


The second technique, considered the emerging technique, is called long polling (a.k.a. Comet), where you open a persistent connection and wait for the server to execute the push operation. In contrast with the polling technique, the server never sends a blank response, and instead waits until data is available to initiate a push operation.

Long Polling

Finally, the third technique is called HTTP streaming. HTTP streaming is similar to the long polling technique except the connection is rarely closed, even after the server executes push operations. With HTTP streaming, an Ajax application will only send a single request and receive chunked (partial) responses as they come, re-using the same connection for a really long time.


Simple enough. Now with long polling and HTTP streaming, many problems might happen when the server executes its push operations. The one that happens frequently is what I call Delayed Push Operations, or DPO.

What is Delayed Push Operations (DPO)?

Before explaining delayed push operations, let me describe what a push operation is. A push operation is the phase when a server-side component decides to send message(s) back to the client using a long polling or HTTP streaming connection. The server component decides, most of the time, to execute the push operation based on some application-specific logic. As an example, the server-side component of a stock quote application will execute push operations every time new quotes are available, and a server-side component of a chat application will execute push operations as soon as a new chat message becomes available. The server component maintains a pool of long polling/HTTP streaming connections, and as soon as an event occurs, it starts push operations by updating the connection pool with the new data.

Delayed push operations happens when the client is not getting updated as fast as it should be or expects to be. As an example, a stock quote application that starts getting updates every 5 seconds instead of every 1 second will suffer the delayed push operations problem. Of course, the application still works, but the promise of real time data that Comet offers is severely impacted, and more importantly, the perception that the application provides real time data is severely reduced. Worse, most of the time the problems will be discovered very late in the development cycle, and having to re-architect the server-side component to fix the delayed push operations problem might impact the application architecture, its delivery schedule and again, perception of Comet as a real time technology.

When Does DPO happen?

Delayed push operations are measurable when the following symptoms start appearing:

  1. Server congestion: The OS/server/application is running out of resources. This problem arises most of the time when there are too many simultaneous connections open on a single server.
  2. Client congestion: The clients aren’t reading messages fast enough and the server is blocked while waiting for clients to read the messages. If the server uses a single threaded strategy for executing its push operations, one client might delay other clients as the server is waiting for that one client to read its messages.
  3. Data congestion: The server is not able to write messages fast enough, so messages accumulate and push operations are delayed.

The problem of delayed operations is better understood for applications that use the polling technique instead of long polling or HTTP streaming. Server and client congestion solutions are widely defined and used, and multiple solutions exist, like using load balancers, clusters of servers, etc. With the polling technique, you rarely suffer data congestion directly, but rather as a consequence of server/client congestion. Hence as soon as you fix your server/client congestion, your data congestion usually goes away.

Unfortunately, that’s not the case with the long polling and HTTP streaming techniques. With those techniques, a small number of client connections might easily produce data congestion that produces delayed push operations. How? In a Comet application, all long polling connections to the server might eventually share information amongst each other. To put it differently, all long polling connections might be virtually connected to each other. When one client sends data, the server will respond and then start its push operations, updating all the long polling connections virtually connected to each other. In comparison, with the polling technique, the server just needs to send a response back, with no extra operation.

So far so good. Now if all clients decide to respond to the first server push, the server will ends up having to initiate push operations for every client’s response. The server will work on executing its first push operations and the amount of operations it will have to execute will grow as soon as a single message is pushed. There might not be any data congestion for a relatively small amount of clients, but every new client added will increase the probability of creating data congestion. For a small load the problem might never show up, but increasing the number of virtually connected connections will eventually produce data congestion.

Want to see how this can happen? Just take a look at the JMaki Grizzly Comet demo or the Jetty Cometd demo. Those applications are quite cool to demo. Now just open more and more browsers and see how bad the situation can become. Just start moving things and see how other browser are updated….now find 50 of your friends and ask them to move things simultaneously…boom!!


There is no simple solution to avoid data congestion and reduce the probability of delayed push operations. There are several ways to reduce the probability of creating data congestion:

  • Aggregate messages: Instead of executing a server push operation every time new data is available, aggregate messages and execute a single push operation containing multiple messages.
  • Filter messages: Some messages might not need to be delivered under load and can be dropped.
  • Delay messages: Some messages might not need to be delivered in real time, so delaying them can reduce the probability of producing delayed push operations.


When writing Comet-based applications, it is important to reduce the probability of delayed push operations. Since Comet is a new technology and optimal solutions for reducing delayed push operations still need to be explored, aggregating, filtering, or delaying push operations might significantly improve the usability of your application under load.

[Slashdot] [Digg] [Reddit] [] [Facebook] [Technorati] [Google] [StumbleUpon]

7 Responses to “New Technology, New Problems: Delayed Push Operations”

  1. Lawrence Oluyede Says:

    Good article! It is nice to read about the problems Comet brings.

  2. Andrew Abner Says:


    I appreciate your input on potential problems that may arise. Are you aware of open-source APIs that implement the solutions you have supplied. It would be great to not have to re-invent the wheel here.

    Also, APIs that are compatible and/or tested with the Glassfish server would be optimal :)

  3. Steven Roussey Says:

    Wouldn’t you send the data (push) asynchronously? I’ve always aggregated messages to the clock for syncing purposes, but it is good to know that their are other benefits…

  4. Steven Roussey Says:

    “that there are”… such bad gramer…

  5. The Hitchhiker’s Guide to the CometSamplesInGlassFishv3 « 655321 Says:

    [...] Moving Game: Simple Word games using JMaki and hidden iframe (Nice DPO [...]

  6. Writing a Twitter like application using Grizzly Comet part 1: The Servlet « 655321 Says:

    [...] on a suspended connection. When pushing event to a group, it is always important to make sure the push operations is not a bottleneck. Grizzly Comet ships with such mechanism, significantly improving performance of your asynchronous [...]

  7. Atmosphere 0.1-ALPHA2 released with support for any WebServer (WebSphere,WLS, etc.), and Servlet 3.0 Async « 655321 Says:

    [...] Using a thread pool when broadcasting messages can save your life and greatly improve scalability of your application! [...]

Leave a Reply

Copyright 2014 Comet Daily, LLC. All Rights Reserved