I have a server with no more that 40 websites on it. Many are Wordpress which is a high resource CMS.
I used to get alerts of the sites going down a lot. Look like MySQL crashing. It was a 8Gb server (on Linode). I decided to increase it to 16Gb thinking there are too many sites on it. It still crashes and all sites go down, multiple times a day.
As its only a web server, its likely one or some of the sites are just high usage sites.
But when I look at top or htop for the User causing all the 100% CPU and max RAM, its all mysql and apache.
The mysql and apache users must be running from an actual website which can be attributed to a User account, but I do not know how to link it back to that User. htop and top don't show the user that is running the apache or mysql process.
Does anyone know how I can view what User account is causing all the MySQL and apache processes, so I can determine if that user needs to go it own server for using high resources, then the rest of the sites should be fine.
Here are the lines from htop, but there are loads more than this for mysql and apache, this is just what I can see and copy from the visible part:
Thanks
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
16769 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16770 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.77 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16771 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:02.79 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16772 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:03.00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16795 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:33.53 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16796 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:42.89 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16797 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.32 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16798 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:11.65 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16799 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.46 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16992 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.56 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24061 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.56 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24120 mysql 20 0 9071M 2437M 4728 R 15.4 15.2 0:01.30 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24173 mysql 20 0 9071M 2437M 4728 S 7.4 15.2 0:00.48 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24179 mysql 20 0 9071M 2437M 4728 S 9.1 15.2 0:01.18 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24194 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.68 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24202 mysql 20 0 9071M 2437M 4728 S 5.7 15.2 0:00.47 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24364 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:04.28 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
24447 mysql 20 0 9071M 2437M 4728 S 0.0 15.2 0:00.73 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
16723 mysql 20 0 9071M 2437M 4728 S 38.2 15.2 3h33:12 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
22949 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22950 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.06 /usr/sbin/httpd.worker
22951 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.09 /usr/sbin/httpd.worker
22952 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22953 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.15 /usr/sbin/httpd.worker
22954 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22955 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22956 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22957 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.08 /usr/sbin/httpd.worker
22958 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.09 /usr/sbin/httpd.worker
22959 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.09 /usr/sbin/httpd.worker
22960 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22961 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22962 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22963 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.08 /usr/sbin/httpd.worker
22964 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.10 /usr/sbin/httpd.worker
22965 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.06 /usr/sbin/httpd.worker
22966 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22967 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22968 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.09 /usr/sbin/httpd.worker
22969 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
22970 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.06 /usr/sbin/httpd.worker
22971 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.09 /usr/sbin/httpd.worker
22972 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
22973 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:00.04 /usr/sbin/httpd.worker
22946 apache 20 0 2141M 62624 9384 S 0.0 0.4 0:02.16 /usr/sbin/httpd.worker
23094 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.10 /usr/sbin/httpd.worker
23095 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker
23096 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.05 /usr/sbin/httpd.worker
23097 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.10 /usr/sbin/httpd.worker
23098 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.06 /usr/sbin/httpd.worker
23099 apache 20 0 2141M 64236 9396 S 0.0 0.4 0:00.07 /usr/sbin/httpd.worker