Linux system performance monitoring common commands __linux

Source: Internet
Author: User
Tags cpu usage
Linux system performance monitoring common commands Blog Categories:Technical methods

First, Linux server performance concerns

1) CPU

-> load: The sum of statistics that represents the tasks that the CPU is processing and waiting to process over a period of time, simple to understand the ratio of the number of threads being processed by the CPU to the number of threads that can be processed concurrently. The security limit for the load value is generally considered to be the number of CPUs

-> Run queue: A thread running queue that represents CPU maintenance. In multi-core systems, each CPU will maintain such a queue, the greater the length value indicates the higher the CPU load, the load index is based on this statistic

The utilization rate of-> UTILIZATION:CPU is composed of the following parts. The latter is typically the ratio distribution of the CPU being fully exploited

User 60%~70%

System 30%~35%

Idle 0%~5%

IO wait close to 0%

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

->nice: In user space, the CPU occupancy rate of the priority process is changed through a nice or setpriority call. In the same case, a process with a higher priority (a smaller value) will be prioritized than the lower priority. Nice not 0 indicates a low priority process has been preempted for high-priority processes

2) Memory

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

->cache: Cache The read data, and then fetch (hit) the same data directly from the cache the next time you want to increase the access speed

->swap: Expansion of physical memory

3) IO

->R/W: Read/write traffic

->RTPS/WTPS: Requests for IO read/write transactions per second

4) Network

->in/out Network traffic size

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

Two, Linux commonly used commands

1 View server Basic configuration

cat/proc/cpuinfo Viewing 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 Reporting command

Common Parameters- q: CPU load

- u: CPU Utilization

- R: Memory

- b: IO

- n: Network

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


As can be seen from the above figure, the load is lower, 5 CPUs have 3 Runqsz 0, indicating that the system load is not high

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



The CPU's idle ratio has reached 90%+, indicating that the system is idle

sar-r View the day memory footprint (default every 10 minutes statistics)



8G physical memory, the utilization rate reached more than 90%, of which buffer has 100m+,cache3g+ (a large number of local cache caused), swap space has 2G, basically useless

sar-b View of the day IO usage


The system constantly refreshes the log files, and Io reflects a write-oriented

sar-n sock view Network sock Connection



sar-n DEV sees network traffic


sar-u-f/var/log/sa/sa21 on historical data, contrasting and analyzing system issues (SA21 indicates the data for this month, 21st)

Vmstat Real-time performance monitoring



Top Display Server task


Common parameters H: Switch to show all threads

1: Show each CPU operation (similar command and Mpstat)

ps-ef or ps-aux Show All processes, the difference is in different display styles


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


Change Java to httpd to count the number of Apache threads

Find , DF, Du, iostat disk IO commands

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


df-ha View File system disk consumption


Du-ak | sort-t$ ' \ t '-l1-nr-k2-r sort all files by file size in the same size, sorted alphabetically by filename



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


ipconfig, ping, netstat network monitoring command

Netstat-ano | grep 8787 View 8787 Port connections



In Windows, you can use IP to reverse-check connection machine information through the nbtstat command, which is helpful in troubleshooting team members who are using Remote debug server to occupy connection resources


In addition, for unfamiliar commands you can use the man view, further to the parameters of a command does not understand, you can use the command- H to see how to use

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.