This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61092
    
  66

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
 
 
subject: Too many CLOSE_WAIT s due to AJAX call