当前位置:网站首页>A troubleshooting of website crash due to high CPU

A troubleshooting of website crash due to high CPU

2022-06-26 04:21:00 Scholar and

problem : The website has been circling and can't be accessed

screening :

1: Log in to alicloud to view the server status , According to the normal 【 Running 】
2: View Alibaba cloud servers 【 Monitoring information 】 Show cpu The usage rate is as high as 60%
3:Xshell Connect to server using 【top】 Command view cpu Usage display 【mysql Occupy cpu the height is 280%】
4: Use navicat Connect to the database using 【show full processlist;】 command , List all in progress sql sentence
6: Through analysis, it is found that there are a large number of slow statements with long execution time

Conclusion :

1:sql The statement execution is too slow and needs to be optimized
2: The size of the temporary table is too low and needs to be reallocated

Emergency treatment :

Use mysql【kill id;】 The command kills the executing thread

Final treatment :

1: Re optimize statements , Remove useless linked tables , Precise query conditions
2: Optimize database configuration etc/my.cnf【 There is no need to restart after modification 】
The size of the temporary watch :【tmp_table_size=200M】
Maximum upper limit of temporary table :【max_heap_table_size=200M】
join Join table query cache performance :【join_buffer_size=8M】

mysql Query result annotation :

Id: Connect mysql Server threads id, Can pass kill Kill the thread .

User: Database user connected to the current thread

Host: The user who executed the statement IP

db: Threaded database , If not, it is null

Command: Displays the command executed by the current connection , It's usually dormant or idle (sleep), Inquire about (query), Connect (connect)

Time: When the thread is in its current state , The unit is seconds

State: Shows the... Using the current connection sql The state of the statement

Info: thread-executed sql sentence ( For analysis and troubleshooting sql sentence ), If there is no statement execution null.

原网站

版权声明
本文为[Scholar and]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180533334080.html