Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Linux performance monitoring - CPU, Memory, IO, Network     - Python script running in the background (Programming)

- Configuring DNS process under CentOS 6.5 (Server)

- Linux development environment to build and use the directory structure and file --Linux (Linux)

- Lua and C ++ (Programming)

- Linux server dual-card dual-IP and single-card dual-IP configuration method (ReHat / CentOS) (Server)

- Use SVN to automatically deploy code under Apache (Server)

- How to enhance the Nagios server security (Linux)

- How to use the tab in Vim carried Python code completion (Linux)

- nginx.conf Optimization (Server)

- To build a private Docker registry (Server)

- MySQL5.6.12 Waiting for commit lock lead to hang from the library housing problem analysis (Database)

- On event processing browser compatibility notes (Programming)

- The Linux firewall is configured to use proxy (Linux)

- Linux Tutorial Share: How to sudo command to define the PATH environment variable (Linux)

- Ubuntu under Spark development environment to build (Server)

- Taught you how to build your own VPS server (Server)

- Using Linux / Unix Text processing (Linux)

- Linux install and configure Heartbeat (Server)

- Wine 1.7 is installed on a system based on RedHat or Debian (Linux)

- Eclipse configuration GTK (Linux)

  Linux performance monitoring - CPU, Memory, IO, Network
  Add Date : 2018-11-21      
  One, CPU

Good condition indicators

CPU Utilization: User Time <= 70%, System Time <= 35%, User Time + System Time <= 70%.

Context switching: CPU utilization may be associated with, if the CPU utilization in good condition, a large number of context switches is also acceptable.

Runnable queue: Each processor can run queue <= 3 threads.

Monitoring Tools


$ Vmstat 1

You can look at a field-aligned:

The following is a case of someone else's server:

procs ----------- memory ---------- --- swap-- ----- io ---- --system-- ----- cpu ------

r b swpd free buff cache si so bi bo in cs us sy id wa st

1,401,402,904,316,341,912 3,952,308 0 0 0,460,110,695,933,664,100

1,701,402,903,492,341,912 3,951,780 0,000,103,796,143,565,100

2,001,402,902,016,341,912 3.952 million 0,000,104,697,393,564,100

1,701,402,903,904,341,912 3,951,888 0,007,610,449,879,376,300 0

1,601,402,904,580,341,912 3952108 0,000,105,598,083,465,100

Important parameters:

r, run queue, the queue can run several processes, these processes are runnable, but the CPU is temporarily unavailable.

b, the number of processes to be blocked, waiting for IO requests.

in, interrupts, interrupt number to be processed.

cs, context switch, the system is the number of context switches do.

us, the user percentage of CPU usage.

The percentage of CPU-sys, kernel and interrupts.

id, CPU completely idle percentage.

The above example can be obtained:

sy us high low, high frequency and context switches (cs), description of the application of a large number of system calls.

This 4-core machine should be less than 12 r, r now in more than 14 threads, the CPU load is heavy.

See a process of CPU resources

$ While:; do ps -eo pid, ni, pri, pcpu, psr, comm | grep 'db_server_login'; sleep 1; done


28577 0 23 0.0 0 db_server_login

28578 0 23 0.0 3 db_server_login

28579 0 23 0.0 2 db_server_login

28581 0 23 0.0 2 db_server_login

28582 0 23 0.0 3 db_server_login

28659 0 23 0.0 0 db_server_login


Two, Memory

Good condition indicators

swap in (si) == 0, swap out (so) == 0

Applications available memory / system physical memory <= 70%

Monitoring Tools


$ Vmstat 1

procs ----------- memory ---------- --- swap-- ----- io ---- --system-- ----- cpu ------

r b swpd free buff cache si so bi bo in cs us sy id wa st

0,325,269,624,322,687,148 3604 2368 3608 2372 2882880021781

0,225,348,422,162,287,104 consisting of 5368 2976 5372. 3036 9305190001000

0,125,925,226,161,286,148 19 784 18 712 19 784 1,871,238,211,853,013,951

1,226,000,821,881,446,824 11,824,258,412,664 2,584,134,711,741,400,860

2,126,214,029,641,285,852 24912 17304 24952 17304 473,723,418,610,004

Important parameters:

swpd, SWAP space has been used, KB units.

free, available physical memory size, KB units.

buff, the physical size of the cache memory is used to buffer read and write operations, KB units.

cache, the physical memory is used to cache the process address space cache size, KB units.

si, data is read from the size of SWAP RAM (swap in) of, KB as a unit;

so, data is written to SWAP (swap out) the size of the RAM, KB units.

The above example can be obtained:

Physical memory available free basically no significant change, swapd gradually increased, indicating the smallest available memory remains at 256MB (physical memory size) * 10% = about 2.56MB, when the dirty pages to reach 10% of the time began extensive use of swap.


$ Free -m

total used free shared buffers cached

Mem: 8111 7185 926 0 243 6299

- / + Buffers / cache: 643 7468

