Showing posts with label max_allowed_packet. Show all posts
Showing posts with label max_allowed_packet. Show all posts

Saturday 17 November 2018

Mysql usage grater than 100% of CPU in ubuntu 18.04 | 16.04 in AWS

 You need to update server configuration.

1. Open terminal
2. Put command : sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf




3. Find following variables
key_buffer_size         = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
query_cache_limit      = 1M
query_cache_size        = 16M
Change To
key_buffer_size         = 160M
max_allowed_packet      = 160M
thread_stack            = 1920K
thread_cache_size       = 80
query_cache_limit       = 1024M
query_cache_size        = 2048M
4. Restart mysql : sudo /etc/init.d/mysql restart
5. Restart apache2 sudo systemctl restart apache2
6. Check CPU usage : ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
 For more Information please Refer : https://dev.mysql.com/doc/refman/5.7/en/server-configuration.html