An AJAX mistake
Posted in Ajax, Programming, Web 2.0 by sandaruwan on October 22nd, 2006Yesterday (Saturday) I was running the IOI grader on university of moratuwa for their ACM selection tests. As far as the grader functionality is concerned, it worked perfectly. But unfortunately the grader interface was damn slow. There were only 26 contestants and it was on a 100 Mbps LAN. So, I had to restart the server time by time. So, I just looked at the log files and found out there was a huge number of requests. But why is that? Because our grader is using AJAX to grab the latest status. The AJAX script was generating a request for each 2-3 seconds. To make the things worst, those were keep-alive requests. So, not only that the server was using the maximum number of threads, the script keeps sending the requests to the same connection so the connection doesn’t break until it meets the maximum number of keep alive requests. When several guys are sending requests others have to wait in the queue. I simply changed the refresh time of the AJAX script and the number of maximum threads on the apache server. After that restarting the apache server solved the problem, more or less.

