[Mysql] from experience high CPU utilization problems occupancy

Since warning appears on some time ago Zabbix, reported Escalators process pressure, increased Escalators parameters, such as changes to 80-90 just do not alarm, I felt wrong.

To the device, I found that mysql top 95% of the CPU are eaten

On mysql to show processlist;

We found a large sleep process, show status like 'Thread%'; see the connection number only 138.

Modify the my.cnf file, max_connections will be reduced to 300,

We found no improvement, Baidu to read and write timeout time may be no global optimization problems

Modify the my.cnf mysql configuration:

Add in the [mysqld]

wait_timeout=120

interactive_timeout=120

Restart mysql, CPU occupancy rate is really decreased, currently occupies about 15%.

The same high CPU may be due to other causes, the next person to share some of the following rule of thumb:

* 1, excessive alarm is not restored, it will also cause this problem needs to be emptied zabbix the following table in order to reduce CPU usage mysql, and this approach a temporary solution, the need for timely dispose of alarm.

Alerts;problem;problemtag;events;eventrecovery;escalations。

2, the alarm will trigger a set of multiple single, mysql can effectively reduce the occupation of the CPU, there is a reasonable set alarm triggers, regular cleaning zabbix alarm table.

3. Check occupy high CPU SQL, top -H -p <mysql process id>, then use the table to locate the problem inside the sql mysql:

SELECTa.THREADOSID,b.user,b.host,b.db,b.command,b.time,b.state,http://b.info

FROMperformanceschema.threads a,informationschema.processlist b

WHEREb.id = a.processlistid;

From here you can analyze which of sql taking up more CPU, so do the next step optimization. *

Guess you like

Origin blog.51cto.com/14483703/2427403