I am using nginx as reverse proxy with varnish in the background. I have LAMP fueling varnish. The problem I am seeing on Varnish server is that the connection from nginx is getting established everytime a request is served.
We are serving more than 300 req/second and we see something like:
netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
2 ESTABLISHED
1 FIN_WAIT1
7 LISTEN
1 SYN_RECV
43187 TIME_WAIT
This is ofcourse undesired. What would be best is that we setup a tunnel or a connection between nginx and varnish ones and all communication happen over that static connection. I am not quite sure how exactly this can be done or if there are better ways to do it.
What else can I do here?
Thanks
Nginx only supports HTTP/1.0 between itself and back-end servers, so no HTTP keep-alive by default :(
There are a lot of weird and wonderful third-party modules which may help, but so far I've only found keepalive support for memcache and redis, no HTTP