Optimal MPM and PHP-FPM set up for many concurrent users


We are having trouble with our server and many concurrent users. We want to support at least 4000 concurrent users.

Our server has 32 cores and 192GB of RAM, which should be enough. We run MPM_event with PHP-FMP

PHP-FPM config:

pm = static

pm.max_children = 4800

MPM_Event conf:

<IfModule mpm_event_module>

 ServerLimit           100

  StartServers            16

  MinSpareThreads         50

  MaxSpareThreads        300

 ThreadsPerChild        50

ThreadLimit 64

  MaxClients            3000

  MaxRequestsPerChild  0

MaxConnectionsPerChild    8000


We tried to fine tune this settings but without success. After ~400 (not 4000) concurrent users the website slows down and become unresponsive. Any suggestion on how to improve? By looking at “top” on average an Apache process and PHP-FPM process are 40MB.

When the website become unresponsive only 30GB out of 192GB of RAM are used.

What other configuration might slow everything down?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @wullimanngregor,

So, the MPM_event in my opinion is the best in such cases. Having said that, I’ll recommend changing the FPM configuration from static to dynamic. In my opinion, it’s more flexible that way.

Now, the other configuration, the max_children is like spots for people to connect to. It’s quite important however there is another that’s important as well, max_requests. So let’s say max_children is spots to connect to, max_requests is the maximum requests one of the children can do and if they go above that, a new child process is taken. As such, increasing the max_requests is a possibility too.

As for the MPM config. You need to increase the Server Limit as well. It’s too low for such a traffic. What it does is it fills and doesn’t let anything else connect until one of the connections is closed.

Hope this helps!

Regards, KFSys