My site (which as running fine until yesterday - CPU was at 2%, memory at 50%) keeps maxing out the resources - CPU and Memory at 100% and "load" and Disc IO very high.
the site is a php (silverstripe) site running on Ubuntu linux with apache and mysql.
Looking at the memory:
ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -n
I get 150 entries for apache2 all with 40-90Mb. plus 475Mb for mysql and 331Mb for Java.
So it seems apache is starting too many processes and eating all the resources. Is that right?
If I restart apache, the site comes back up and works fine for an hour or so and then builds up lots of apache entries in ps and crashes.
how can i configure apache to not use up all the resources and avoid the website crashing? How can I find out what is causing the site resources to max out?
Update:
#/etc/apache2/mods-enabled# cat mpm_prefork.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 100
MaxConnectionsPerChild 0
</IfModule>
Phpinfo
https://gist.github.com/asecondwill/bd9640cae780fa87a3af05be335aa3fb
psis over estimating the memory consumption because in each individual apache2 process the RSS includes and counts all shared libraries that are typically loaded only once in memory. - By default most LAMP distributions default to using the prefork mpm and mod_php which does not offer the most performance when traffic increases. Switching to other MPM and PHP FPM offers improvement. – HBruijn Jun 05 '23 at 13:16cores, any SSD or NVME devices on MySQL Host server?
Post TEXT data on justpaste.it and share the links. From your SSH login root, Text results of: A) SELECT COUNT(*), sum(data_length), sum(index_length), sum(data_free) FROM information_schema.tables; B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; D) SHOW FULL PROCESSLIST; E) STATUS; not SHOW STATUS, just STATUS; G) SHOW ENGINE INNODB STATUS; for server workload tuning analysis to provide suggestions.
– Wilson Hauck Jun 05 '23 at 15:26