You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John McGowan <jo...@lynch2.com> on 2008/09/20 16:33:28 UTC

[users@httpd] Slow (Delayed) CGI request

I've got several apache servers that have been running for quite some time.
We don't normally use CGI in production, but I have a reason to use it now.
So, I've placed the CGI program, setup the config, and the CGI works.
However, every request to *any* of the executable CGI programs that I have
all have about a 10s delay before executing.  Seems to be some sort of
network timeout or bad DNS going on in the background, but I just can't find
anything wrong with the config.

It's not a matter of the scripts themselves being slow... a simple
helloworld perl script takes the same 10s as the captcha image generator
that need to get working.

What's strange is that I have this problem across all of my servers...  some
are FC3, 4, some are CentOS 5, Some are apache 2, and some are apache 2.2

The only thing i could think of was Host Name Lookups, or some misspelling
in "Allow from all"  I've cleared those.  In fact, I sent my conf files to a
friend, and he got them up and running on his server, and didn't have the
same problem.

Can anybody think of some reason why this 10s delay would occur when hitting
these simple CGI scripts?  I'm pretty sure the delay is outside of apache,
due to the varied configurations it's happening on, but I'm stuck.

-- 
John

Re: [users@httpd] Slow (Delayed) CGI request

Posted by André Warnier <aw...@ice-sa.com>.
John McGowan wrote:
> On Sun, Sep 21, 2008 at 12:32 PM, André Warnier <aw...@ice-sa.com> wrote:
>> John McGowan wrote:
>> [...]
>> If you get a command window on the server where the Apache server runs, and
>> issue a "nslookup ..." with the IP address of your workstation, what happens
>> ?
>>
>> Then, *if* you get a delay, what does the file /etc/resolv.conf contain ?
>>
>> (As a matter of fact, when you connect to the server via SSH, does it also
>> take some time before you get the first prompt ?)
>> Just checking..
> 
> I wish it did...  I've seen issues like that in the past and knew how
> to solve them.
> 
> This problem, while similar in appearance, doesn't seem to be DNS
> related.  I didn't see any unexpected DNS queries when looking at the
> tcpdump...
> 
> I've just gotten a different server on the network, that wasn't part
> of the cluster of apache servers, to execute the cgi scripts quickly.
> that server uses the same DNS infrastructure as the other servers.
> 
> I'm at a total loss here...
> 
> I know i'm not giving much to go on here... I was just hoping that
> there was some common mistake i was making.
> 
Let's try to be logical here.
It's not DNS-related.
It happens on all the servers of that cluster, but not on a server 
outside the cluster.
Don't remember if you said that before, but is it a *new* issue ? new in 
the sense that you already had cgi-bin programs before, and they were 
fast, and now suddenly they are slow ?
Or did you not have cgi programs on those servers before, and is this 
your first try ?

By the look of the above, it must be some element common to the servers 
of the cluster.  If it is not DNS...
- is it some common network directory on which this (these) cgi-bins are 
located ?
- do the servers all share the majority of their httpd.conf settings ?
if yes, can you post one such httpd.conf ?
- apart from "Allow from..", do those servers all share some common 
authentication scheme, maybe "inherited" without your knowledge by the 
cgi-bin directory ?
- are the scripts you are testing all perl ?
- if yes, do you use mod_perl ?

running out of questions for now.



---------------------------------------------------------------------
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] Slow (Delayed) CGI request

Posted by John McGowan <jo...@lynch2.com>.
On Sun, Sep 21, 2008 at 12:32 PM, André Warnier <aw...@ice-sa.com> wrote:
> John McGowan wrote:
> [...]
> If you get a command window on the server where the Apache server runs, and
> issue a "nslookup ..." with the IP address of your workstation, what happens
> ?
>
> Then, *if* you get a delay, what does the file /etc/resolv.conf contain ?
>
> (As a matter of fact, when you connect to the server via SSH, does it also
> take some time before you get the first prompt ?)
> Just checking..

I wish it did...  I've seen issues like that in the past and knew how
to solve them.

This problem, while similar in appearance, doesn't seem to be DNS
related.  I didn't see any unexpected DNS queries when looking at the
tcpdump...

I've just gotten a different server on the network, that wasn't part
of the cluster of apache servers, to execute the cgi scripts quickly.
that server uses the same DNS infrastructure as the other servers.

I'm at a total loss here...

I know i'm not giving much to go on here... I was just hoping that
there was some common mistake i was making.

-- 
/John

---------------------------------------------------------------------
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] Slow (Delayed) CGI request

Posted by André Warnier <aw...@ice-sa.com>.
John McGowan wrote:
[...]
If you get a command window on the server where the Apache server runs, 
and issue a "nslookup ..." with the IP address of your workstation, what 
happens ?

Then, *if* you get a delay, what does the file /etc/resolv.conf contain ?

(As a matter of fact, when you connect to the server via SSH, does it 
also take some time before you get the first prompt ?)
Just checking..

---------------------------------------------------------------------
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] Slow (Delayed) CGI request

