On Thu, Aug 11, 2011 at 09:19:41PM +0300, about bus wrote: > Hello! > > I have a simple my own libevent-based http server written on C, use evhttp.h > functions. > I use it like backend with nginx server (about ~2K requests per second). > Sometimes in nginx error log appears error: "(60: Operation timed out) while > reading response header from upstream" > Timeout value is 75 seconds in nginx config file, but my http server does > not need so long time to handle one request. > Average request time is about 0.01 second (information from nginx access > log). > > I've used tcpdump to figure out what's going wrong. > There is a network activity on timeouted requests: > > nginx -> syn > httpserver > httpserver -> syn-ack > nginx > nginx -> ack > httpserver > nginx -> GET /query/xxx/yyy > httpserver > httpserver -> ack > nginx > ... > 75 seconds left (timeout) > ... > nginx -> fin > httpserver > httpserver -> ack > nginx > > Only after this time (75 seconds) libevent calls my http_handler callback. > Message about new http request appears in http server log file. > After less than one second http server ready to send response back to nginx. > But 75 seconds were lost I don't know where, and connection where closed. > > So, how I can figure out why libevent holds request for 75 seconds? > Why libevent gives request for handling only when nginx tries to close > connection to my http server? > > Thanks!
Can you post the source? If not you can try ltrace/strace'ing your server or enable event debugging by recompiling libevent with -DUSE_DEBUG *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.