# Request\_time exstreamly larger than upstream\_response\_time for some queries when using fastcgi

**URL:** <https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668>\
**Category:** NGINX\
**Created:** [November 21, 2012, 6:03am UTC](https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668 "2012-11-21T06:03:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 21, 2012, 6:03am UTC](https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668/1 "2012-11-21T06:03:39Z")

</div>

Hi，  
I run python in backend, and use nginx to proxy queries to python by  
using  
fastcgi. I found some strange things in my nginx log those days. Some  
queries’  
$request\_time are up to 40 seconds which their $upstream\_response\_time  
are less  
than 1 second.

Here is my fastcgi related conf.  
fastcgi\_max\_temp\_file\_size 0;  
fastcgi\_param PATH\_INFO $fastcgi\_script\_name;  
fastcgi\_param SCRIPT\_NAME “”;  
fastcgi\_pass python\_backend;  
fastcgi\_buffers 1024 8K;

Do you guys know what’s the problem?

Chao

---

<div class="post-metadata">

**Author:** ![Tian\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@Tian\_C](https://www.ruby-forum.com/u/Tian_C)\
**Post date:** [November 22, 2012, 4:52am UTC](https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668/2 "2012-11-22T04:52:58Z")

</div>

Does anybody have a clue about this problem?

* * *

From: Tian C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, November 21, 2012 1:02 PM  
Subject: request\_time exstreamly larger than upstream\_response\_time for  
some queries when using fastcgi

Hi，  
I run python in backend, and use nginx to proxy queries to python by  
using  
fastcgi. I found some strange things in my nginx log those days. Some  
queries’  
$request\_time are up to 40 seconds which their $upstream\_response\_time  
are less  
than 1 second.

Here is my fastcgi related conf.  
fastcgi\_max\_temp\_file\_size 0;  
fastcgi\_param PATH\_INFO $fastcgi\_script\_name;  
fastcgi\_param SCRIPT\_NAME “”;  
fastcgi\_pass python\_backend;  
fastcgi\_buffers 1024 8K;

Do you guys know what’s the problem?

Chao

---

<div class="post-metadata">

**Author:** ![Tian\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@Tian\_C](https://www.ruby-forum.com/u/Tian_C)\
**Post date:** [November 22, 2012, 5:05am UTC](https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668/3 "2012-11-22T05:05:15Z")

</div>

> I found some strange things in my nginx log those days. Some queries’  
> $request\_time are up to 40 seconds which their $upstream\_response\_time are  
> less than 1 second.

$request\_time is time since start of the request (first bytes read from  
client) till end of the request (last bytes are sent to client and  
logging  
happens) - so while the backend can generate the response in 1 second  
there  
might be clients with slow connections or even not waiting for the  
response  
(closing it) etc.

rr

---

<div class="post-metadata">

**Author:** ![Tian\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@Tian\_C](https://www.ruby-forum.com/u/Tian_C)\
**Post date:** [November 22, 2012, 8:03am UTC](https://www.ruby-forum.com/t/request-time-exstreamly-larger-than-upstream-response-time-for-some-queries-when-using-fastcgi/224668/4 "2012-11-22T08:03:26Z")

</div>

Hi rr,

Thanks for your explain. Some queries’ body sent is just about 1K bytes,  
however the$request\_time is up to 40 seconds, so i think the connection  
is tooslow. Is there a way fordiagnosticwhat happened in that time for  
those slow queries?

Thanks,  
Chao

* * *

From: Reinis R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, November 22, 2012 12:04 PM  
Subject: Re: request\_time exstreamly larger than upstream\_response\_time  
for some queries when using fastcgi

> I found some strange things in my nginx log those days. Some queries’  
> $request\_time are up to 40 seconds which their $upstream\_response\_time are less  
> than 1 second.

$request\_time is time since start of the request (first bytes read from  
client) till end of the request (last bytes are sent to client and  
logging happens) - so while the backend can generate the response in 1  
second there might be clients with slow connections or even not waiting  
for the response (closing it) etc.

rr
