简体   繁体   English

nginx和php-fpm之间的连接是否为持久连接?

[英]Whether the connection between nginx and php-fpm is persistent connection?

I think the connection between nginx and php-pfm is persistent conncetion. 我认为nginx和php-pfm之间的连接是持久的。 After I read the php-fpm source code, I found that the connection will not be closed after php-fpm processed the request. 阅读php-fpm源代码后,我发现在php-fpm处理请求后,该连接将不会关闭。 Once the processed num arrvied the config num(php-fpm.ini can config) , the php-fpm will close the connection actively. 一旦处理后的数字到达配置数字(php-fpm.ini可以配置),php-fpm将主动关闭连接。 So I wonder to know whether my understanding is right? 所以我想知道我的理解是否正确?

The connection between nginx and php-fpm is not persistent but should have been when keepalive is enabled as described in https://serverfault.com/questions/739918/whats-the-relationship-between-an-nginx-worker-process-and-php-fpm by florin nginx和php-fpm之间的连接不是持久性的, 但应https://serverfault.com/questions/739918/whats-the-relationship-between-an-nginx-worker-process-中所述启用保持连接和php-fpm by florin

One could argue that if you enable fastcgi keepalive in nginx, php-fpm processes would remain there longer. 有人可能会争辩说,如果在nginx中启用fastcgi keepalive,则php-fpm进程将保留更长时间。 Considering that each worker process gets its own connection pool for upstreams that use keepalive, it could cause php-fpm to keep more processes running at all times for each worker process. 考虑到每个工作进程都为使用keepalive的上游获得了自己的连接池,这可能导致php-fpm始终为每个工作进程保持更多进程运行。 However, fastcgi keepalive is broken in php-fpm as far as I am aware so it shouldn't be a problem 然而,据我所知,fastcgi keepalive在php-fpm中已损坏,因此这不是问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM