[200 OK]: A Port80 Software Blog

We're all 200 OK: Web, HTTP and IIS Insights
posts - 199, comments - 719, trackbacks - 95

What Not to Do with Ajax

With the continued interest in Ajax, Port80 received a new comment overnight that warrants a post of its own.

One of our blog readers referenced a post for an idea that another blog author dubbed "Continuous Ajax Requests":

http://www.plasser.net/blog/continuous_ajax_requests

After reading the post above, we'll just call this approach "How to Spends Lots of Money on Hardware without Even Trying".

The basic idea espoused is to get a browser to have a continuous connection open with a server using XmlHTTPRequest and then, every so often, time it out and then re-establish the connection.  This would allow you to have a full, synchronous connection and do chat and all sorts of fun stuff. 

There is problem, however: if you hold connections open on your Web server that are idle, you will severely limit the Web server’s ability to handle traffic and scale to meet load.  You may be able to somewhat mitigate this problem with some tuning to your TCP stack and Web server software. Ultimately, if you program this way, be prepared to purchase a great amount of servers to handle any sizable load.

Have a great weekend, and make sure to check out the new httpZip 3.5.6 for advanced IIS compression.

Cheers,
Port80

posted on Friday, October 14, 2005 11:54 AM

Feedback

# re: What Not to Do with Ajax

Any suggestion on how to efficiently achieve the same result (i.e. implementation of an Ajax "push" model for the live update of a page without constant polling) with a more scalable method?
1/4/2008 5:40 PM | Hillel

# re: What Not to Do with Ajax

Unfortunately, Hillel, there isn’t a simple answer here... there are various things like endless iframe, long slow poll, etc. that are different than save a fast constant poll, but fundamentally if you try to do something that is more connection-oriented over a connectionless protocol like HTTP it is going to awkward at best. You may instead create a socket connection, usually using a helper application like Flash or a Java applet, if you want that instant availability without the overhead. Chapter 10 in not-yet-released but coming soon Ajax Reference book by Thomas Powell will address this topic pretty fully -- but it is about a 10-20 page discussion! Check out http://ajaxref.com/ in the next few months for more there...
2/22/2008 11:48 AM | Chris @ Port80

# re: What Not to Do with Ajax

guangqiantiaoxian
3/20/2008 1:46 AM | 光纤跳线

# re: What Not to Do with Ajax

thanks nice text
4/7/2008 7:36 AM | software

Post Comment

Title:  
Name:  
Url:  
Comment:  
Verify:
(Enter the word as it appears in the box above.)