Posted by John McGowan <jo...@lynch2.com>.
On Sat, Sep 20, 2008 at 10:33 AM, Matt <ma...@gmail.com> wrote:
>
>
> On Sat, Sep 20, 2008 at 3:33 PM, John McGowan <jo...@lynch2.com> wrote:
>>
>> I've got several apache servers that have been running for quite some time.  We don't
>
> What an ace problem. I dont know the answer, but here are some questions. Have you used telnet over ssh while logged on locally on each servers to make sure its not with something common to the setups, which would mean that even locally it would take 10seconds. Im assuming a GET verb is used. Was your hello world perl script just that, or did it have a db connection are have part of the captcha generator code in common.
> Do you use perl elsewhere on the servers other than the cgi-bin with no issues. how big is your path? Have you tcpdumped the request, Im assuming TTFB is the problem, that would tell you what the server was doing. Are using a proxy, or a firewall to hide these servers?
>

I used telnet to get to the local ip, from a server on port 80 and
issued the get request myself... still got a 10 second delay.

The hello world script was extremely simple. basically just echoing a
content type header and a string.

No problem with Perl, in fact the hello world script and the captcha
cgi that i'm trying to get to work quickly, both run immediately from
the command line.  The captcha program isn't perl at all, it's a
binary executable written in C.

--
John McGowan

Lynch2
792 West Bartlett Road
Bartlett, Illinois 60103

www.lynch2.com
w:847-608-6900 Ext 110

---------------------------------------------------------------------
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] Slow (Delayed) CGI request

Posted by John McGowan <jo...@lynch2.com>.
On Sat, Sep 20, 2008 at 10:35 AM, Matt <ma...@gmail.com> wrote:

> On Sat, Sep 20, 2008 at 4:33 PM, Matt <ma...@gmail.com> wrote:
>
>>
>>
>> On Sat, Sep 20, 2008 at 3:33 PM, John McGowan <jo...@lynch2.com> wrote:
>>
>>> I've got several apache servers that have been running for quite some
>>> time.  We don't normally use CGI in production, but I have a reason to use
>>> it now.  So, I've placed the CGI program, setup the config, and the CGI
>>> works.  However, every request to *any* of the executable CGI programs that
>>> I have all have about a 10s delay before executing.  Seems to be some sort
>>> of network timeout or bad DNS going on in the background, but I just can't
>>> find anything wrong with the config.
>>>
>>> It's not a matter of the scripts themselves being slow... a simple
>>> helloworld perl script takes the same 10s as the captcha image generator
>>> that need to get working.
>>>
>>> What's strange is that I have this problem across all of my servers...
>>> some are FC3, 4, some are CentOS 5, Some are apache 2, and some are apache
>>> 2.2
>>>
>>> The only thing i could think of was Host Name Lookups, or some
>>> misspelling in "Allow from all"  I've cleared those.  In fact, I sent my
>>> conf files to a friend, and he got them up and running on his server, and
>>> didn't have the same problem.
>>>
>>> Can anybody think of some reason why this 10s delay would occur when
>>> hitting these simple CGI scripts?  I'm pretty sure the delay is outside of
>>> apache, due to the varied configurations it's happening on, but I'm stuck.
>>>
>>> --
>>> John
>>>
>>>
>>>
>>
>> What an ace problem. I dont know the answer, but here are some questions.
>> Have you used telnet over ssh while logged on locally on each servers to
>> make sure its not with something common to the setups, which would mean that
>> even locally it would take 10seconds. Im assuming a GET verb is used. Was
>> your hello world perl script just that, or did it have a db connection are
>> have part of the captcha generator code in common.
>> Do you use perl elsewhere on the servers other than the cgi-bin with no
>> issues. how big is your path? Have you tcpdumped the request, Im assuming
>> TTFB is the problem, that would tell you what the server was doing. Are
>> using a proxy, or a firewall to hide these servers?
>>
>>
>>
>
> oh yeah and how did you clear the host name lookups as an issue? again
> tcpdump would tell you.
>

I'm not 100% sure, because I'm not an expert in using tcpdump, but I did a
quick 15 second dump and reproduced the problem.  I used wireshark to look
at the data.  I can see my 10s conversation with the webserver, but I don't
see any other conversations that are around the same size that don't have an
explanation.


-- 
John McGowan

Lynch2
792 West Bartlett Road
Bartlett, Illinois 60103

www.lynch2.com
w:847-608-6900 Ext 110

Re: [users@httpd] Slow (Delayed) CGI request

Posted by Matt <ma...@gmail.com>.
On Sat, Sep 20, 2008 at 4:33 PM, Matt <ma...@gmail.com> wrote:

