问题原文
原帖链接 · Ryan · CC BY-SA 3.0
The nginx docs say that keepalive for fastcgi cannot work if the fastcgi_keep_conn is not on. However, I can't find any further details on this. I already have keepalive enabled server-wide. I am using php-fpm. Are there any issues about using fastcgi_keep_conn that I should be aware of?
社区高分解答
原帖链接 · Tero Kilkanen · CC BY-SA 3.0
Theoretically fastcgi_keep_conn does increase performance, since the socket between nginx and PHP-FPM stays open after request has been processed. Therefore the time spent opening the socket is saved.
Overall, this would save some milliseconds on each request, so it has not such a big effect.
The documentation simply means that you need to have both an upstream block with keepalive option and fastcgi_keep_conn option in your PHP script block for the connection keepalive to work.
Basically, fastcgi_keep_conn option tells nginx to make PHP-FPM to keep the connection open after the request, and the keepalive connection tells nginx to keep the connection open.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
