I have a 8 core, 32gb dedicated moodle server.
Moodle never utilize more than 8gb of the memory, even in high load (400 users). Idled at 7GB, so the load only adds 1 more gb.
Resulting random disconnection and very slow performance in some users.
I use apache with php-fpm.
this setting reduce the problem, but i'm not sure.
KeepAlive Off
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 512
MaxRequestsPerChild 3000
ServerLimit 512
</IfModule>
the problem lessened after i restart apache though.
after some time, a number of students started to experience slowness.
In moodle i selected 4096mb in "Extra PHP memory limit", no options higher.