my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes AJAX Hangs Apache Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX Hangs Apache" Watch "AJAX Hangs Apache" New topic

AJAX Hangs Apache

anand phulwani
Ranch Hand

Joined: Sep 10, 2005
Posts: 242
Dear Ranchers,

I am developing a Web Support chat application,for which i was inspired by Gmail messenger which is intregated in browser(AJAX Powered),the archietecure i am using is

For Visitor:IN A JSP FILE(AJAX)---------calls---------SERVLET
For Operator:APPLET----------calls----------SERVLET

The current issue which is giving me a problem is how should
i update the messages,and what i think is the retrieval process should run in a separate thread,but as i could not find any code on the net,

i switched to this process

The Problem with this code is this,because the server on which i am running is my own machine,after running this code on IE7,
APACHE TOMCAT exe(TOMCAT5.exe) CPU usage is shown to be 98%
and after 10-15 seconds the machine finally hangs.

Although the configuration is:
1)AMD 64 X2 3800+(dual core)
2)Asus A8N32-SLI-Deluxe
3)1 GB RAM

What Should I Do To Run The Code Normally,So That it does not hangs the Server,or can anyone suggest a way so that i can retrieve messages and send them without problem,as it happens in Gmail Browser Messenger.

[ November 26, 2006: Message edited by: anand phulwani ]

[ November 26, 2006: Message edited by: anand phulwani ]

[ November 26, 2006: Message edited by: anand phulwani ]
[ November 26, 2006: Message edited by: anand phulwani ]

Thanks and Regards, Anand
SCJP 5.0 310-055 73%, SCWCD 1.4 310-081 78%, IBM DB2 9 Fundamentals 000-730 62%
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
By the looks of what you have written the third parameter in your open is false? aka you are going synchronous request.

Synchronous requests freeze the browser until the call is returned. So the browser freezes at 10 seconds since that is when the call is made (setTimeout). Change your model to asynchronous mode and you probably will not see it freeze.

Download Firefox with Firebug and look at how you can watch the request with it:

Also your server is going to see a large increase in load (remember that google has BIG SERVERS that can handle the traffic.) You will be pinging your server a minimum of 6 times a minute. Increase the number of people using it and you will have a lot of traffic.

Other things you might want to look into in the COMET model or just building an applet for the users.

I agree. Here's the link:
subject: AJAX Hangs Apache
It's not a secret anymore!