Optimal MPM and PHP-FPM set up for many (4000+) concurrent users

Re: Optimal MPM and PHP-FPM set up for many (4000+) concurrent users

Tomoya Saito -
Number of replies: 0
Pikitia o Plugin developers
Construction of an all-in-on server for huge users is very difficult.
We have 6 web servers, and each server has 8 vCPU cores, and 64GB virtual memory.
We have other servers (DB server, cache server, and load balancer).
We spent over a year adjusting over a hundred parameters for our servers.
Our Moodle system can accommodate more than 3000 users, but not 6000 users.

If you employ Linux OS, you must set maximum number of concurrent open files, and maximum number of concurrent open sockets.
Web server (Apache, etc.) connect to users' browsers via sockets.
One connection uses at least one socket.
So, "net.core.somaxconn" kernel parameter must be set to the larger value than maximum concurrent users on your Moodle system (over 4000).
Additionally, web server's processes (or thread) connect to DB server (MySQL, etc.) via sockets (over 4000).
Sure, database server uses sockets (over 4000).
So that, the "net.core.somaxconn" must be larger than 12000.
Moreover, you should set other kernel parameters about backlog, network buffers, and TCP.
In order to improve the communication speed and reduce the packet loss, the network buffers must be set large.
However, large network buffers quickly consume server's memory.

I guess the maximum number of concurrent open files should be set to more than 100 times the maximum number of concurrent users.
So, this parameter may should be set to 400000 or more larger value.
Under this conditions, server's disk must have very high speed an very large IOPS.

By default, maximum connections of database server (MySQL, etc.) is 100-300.
So, you should increase maximum connection parameter of database server.
And, you should adjust other many parameters (global buffers, thread buffers, I/O parameters, etc.).
We have carefully adjusted over 50 parameters.
Increase of these buffers can improve performance of database server.
However, large buffuers consume server's memory.
On the other hand, you also have to reserve memory to store the Moodle database.
Therefore, parameter adjustments should be made carefully.

When the number of concurrent users reaches 4000, required network transmission speed will exceed 1 Gbps.
So, your server must have 10 Gbps network interface.

Finally, I do not recommend using an all-in-one server if the number of simultaneous users exceeds 1000.
The Moodle system has long-term connections with users' browsers and DB server.
As the number of connections increases, behavior of server OS becomes unstable.
Ngā whakawākanga toharite: Useful (4)