This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Too many CLOSE_WAIT s due to AJAX call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Too many CLOSE_WAIT s due to AJAX call" Watch "Too many CLOSE_WAIT s due to AJAX call" New topic
Author

Too many CLOSE_WAIT s due to AJAX call

Prakas Subed
Greenhorn

Joined: Dec 09, 2004
Posts: 20
I have simulated push behavior using AJAX calls from IE. Parts of web page get updated every second getting fresh content from the server using the request object displayed below. However, after a while (some time 5 minutes, sometimes 15 minutes or so later) the update stops happening. The IE icon spins relentlessly, but no content update.

One observation made is that with "netstat -an" on the client system, we can see may be hundred or more connections to server with TCP state "CLOSE_WAIT"

Any suggestions how to get the screen updated without interruption?

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Look into COMET.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Do you not think that banging on the server every second is a bit excessive? How many pages are doing this sumultaneously?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prakas Subed
Greenhorn

Joined: Dec 09, 2004
Posts: 20
To the user it's not excessive. They want to see near real time (minimum of 1 second) update of data on their browser. That's roughly 30KB data that need to be generated and shipped to the browser every second.

However, it's only one page whose final size is less than 32KB when shipped to the browser. Currently this 32Kb HTML replaces an innerHTML on a template html with logos etc already loaded. Users limited to a maximum of 5.

So much for AJAX's simulated push hype?!

With COMET's approach, seems that we will have to redo much of the way things are already done.


Originally posted by Bear Bibeault:
Do you not think that banging on the server every second is a bit excessive? How many pages are doing this sumultaneously?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Your server is going to come to a crashing halt when it has multiple users. You probably should look at FLEX which is better for real time data.

Eric
Prakas Subed
Greenhorn

Joined: Dec 09, 2004
Posts: 20
Server is handling fine. In less than 200ms its generating the content and sending out (per avg response time measurement of related servlet/jsp WAS). Browser (IE 6) seems to get confused with multiple AJAX calls made to the server.

The same code works fine on Firefox to update the content within the second without interruption; except there's a noticeable flicker on Firefox when the html rendered with the update.


Originally posted by Eric Pascarello:
Your server is going to come to a crashing halt when it has multiple users. You probably should look at FLEX which is better for real time data.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Too many CLOSE_WAIT s due to AJAX call
 
Similar Threads
Struts 1 & JQuery & Ajax
Question regarding AJAX article
AJAX part in jsp is not functioning with IE 6.0
AJAX Call timout: code: 12002
Internet Explorer XMLHTTPRequest problem