简体   繁体   中英

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.

I'm using nginx but I think it's a matter of PHP-FPM configuration.

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..

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://symfony.com/doc/current/lock.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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