3

I'm not much of a system / network administrator. I'm searching for a way to properly determine the settings of my php-fpm.

So far I found this article explaining the details to calculate these settings based on the server specs (https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/):

pm.max_children
pm.start_servers
pm.min_spare_servers
pm.max_spare_servers

But there's a setting here pm.max_requests, so I'm wondering what value I should put here? How do I determine what value I should put there? Should I leave it at default 0?

Giacomo1968
  • 3,553
  • 29
  • 42

1 Answers1

3

The only possible answer here is that there is no exact answer to give.

It really depends. Performance settings are solely dependent on each use-case, specs, project structure, etc.


You should only set a value here if you have a reason to.

If you don't care how many requests each process can get before restarting, you should just leave it at the default setting.

The same can be said for most settings in all sorts of applications, not just PHP-FPM.


From the docs:

pm.max_requests

The number of requests each child process should execute before respawning. This can be useful to work around memory leaks in 3rd party libraries. For endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. Default value: 0.

So, ask yourself: Are you having an issue with memory leaks, hung connections, etc? If so, maybe this functionality would be useful to you. If not, maybe just leave it alone.

I'll summarize with an analogy: Just because you have a workshop full of tools, it does not mean you need every tool for every job. This setting only needs to be configured if there is a problem to solve.

Giacomo1968
  • 3,553
  • 29
  • 42
Rino Bino
  • 692
  • 13
  • 34