You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Digvijoy Chatterjee <di...@gmail.com> on 2009/08/01 20:34:25 UTC

Re: [users@httpd] apache problems with number of cgi requests

Ok so mod_status helped me make an interesting observation :

There is only one child picking up the request for sleep.cgi when i
launch it new in new tabs/ new windows, rest are children all waiting,
and picking the next requests when this one gets done .

Srv	PID	Acc	M	CPU 	SS	Req	Conn	Child	Slot	Client	VHost	Request
0-0	20815	0/0/0	W 	0.00	0	684599440	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /server-status HTTP/1.1
1-0	20816	0/0/0	W 	0.00	36	684635474	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1

However clicking that one link on the page again and again launches up
new processes with no restraint. here below ( same link clicked again
and again )
and the same child pid is responsible for launching up new instances
of sleep.cgi ( 20815, 20816 )

0-0	20815	0/0/0	W 	0.00	7	684077228	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1
0-0	20815	0/0/0	W 	0.00	6	684076661	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1
0-0	20815	0/0/0	W 	0.00	5	684076206	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1
1-0	20816	1/1/1	W 	0.00	7	0	0.1	0.00	0.00 	127.0.0.1	127.0.1.1	GET
/cgi-bin/sleep.cgi HTTP/1.1
1-0	20816	0/0/0	W 	0.00	6	684076898	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1
1-0	20816	0/0/0	W 	0.00	6	684076442	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /cgi-bin/sleep.cgi HTTP/1.1
1-0	20816	0/0/0	W 	0.00	0	684070224	0.0	0.00	0.00
	127.0.0.1	127.0.1.1	GET /server-status HTTP/1.1

The apache conf , I have attached here.


Let me know , what else could help

Thanks
Digz

On Wed, Jul 29, 2009 at 8:52 AM, Chandranshu .<ch...@gmail.com> wrote:
> Hi Digz
>
> Meanwhile, when you say that "apache will not service any other CGI
> requests", what exactly do you mean? Did you mean that your further HTTP
> requests returned with 503 or some other error code? Or do they just wait
> around for a long time before returning any data?
>
> You should enable mod_status with "ExtendedStatus On" and check whether your
> requests are taken up for processing by the httpd server. Please send the
> output generated by mod_status along with the apache config if your problem
> remains unsolved.
>
> Best of Luck
> Chandranshu
>
> On Wed, Jul 29, 2009 at 5:41 PM, Digvijoy Chatterjee <di...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> We are running apache 2.0.35 on RHEL4 running in prefork mode.
>> Its a standard apache configuration for running cgi scripts. I can
>> send it if required
>>
>> The behaviour we are observing with apache is after servicing 2 cgi
>> requests which (do a long database lookup ~5 minutes)
>> apache will not service any other cgi requests until one of the above come
>> back.
>>
>> I have tried using RLimitNPROC, RlimitCPU , and RLimitMEM and even set
>> them to max,
>> but it does not affect the behavior.
>>
>> apache runs as www.
>>
>> Any clues ?
>>
>> --Digz
>>
>> ---------------------------------------------------------------------
>> 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] apache problems with number of cgi requests

Posted by André Warnier <aw...@ice-sa.com>.
Digvijoy Chatterjee wrote:
> So there are two scripts I am using as a test firefox 3.0.8 , launch
> test.cgi and you can see it provides a link to another cgi script
> which sleeps for 60 seconds.
> I launch this link again and again in a new tab/window , but any given
> time only one process has been started by apache on the host.
> 
And what happens when you do this from 2 *different* workstations at the 
same time, or, on the same workstation, with 2 entirely different 
browsers (I mean 1 x Firefox and 1 x IE for instance) ?

The point is :
A browser may open one single connection to the server, and use that 
same connection to send several requests.  That is what is called 
"keepalive" connections.  On the server side, this results in this one 
connection being handed over to one single Apache "child", and this 
single child keeps the connection open and processes all requests on 
that connection, one after the other.
No matter how many windows or tabs you open in the same browser, it 
*may* still be using only that one connection, for all its windows or tabs.
But two different browsers (or the same browser on two different 
workstations) will not share one connection.

Since you are anyway using perl for your cgi scripts, why don't you 
create a simple perl script, using the LWP module, to make the requests 
to Apache ? You could then run several instances of this script in 
different console windows at the same time, and check the results.

Attached is such a script, but I don't know if it will make it to the 
list. If not, ask and I will send it to you privately.

There also exist lots of other possibilities, such as creating a small 
shell script which calls wget or curl repeatedly, and run that script in 
several consoles.
You can also, I believe, use the "ab" program which comes with Apache.
See here : http://httpd.apache.org/docs/2.2/programs/


Re: [users@httpd] apache problems with number of cgi requests

Posted by Digvijoy Chatterjee <di...@gmail.com>.
So there are two scripts I am using as a test firefox 3.0.8 , launch
test.cgi and you can see it provides a link to another cgi script
which sleeps for 60 seconds.
I launch this link again and again in a new tab/window , but any given
time only one process has been started by apache on the host.

Here are the two scripts

==test.cgi==
#!/usr/bin/perl
use CGI;
print "Content-Type: text/html\n\n";
print "<a href=/cgi-bin/sleep.cgi>sleep for 60 sec</a>";

==sleep.cgi ==
#!/usr/bin/perl
print("Content-Type: text/plain\n\n");
sleep(60);
print("slept for 60 seconds");

Thanks
Digz



On Sat, Aug 1, 2009 at 5:44 PM, André Warnier<aw...@ice-sa.com> wrote:
> Digvijoy Chatterjee wrote:
>>
>> I already  tried that and it does not help .
>
> Ok then.
>
> What you report is of course not the way it should work.
> If Apache was always working that way, then half the hundreds of thousands
> of Apache servers on this planet woould be on their knees, including mine.
> And they are not.
>
> So it must have to do either with something in your configuration, or with
> the way you run your test.
>
> Let's start with the test :  how do you run it ? what is issuing the
> requests to Apache ?
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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] apache problems with number of cgi requests

Posted by André Warnier <aw...@ice-sa.com>.
Digvijoy Chatterjee wrote:
> I already  tried that and it does not help .

Ok then.

What you report is of course not the way it should work.
If Apache was always working that way, then half the hundreds of 
thousands of Apache servers on this planet woould be on their knees, 
including mine.
And they are not.

So it must have to do either with something in your configuration, or 
with the way you run your test.

Let's start with the test :  how do you run it ? what is issuing the 
requests to Apache ?

---------------------------------------------------------------------
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] apache problems with number of cgi requests

Posted by Digvijoy Chatterjee <di...@gmail.com>.
I already  tried that and it does not help .

On Sat, Aug 1, 2009 at 4:34 PM, André Warnier<aw...@ice-sa.com> wrote:
> Digvijoy Chatterjee wrote:
>>
>> Ok so mod_status helped me make an interesting observation :
>>
>> There is only one child picking up the request for sleep.cgi when i
>> launch it new in new tabs/ new windows, rest are children all waiting,
>> and picking the next requests when this one gets done .
>
> I will repeat :
> Try setting
>
> KeepAlive off
>
> and re-run your test.
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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] apache problems with number of cgi requests

Posted by André Warnier <aw...@ice-sa.com>.
Digvijoy Chatterjee wrote:
> Ok so mod_status helped me make an interesting observation :
> 
> There is only one child picking up the request for sleep.cgi when i
> launch it new in new tabs/ new windows, rest are children all waiting,
> and picking the next requests when this one gets done .

I will repeat :
Try setting

KeepAlive off

and re-run your test.

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