Accelerating AJAX

If you've ever used the quite popular Prototype framework, you've noticed that there are some unique options available that are designed to help reduce the number of connections made to the server when automatically updating specific content. The decay rate in Prototype's PeriodicalUpdater is designed to help reduce the number of requests made to the server when content is not refreshing on every request.

        Ajax.PeriodicalUpdater("content-id", "url", { frequency: 10, decay: 2, method: 'get'} )

This code will start making a call to url and updating content-id every 10 seconds. If the content hasn't changed, decay will be used to increase the update interval, essentially doubling the time between calls until the content has changed, at which time the interval is reset to its original value and the process begins again.

I point this out because it's an attempt to ameliorate the problems inherent with making continuous requests for content including the additional burden on the server of maintaining a connection. Maintaining the connection requires the maintenance of a session on the server, which consumes resources and may impact the total capacity of that server.

One would think that by increasing the interval when content is not changing would decrease the burden on the server, but that's not entirely true. At some point the interval between requests becomes high enough that a new connection will be necessary and the burden changes from maintaining a session to opening/closing a TCP/IP connection and creating a new session on the server.

Basically, the solution is a good effort, but it still places a burden on the server. Combining this partial solution with an application delivery network that combines connection optimization and web application acceleration technology such as dynamic caching will complete the solution. The web application acceleration solution alleviates the burden on the server when the content hasn't changed, thus making Prototype's solution even more efficient, and is smart enough to know when to revalidate the content it's caching.

The connection optimization features of the application delivery controller ensure that the server isn't overwhelmed at any time by excessive requests, even if the content is changing every second and requires processing on the server, by mediating client requests and managing the connections to the server.

Not using Prototype but still want to get the benefits of dynamically updating intervals? An application delivery controller can help you there, too, if it's smart enough to be a platform on which you can programmatically manipulate content in requests and responses. This post explains how to use iRules and a BIG-IP to dynamically adjust the AJAX update interval for requests.

Imbibing: Coffee

Published May 20, 2008
Version 1.0

Was this article helpful?

No CommentsBe the first to comment