Question

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

Posted September 17, 2021 123 views
ApachePHP

Hello!

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

</IfModule>

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?

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.

×
Submit an Answer
1 answer

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 maxchildren is like spots for people to connect to. It’s quite important however there is another that’s important as well, maxrequests. So let’s say maxchildren is spots to connect to, maxrequests 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