Linux system performance Monitoring common commands

Source: Internet
Author: User
Tags cpu usage disk usage


One, Linux server performance concerns

1) CPU

Load: Represents the sum of the statistics of the tasks that the CPU is processing and waiting to process over time, as simple as the ratio of the number of threads being processed by the CPU and the number of threads that can be processed concurrently. It is generally assumed that the maximum security limit for the load value is the number of CPUs

Run queue: The thread that represents CPU maintenance runs the queues. In multicore systems, each CPU maintains such a queue, and the larger the length value indicates the higher the CPU load, the load indicator is based on this statistic

UTILIZATION:CPU utilization, which consists of the following parts. The latter is generally the ratio distribution of the CPU being fully utilized

User 60%~70%

System 30%~35%

Idle 0%~5%

IO wait close to 0%

->context switches: When the number of threads that can be run is greater than the CPU resource, the system is forced to swap out the executing thread to ensure that other threads get run. For a swapped-out thread, the system retains its run-time context to resume execution at the next scheduled time.

->nice: Changes the CPU utilization of the priority process over a nice or setpriority call within the user space. In the same situation, a higher priority (lower value) of the process will be prioritized than lower priority. Nice is not 0, indicating a situation in which a low-priority process has preempted a high-priority process

2) Memory

->buffer: Buffer for IO read/write design, the main purpose is to ensure the synchronization of process data between different peripherals

->cache: Caches the data that has been read, and gets (hits) directly from the cache the next time it needs the same data to improve access speed

->swap: Expansion of physical memory

3) IO

->R/W: Read/write traffic

->rtps/wtps: Number of transactions per second that request IO read/write

4) Network

->in/out Network traffic size

->TCP/UDP/SOCK/HTTPD Number of connections

Second, Linux common commands

1) View server Basic configuration

cat/proc/cpuinfo View CPU Information


grep processor/proc/cpuinfo | wc-l count the number of CPUs

cat/proc/meminfo View memory information


uname-a System basic Information




W or who view user login


SAR System Report command

Common Parameters- q: CPU load

- u: CPU Utilization

- R: Memory

- b: IO

- n: Network

sar-q 1 5 View CPU load status, statistics 1 times per 1s, total 5 times


It can be seen that the load is lower, 5 CPUs have 3 Runqsz of 0, indicating that the system is not high

sar-u 2 3 See CPU usage, 1 times per 2s, total statistics 3 times



The idle ratio of the CPU reaches 90%+, which also indicates that the system is idle

sar-r Check the memory consumption of the day (by default every 10 minutes)



8G of physical memory, the use of more than 90%, where buffer has 100m+,cache3g+ (caused by a large number of local caches), swap space of 2G, basically useless

sar-b View Day IO usage


The system constantly refreshes the log file, Io reflects the write-based

sar-n SOCK View network SOCK Connection



sar-n DEV View network traffic


sar-u-f/var/log/sa/sa21 on historical data, comparing and analyzing system problems (SA21 indicates data of 21st this month)

Vmstat Real-time performance monitoring



Top Display server tasks


Common parameter H: Switch to show all threads

1: Show individual CPU runs (similar commands and Mpstat)

ps-ef or ps-aux Show all processes, except for different display styles


ps-elf | grep java | wc-l count Java threads


Convert Java to httpd to count Apache threads

Find, DF, du, iostat disk IO command

find/home/admin/-name "Hsf.log" to find a file named Hsf.log under the/home/admin/path


df-ha View the disk usage of the file system


Du-ak | sort-t$ ' \ t '-l1-nr-k2-r All files currently under the same size, sorted by file size, sorted by filename



Iostat-x-D
disk IO Traffic real-time statistics


ipconfig, ping, netstat network monitoring commands

Netstat-ano | grep 8787 look at Port 8787 connectivity



IP can be used under Windows to reverse the connection of machine information via the nbtstat command, which is helpful in troubleshooting team members who use the Remote debug server for connection resources


In addition, for less familiar commands can be viewed with man, further to the parameters of a command do not understand, you can use the command- H to see how to use

Linux system performance Monitoring common commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.