[英]Limit PHP-FPM to one execution on a time
I would like to limit PHP-FPM
to execute only once at a given time, which means any further request will be queued.我想限制PHP-FPM
在给定时间只执行一次,这意味着任何进一步的请求都将排队。
I'm using nginx
but I think it's a matter of PHP-FPM
configuration.我正在使用nginx
但我认为这是PHP-FPM
配置的问题。
I read about PHP-FPM
listen.backlog
and process.max
, it looked for me that process.max is what I need to tune but I wasn't sure..我阅读了有关PHP-FPM
listen.backlog
和process.max
的信息,它让我认为 process.max 是我需要调整的,但我不确定..
What is the right way to achieve this?实现这一目标的正确方法是什么?
You're right.你是对的。 Just set these parameters:只需设置这些参数:
pm = static
pm.max_children = 1
But maybe you need a locking mechanism?但也许你需要一个锁定机制? In this case you can try using some of this:在这种情况下,您可以尝试使用其中的一些:
https://www.php.net/manual/en/function.sem-acquire.php https://www.php.net/manual/en/function.sem-acquire.php
https://symfony.com/doc/current/lock.html https://symfony.com/doc/current/lock.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.