Solved Server Load Issue

hmaddy

Verified User
Joined
Apr 17, 2019
Messages
292
Server consumes 100% load. most of them are mysql.

so how to find the root cause and fix the issue.
 

Attachments

  • Screenshot_42.jpg
    Screenshot_42.jpg
    320.3 KB · Views: 190
Use MySQLTuner to check your MySQL/MariaDB database configuration. It will give you suggestions on what changes you need to make to your /etc/my.cnf

Make a backup of your my.cnf before you make any changes.

 
You are using n unsupported version for production environments
Upgrade as soon as possible to a supported version !

Variables to adjust:
skip-name-resolve=1
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
table_definition_cache(400) > 7828 or -1 (autosizing if supported)
performance_schema=ON
key_buffer_size (~ 26M)
innodb_buffer_pool_size (>= 2.1G) if possible.
innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
 
You will need to add/change the config lines (/etc/my.cnf) to something like this:

Code:
skip-name-resolve=1
tmp_table_size=20M
max_heap_table_size=20M
table_definition_cache=8000
performance_schema=ON
key_buffer_size=26M
innodb_buffer_pool_size=2200M
innodb_log_file_size=16M

Remember make backup of /etc/my.cnf before making changes in case of typos. I find the sometimes depending on the version (older ones) of MySQL/MariaDB you need to specify the size in MB not GB, newer versions seem fine with either, just specified in MB just in case. It's good to run the tool periodically, as more data is added to the database(s) settings need to be tuned to make sure performance is maintained.

This should help.

If your running a bunch of WordPress sites, make sure they are using caching, maybe something like 'W3 Total Cache'... Will help so that every page hit doesn't case a bunch of database activity.
 
You may use the following to watch what SQL statement(s) are running...

cd /usr/local/directadmin/conf/
watch -n 1 "uptime; echo 'show full processlist;' | mysql --defaults-file=my.cnf "
 
Back
Top