views:

169

answers:

3

Hello all.

On my laptop I have an app that makes 7 AJAX GET requests to a single PHP script at about the same time (millisecond difference). They all return successfully with the result I want.

Then I moved this script to a server (Windows Server) running Apache and PHP. However, this process hangs when I make the same 7 AJAX requests. However, if I make each request individually then they all come back successful! Something doesn't want me to do all 7.

Why is this happening? What configuration variables in the PHP.ini and httpd.conf can I look for to determine what this is?

Thanks

+1  A: 

The server may have a throttler in place to keep excessive requests from coming in too quickly.

Jonathan Sampson
+1  A: 

Maybe your Apache configuration limits the number of concurrent connections from the same IP, or even Windows. What version of Windows is it? What kind of Apache installation, Standalone or as a part of XAMPP?

Pekka
Laptop = Windows XP and the other machine = Windows Server 2003. Could it be because of the "KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection." - or is this slightly different?
Abs
Laptop = WAMP and other Machine = Standalone (apache and PHP). PHP used as a module.
Abs
Sounds good, try fiddling with that. This would lead to the 7 connections being processed one after another, and not concurrently.
Pekka
+4  A: 

I think the problem might be on the browser-side.

Most browsers have a 2 concurrent connections limit when talking to the same server.

When you moved your application to the server, the extra latency might have overlapped your AJAX requests, which on localhost were being served in quick succession.

You may want to check out these related articles:

Daniel Vassallo
Interesting, I wasn't aware of that. +1
Pekka
Very interesting, I wasn't aware of this either!
Abs
It is also written in the HTTP spec, section 8.14 last paragraph: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
Daniel Vassallo