nginx/backend keepalive question

Yu Zhao yu.zhao at
Wed Apr 30 21:08:57 UTC 2014


I couldn't find my answer of following questions in the manual or somewhere
else. Your help is much appreciated!

1) does nginx manage frontend/nginx and nginx/backend connections
separately? In another word, will a nginx/backend connection be bond to a
certain frontend/nginx connection for the lifetime of the frontend/nginx
connection that is also kept-alive? My guess is it's not, nginx uses M:N
model which M is the number of frontend/nginx connections that may or may
not be kept-alive and N is the number of nginx/backend kept-alive
connections, and M connections share N connections.

2) If my guess is correct, how does nginx make sure the request/response
pair is not broken/mismatched? Nginx wil NOT send new request to a backend
until the response of the last one is received, right?

3) If I'm still on the right track: because nginx has to wait the response
from a backend connection, it cannot reuse it for next request. That's why
nginx still needs to open new connections to backend even there are
existing connections. But It will only do so when all the existing
connection are non-idle (i.e. responses from them haven't been fully

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list