Five Linux simple commands to help you solve performance problems

  
                  

Managing the performance of a Linux host often seems like magic. Many administrators often simplistically handle performance problems, relying on hardware updates, larger memory, and a stronger CPU to solve problems. In fact, with a few simple commands, you can discover many of the details of managing hosts and quickly and easily resolve performance issues.

a, top

For many administrators, is to learn the latest TOP command, which displays all currently running kernel tasks, and provides statistical reports some of the host state. By default, the TOP command automatically updates this data every five minutes (this update interval is configurable).

The TOP command is incredibly functional (it is estimated that very few people have used more than half of the functionality). Generally speaking, you will start with the ‘h’ key, which is ‘help’ (the documentation is also very exciting). Help parameters can quickly show what you can add and subtract from, while also changing the sort. You can also use k to end the process or use r to mark a particular process.

The Top command displays the uptime of the day, the system load, the number of processors, the memory usage, and which processes use most of the CPU resources (including a large amount of information about each process, such as online users and The command being executed, etc.).

Second, vmstat

The Vmstat command provides you with a snapshot of your current CPU, IO, process, and memory usage. Like the TOP command, it is automatically dynamically refreshed and can be executed with the following command:

$ vmstat 10

Here the delay is the time in seconds between refresh intervals. Here is 10 seconds. The VMSTAT command will display the results of the check on the screen until you end it with the CTRL-C command (or you can set a limit when executing). The results of this continuous output are sometimes used to import into a file to analyze performance trends, but we will find a better way to do this, as described later in the article.


The first column shows the processor, the r column is the standby processor, and the b column is the sleeping processor. If you see multiple standby processors here, you may have experienced a performance bottleneck somewhere. The second column shows the memory: virtual, free, buffered, and cached. The third column shows the swap storage and how much memory is swapped with the disk. The fourth column is the I/O information, which shows the block data information received and sent by the block service.

The last two columns show the system and CPU related information. The system column shows the number of conflicts and the exchanges per second. The CPU column is a particularly useful piece of information. Each column shows a percentage of CPU time. These are listed as follows:

US: Time spent running user tasks and code
SY: Time spent running kernel or system code
ID: Idle time
WA: Waiting for IO cost Time
ST: Time taken by the virtual machine

The VMSTAT command is good at querying CPU usage, although remembering that each parameter depends mainly on continuous monitoring, because you can observe the CPU for a short time. I can't know the real problem with the CPU. You need to look at long-term running trends to get an exact CPU performance information.

Copyright © Windows knowledge All Rights Reserved