How to check CPU performance indicators of Linux cloud server through top

PHPz
Release: 2023-05-24 14:34:06
forward
2074 people have browsed it

When the server becomes slow and the load is high, you need to first check whether the cpu load is too high. If the cpu load is high, then check to see what process is occupying the cpu resources.
1. cpu load:
View through the top command:

How to check CPU performance indicators of Linux cloud server through top

Mainly look at "load average", which can be understood as indicating the top 1, 5, and 15 minute load average. Generally, the number of CPUs with one core should not exceed 4. If it is a 4-core CPU, it should not exceed 16 (ie: number of CPU cores * 4). If it exceeds, it means that the load is high and there is an abnormality.

Other parameters are explained as follows:

us (user time) indicates the time when the CPU executes the user process, including ni time. Usually we only look at this.

sy(system time) indicates the CPU running time in the kernel, including IRQ and softirq time. High system CPU usage indicates that there is a bottleneck in some part of the system. Usually, the lower the value, the better.

wa(waiting time) The time CPI spends waiting for the I/O operation to complete. The system should not spend a lot of time waiting for the I/O operation, otherwise it means there is a problem with the I/O.

id(idle time) The system is in idle period, waiting for the process to run.

ni(nice time) The time it takes the system to adjust the process priority.

hi(hard irq time) The time it takes the system to process hard interrupts.

si(softirq time) The time it takes for the system to process software interrupts.

st(steal time) The time that is forced to wait for the virtual CPU while the hypervisor is serving another virtual processor.

2. Query the processes occupying the cpu

Continue to view through the top command:

How to check CPU performance indicators of Linux cloud server through top

You can clearly find php -The fpm process takes up a lot of resources. php-fpm, mysql, httpd, nginx, etc. are all site web processes. If there is a large amount of resource usage, it usually means that the website has a large number of visits. At this time, you can open the website's access log for analysis. Generally speaking, the website with large access logs will also occupy a large amount of resources. You need to open the log to check and analyze it specifically to see if it is caused by a large number of visits or abnormal access (such as a large number of crawling by a certain type of spider, abnormal execution of a certain program connection, CC attack, etc.).

The above is the detailed content of How to check CPU performance indicators of Linux cloud server through top. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!