views:

56

answers:

2

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!

A: 

Can you point to evidence that it's apache? Unless your apache setup isn't optimal, most likely your page wait is something else, maybe you have set your ajax call to be non-async?

Hans
Thanks for the suggestion-I have no evidence that it's apache - other than I didn't know what else it would be.I using open('GET',url,true), so the call should be async
Ben Mason
+2  A: 

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).

Marc B
In most sane production systems, you'll probably be using another session handler, like memcached. But yes, it's a possibility.
Artefacto
That must be it - as far as I know, the sessions are file based. Sounds like a good time to try moving to memcached!Thanks!
Ben Mason