+1 vote
in Operating Systems by (63.4k points)
What is the best process manager (pm) for PHP-FPM settings? Should I use static or dynamic?

1 Answer

+2 votes
by (358k points)
selected by
 
Best answer

Dynamic mode is ideal for websites that do not get a constant amount of traffic throughout the day, with traffic spikes occurring only during certain hours. The chances of resource wastage are low, as processes are started and terminated as needed, making better use of system resources under varying workloads. However, starting new processes during high traffic spikes can introduce latency.

Static mode is best for websites that get constant traffic throughout the day. It is also ideal for high-traffic, dedicated servers where resource availability is predictable. However, there is a higher chance of resource wastage during periods of low traffic. Static mode has no overhead for dynamically starting or stopping processes, which can improve performance in high-load environments.

Depending on your website's traffic patterns, you can set pm = static or pm = dynamic. Static mode is easier to manage as you only need to set pm.max_children. On the other hand, dynamic mode requires tuning parameters such as pm.start_servers, pm.min_spare_servers, and pm.max_spare_servers to avoid bottlenecks or resource wastage.

My recommendation: If your server has more than 4GB of RAM and your website gets a decent amount of traffic (not very high), you can set pm = static and pm.max_children = 8. Once your traffic starts increasing, you can increase the value of pm.max_children. If you have less than 4GB of RAM, set pm=dynamic.


...