Reputation: 195
Why does my mysql run this command and eat a lot of my cpu (55 - 120%) I have tried everything. Show process, and optimize all my query, Slow query log, increase buffered size.
Also I been killing this process over and over but it keeps on running. What does this command do? Why is my mysql eat a lot of my cpu in my server? I can't trace what was the cause of high cpu usage.
Command:
/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/srv1.myserver.com.err --pid-file=/var/lib/mysql/srv1.myserver.com.pid
Upvotes: 0
Views: 9007
Reputation: 988
There are multiple things which affect the Database performance. There is not a straight solution of this issue. Multiple factors including hardware and software are responsible for this. Below are few important points to consider:
Use some tool like Teamquest to check the system performance and observe the CPU usage with number of users. Find out the correct number of users in your system during a specific period of time. Use the below command for this
SELECT username, count(username) FROM session_table_of_application WHERE 1 GROUP BY username;
You would be able to find the maximum number of users when CPU usage become high.
You should also check the memory usage during that period. Teamquest would help you for this too. Run [MySQL Tuner][2]
to find the mismatch in your MySQL setup.
Run below command to check the global status:
select * from information_schema.GLOBAL_STATUS
Run below command to check the below important system variables:
show variables like 'innodb_buffer_pool_size';
show variables like 'innodb_flush_log_at_trx_commit';
show variables like 'innodb_open_files';
show variables like 'innodb_table_locks';
show variables like 'innodb_thread_concurrency';
show variables like 'join_buffer_size';
show variables like 'key_buffer_size';
show variables like 'max_connections';
show variables like 'max_delayed_threads';
show variables like 'max_heap_table_size';
show variables like 'max_tmp_tables';
show variables like 'thread_cache_size';
show variables like 'tmp_table_size';
show variables like 'wait_timeout';
show variables like 'myisam_sort_buffer_size';
It may be possible that there are some queries which is utilizing a lot of CPU resources. So, you have to check the list of queries running during this period. Run below command for this:
SELECT HOST,COMMAND,TIME,INFO FROM INFORMATION_SCHEMA.PROCESSLIST where command !='sleep' and time>10 and command !='Binlog Dump' order by TIME desc;
Analyze all your observations and then only you will find the cause of this issue. May be hardware are responsible or need to correct the MySQL system variables.
Upvotes: 5