You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Toomas Aas <to...@raad.tartu.ee> on 2009/11/21 20:37:53 UTC

[users@httpd] Request concurrency issue

Hello!

I run Apache 2.2.11 with prefork MPM on FreeBSD 6.4. This is a pretty standard 
installation done from FreeBSD ports. It has a behaviour that makes me 
curious.

Say, I open a browser and enter request for 
http://mysite.com/LargeTextFile.txt

The file begins to load in the browser window.

While the file is loading, I open another browser tab and enter the same 
request there.
The file in second tab doesn't begin to load until it has completed loading in 
the first tab.

So - if the same client requests the same resource from the server multiple 
times, the requests are not handled in parallel, but sequentially.

If the same client requests different resources, the requests are handled in 
parallel, i.e. I can load LargeTextFile.txt and LargeTextFile2.txt 
simultaneously.

There is no problem with available child processes, if I look the output of 
server-status I see multiple idle child processes waiting for requests.

The reason why I'm investigating this is that we have a web app written in 
JavaScript/PHP which sends multiple concurrent requests from browser to 
server, and developers are worried that this kind of behaviour slows down the 
application. I've been told that this kind of behaviour isn't observed on 
other servers but only on this particular server set up by me. The only other 
web server I currently have access to is Apache 2.2.13 running on FreeBSD 7.2 
(also set up by me) and it seems to behave the same. So maybe the problem is 
me ;)

In addition to simply loading .txt files I've also tried with .php scripts, 
and the results are identical. So I guess the problem is not specific to a 
handler but is more generic.

What do I have to do to achieve the wanted behaviour (concurrent handling of 
identical requests from the same client)?

--
Toomas Aas


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Request concurrency issue

Posted by Nicholas Sherlock <n....@gmail.com>.
Nicholas Sherlock wrote:
> Toomas Aas wrote:
>> Say, I open a browser and enter request for 
>> http://mysite.com/LargeTextFile.txt
>>
>> The file begins to load in the browser window.
>>
>> While the file is loading, I open another browser tab and enter the 
>> same request there.
>> The file in second tab doesn't begin to load until it has completed 
>> loading in the first tab.
> 
> This is what I'd expect if your server was sending directives to your 
> browser which indicated that it could just download the file once and 
> display it from its local cache for the second tab - i.e. there is no 
> point in downloading it twice. What headers are you sending? Check with 
> something like the "Live HTTP Headers" plugin for Firefox.

And the trivial workaround is to have your client add some random number 
on to the query string:

http://mysite.com/LargeTextFile.txt?a=123890127
http://mysite.com/LargeTextFile.txt?a=189471401

This also prevents some misguided cache from caching the result.

Cheers,
Nicholas Sherlock


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Request concurrency issue

Posted by Nicholas Sherlock <n....@gmail.com>.
Toomas Aas wrote:
> Say, I open a browser and enter request for 
> http://mysite.com/LargeTextFile.txt
> 
> The file begins to load in the browser window.
> 
> While the file is loading, I open another browser tab and enter the same 
> request there.
> The file in second tab doesn't begin to load until it has completed loading in 
> the first tab.

This is what I'd expect if your server was sending directives to your 
browser which indicated that it could just download the file once and 
display it from its local cache for the second tab - i.e. there is no 
point in downloading it twice. What headers are you sending? Check with 
something like the "Live HTTP Headers" plugin for Firefox.

Cheers,
Nicholas Sherlock


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Request concurrency issue

Posted by Toomas Aas <to...@raad.tartu.ee>.
On Sunday November 22 2009 02:23:09 André Warnier wrote:

> Are you absolutely sure that it is not just a behaviour from the browser ?
> For example, if you open two separate command windows, and start in each
> a "wget" for the same file (or curl, or lwp-request), do you observe the
> same behaviour ?

No, I don't. So this does indeed seem to be a client side issue. But 
interesting thing is that our developers tell me this doesn't happen with 
other servers. 

--
Toomas


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Request concurrency issue

Posted by André Warnier <aw...@ice-sa.com>.
Toomas Aas wrote:
> Hello!
> 
> I run Apache 2.2.11 with prefork MPM on FreeBSD 6.4. This is a pretty standard 
> installation done from FreeBSD ports. It has a behaviour that makes me 
> curious.
> 
> Say, I open a browser and enter request for 
> http://mysite.com/LargeTextFile.txt
> 
> The file begins to load in the browser window.
> 
> While the file is loading, I open another browser tab and enter the same 
> request there.
> The file in second tab doesn't begin to load until it has completed loading in 
> the first tab.
> 
> So - if the same client requests the same resource from the server multiple 
> times, the requests are not handled in parallel, but sequentially.
> 
> If the same client requests different resources, the requests are handled in 
> parallel, i.e. I can load LargeTextFile.txt and LargeTextFile2.txt 
> simultaneously.
> 
> There is no problem with available child processes, if I look the output of 
> server-status I see multiple idle child processes waiting for requests.
> 
> The reason why I'm investigating this is that we have a web app written in 
> JavaScript/PHP which sends multiple concurrent requests from browser to 
> server, and developers are worried that this kind of behaviour slows down the 
> application. I've been told that this kind of behaviour isn't observed on 
> other servers but only on this particular server set up by me. The only other 
> web server I currently have access to is Apache 2.2.13 running on FreeBSD 7.2 
> (also set up by me) and it seems to behave the same. So maybe the problem is 
> me ;)
> 
> In addition to simply loading .txt files I've also tried with .php scripts, 
> and the results are identical. So I guess the problem is not specific to a 
> handler but is more generic.
> 
> What do I have to do to achieve the wanted behaviour (concurrent handling of 
> identical requests from the same client)?
> 
Are you absolutely sure that it is not just a behaviour from the browser ?
For example, if you open two separate command windows, and start in each 
a "wget" for the same file (or curl, or lwp-request), do you observe the 
same behaviour ?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org