Swap: 8189 0 8189

Third, disk IO

Good condition indicators

iowait% <20%

Improve the hit rate of a simple way to increase the file cache area, the larger the cache, the more pre-existing page, the hit rate is also higher.

Linux kernel is to make a possible second page fault (read from the file cache), and can avoid the main page fault (from the hard disk) as much as possible, so that with the increase of times a page fault, the file cache is gradually increased Great, until the system is only a small amount of physical memory available when Linux started to release some unused pages.

Monitoring Tools

View the physical memory and file cache case

$ Cat / proc / meminfo

MemTotal: 8182776 kB

MemFree: 3053808 kB

Buffers: 342704 kB

Cached: 3972748 kB

This server a total of 8GB of physical memory (MemTotal), about 3GB of available memory (MemFree), about 343MB used for disk cache (Buffers), about 4GB used for file cache (Cached).

$ Sar -d 2 3

Linux 2.6.9-42.ELsmp (webserver) 11/30/2008 _i686_ (8 CPU)

11:09:33 PM DEV tps rd_sec / s wr_sec / s avgrq-sz avgqu-sz await svctm% util

11:09:35 PM dev8-0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00

11:09:35 PM DEV tps rd_sec / s wr_sec / s avgrq-sz avgqu-sz await svctm% util

11:09:37 PM dev8-0 1.00 0.00 12.00 12.00 0.00 0.00 0.00 0.00

11:09:37 PM DEV tps rd_sec / s wr_sec / s avgrq-sz avgqu-sz await svctm% util

11:09:39 PM dev8-0 1.99 0.00 47.76 24.00 0.00 0.50 0.25 0.05

Average: DEV tps rd_sec / s wr_sec / s avgrq-sz avgqu-sz await svctm% util

Average: dev8-0 1.00 0.00 19.97 20.00 0.00 0.33 0.17 0.02

Important parameters:

await represents the average wait time each time the device I / O operations (in milliseconds).

svctm represents the average service time each time the device I / O operations (in milliseconds).

% Util represents one second a few percent of the time for I / O operations.

If svctm value and await very close, showing almost no I / O wait, good disk performance, if the value is much higher than the value of svctm await, and said I / O queue wait too long, the application running on the system slow.

If% util close to 100%, the resulting disk I / O requests are too much, I / O system has been working at full capacity, the disk may be a bottleneck.

Four, Network IO


Good condition indicators

Receive, transmit buffer is no longer pending network packets.

Monitoring Tools


For UDP services, view all network conditions listening UDP port

$ Watch netstat -lunp

Proto Recv-Q Send-Q Local Address Foreign Address State PID / Program name

udp 0 0* -

udp 0 0* -

udp 0 0* -

udp 0 0* -

udp 0 0* -

udp 0 0* -

udp 0 0* -

udp 0 0* -

RecvQ, SendQ 0, or no time value greater than 0 is relatively normal.


For UDP service to view packet loss (NIC received, but did not deal with the application layer over packet loss)

$ Watch netstat -su


    278073881 packets received

    4083356897 packets to unknown port received.

    2474435364 packet receive errors

    1079038030 packets sent

packet receive errors that a numerical increase, it indicates that the packet loss.


Good condition indicators

For TCP, it will not be because of lack of buffer and packet loss thing, because otherwise the network, leading to lost packets by protocol layer will be lost retransmission mechanisms to ensure packets reach the other side.

So, tcp terms more specifically focus on transfer rate.

Monitoring Tools

# Cat / proc / net / snmp | grep Tcp:

Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts

Tcp: 1 200 120000 -1 105112 76272 620 23185 6 2183206 2166093 550 6 968812

Retransmission rate = RetransSegs / OutSegs

As for the number of values ​​within the range, considered ok, and depends on the specific business.

Business side is more concerned about the response time.
- MySQL monitoring tools -orzdba (Database)
- The principle Httpclient4.4 (HttpClient Interface) (Programming)
- The need to avoid a gap of InnoDB lock (Database)
- Android source code compiled fatal error solutions (Programming)
- Linux nice program origin of the name (Linux)
- DB2 manually create a library (Database)
- Analysis of Java in the deep copy and shallow copy (Programming)
- Git delete files (Linux)
- Learning how to teach safety system to prevent your own IP leakage (Linux)
- Ubuntu 15.04 and Ubuntu 14.04 installed Cinnamon 2.6 (Linux)
- AngularJS notes --- Data Binding (Programming)
- Linux common network tools: ping host sweep (Linux)
- osprofiler use OpenStack Cinder Lane (Server)
- Security Knowledge: redirection command application security (Linux)
- Sublime Text 3 (Linux)
- Python dictionary applications get built-in method (Programming)
- Oracle how to maintain the consistency of read? (Database)
- Apache2.4.7 make an error [exports.lo] Error 1 Solution (Server)
- Using Linux / Unix Text processing (Linux)
- Oracle data files deleted recover after physical (Database)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.