Search code examples
phphttpapache2xmlhttprequest

Why does apache not process multiple requests from the same browser simultaneously


I'm not quite sure how to phrase this question correctly, so I'll start with the scenario I encountered.

I have a bit of processing in my web app that takes longer than I'd like the user to wait to have control of the page again, so I decided to have it processed by an ajax request.

The problem is, even though I offloaded this request into an ajax request, it seems that apache won't process any further requests until the original processor heavy request is complete.

I originally wanted to know how I could get around this issue, but have since decided that it might be a bad idea in general.

However, I'm still curious if anyone knows why apache behaves this way, and what (if any) configuration directive controls it. My original thought was KeepAlive, but disabling that didn't seem to change the behavior.

I am running php through mod_php if that makes a difference.

I appreciate any help getting pointed in the right direction!


Solution

  • Are you using file-based sessions? PHP will lock session files for each request and maintain that lock until you do a session_write_close() or the script terminates/exits. The side effect of this is that all requests become serial, since they're all contending for the same single resource (the session file).