>
>
> On Sat, Sep 20, 2008 at 3:33 PM, John McGowan <jo...@lynch2.com> wrote:
>
>> I've got several apache servers that have been running for quite some
>> time.  We don't normally use CGI in production, but I have a reason to use
>> it now.  So, I've placed the CGI program, setup the config, and the CGI
>> works.  However, every request to *any* of the executable CGI programs that
>> I have all have about a 10s delay before executing.  Seems to be some sort
>> of network timeout or bad DNS going on in the background, but I just can't
>> find anything wrong with the config.
>>
>> It's not a matter of the scripts themselves being slow... a simple
>> helloworld perl script takes the same 10s as the captcha image generator
>> that need to get working.
>>
>> What's strange is that I have this problem across all of my servers...
>> some are FC3, 4, some are CentOS 5, Some are apache 2, and some are apache
>> 2.2
>>
>> The only thing i could think of was Host Name Lookups, or some misspelling
>> in "Allow from all"  I've cleared those.  In fact, I sent my conf files to a
>> friend, and he got them up and running on his server, and didn't have the
>> same problem.
>>
>> Can anybody think of some reason why this 10s delay would occur when
>> hitting these simple CGI scripts?  I'm pretty sure the delay is outside of
>> apache, due to the varied configurations it's happening on, but I'm stuck.
>>
>> --
>> John
>>
>>
>>
>
> What an ace problem. I dont know the answer, but here are some questions.
> Have you used telnet over ssh while logged on locally on each servers to
> make sure its not with something common to the setups, which would mean that
> even locally it would take 10seconds. Im assuming a GET verb is used. Was
> your hello world perl script just that, or did it have a db connection are
> have part of the captcha generator code in common.
> Do you use perl elsewhere on the servers other than the cgi-bin with no
> issues. how big is your path? Have you tcpdumped the request, Im assuming
> TTFB is the problem, that would tell you what the server was doing. Are
> using a proxy, or a firewall to hide these servers?
>
>
>

oh yeah and how did you clear the host name lookups as an issue? again
tcpdump would tell you.

Re: [users@httpd] Slow (Delayed) CGI request

Posted by Matt <ma...@gmail.com>.
On Sat, Sep 20, 2008 at 3:33 PM, John McGowan <jo...@lynch2.com> wrote:

> I've got several apache servers that have been running for quite some
> time.  We don't normally use CGI in production, but I have a reason to use
> it now.  So, I've placed the CGI program, setup the config, and the CGI
> works.  However, every request to *any* of the executable CGI programs that
> I have all have about a 10s delay before executing.  Seems to be some sort
> of network timeout or bad DNS going on in the background, but I just can't
> find anything wrong with the config.
>
> It's not a matter of the scripts themselves being slow... a simple
> helloworld perl script takes the same 10s as the captcha image generator
> that need to get working.
>
> What's strange is that I have this problem across all of my servers...
> some are FC3, 4, some are CentOS 5, Some are apache 2, and some are apache
> 2.2
>
> The only thing i could think of was Host Name Lookups, or some misspelling
> in "Allow from all"  I've cleared those.  In fact, I sent my conf files to a
> friend, and he got them up and running on his server, and didn't have the
> same problem.
>
> Can anybody think of some reason why this 10s delay would occur when
> hitting these simple CGI scripts?  I'm pretty sure the delay is outside of
> apache, due to the varied configurations it's happening on, but I'm stuck.
>
> --
> John
>
>
>

What an ace problem. I dont know the answer, but here are some questions.
Have you used telnet over ssh while logged on locally on each servers to
make sure its not with something common to the setups, which would mean that
even locally it would take 10seconds. Im assuming a GET verb is used. Was
your hello world perl script just that, or did it have a db connection are
have part of the captcha generator code in common.
Do you use perl elsewhere on the servers other than the cgi-bin with no
issues. how big is your path? Have you tcpdumped the request, Im assuming
TTFB is the problem, that would tell you what the server was doing. Are
using a proxy, or a firewall to hide these servers?

Re: [users@httpd] Slow (Delayed) CGI request

Posted by John McGowan <jo...@lynch2.com>.
On Sat, Sep 20, 2008 at 12:52 PM, Nick Kew <ni...@webthing.com> wrote:

> On Sat, 20 Sep 2008 09:33:28 -0500
> "John McGowan" <jo...@lynch2.com> wrote:
>
>
> > Can anybody think of some reason why this 10s delay would occur when
> > hitting these simple CGI scripts?
>
> Does your keepalive timeout affect them?


I changed the keep alive setting, and saw no difference in the amount of
time it took to call any of the CGI scripts.

If so, your scripts are violating the CGI spec, and that's a symptom.
> Worth checking.
>
> --
> Nick Kew
>
> Application Development with Apache - the Apache Modules Book
> http://www.apachetutor.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
>
>


-- 
John McGowan

Lynch2
792 West Bartlett Road
Bartlett, Illinois 60103

www.lynch2.com
w:847-608-6900 Ext 110

Re: [users@httpd] Slow (Delayed) CGI request

Posted by Nick Kew <ni...@webthing.com>.
On Sat, 20 Sep 2008 09:33:28 -0500
"John McGowan" <jo...@lynch2.com> wrote:


> Can anybody think of some reason why this 10s delay would occur when
> hitting these simple CGI scripts?

Does your keepalive timeout affect them?

If so, your scripts are violating the CGI spec, and that's a symptom.
Worth checking.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.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