View CPU, memory, network traffic, and disk I/O in CentOS

Source: Internet
Author: User

View CPU, memory, network traffic, and disk I/O in CentOS

Install yum install-y sysstat

Sar-d 1 1

Rrqm/s: the number of merge read operations per second. That is, delta (rmerge)/s
Wrqm/s: Number of write operations performed on merge per second. That is, delta (wmerge)/s
R/s: The number of read I/O devices per second. That is, delta (rio)/s
W/s: the number of write I/O devices completed per second. That is, delta (wio)/s
Rsec/s: Number of read sectors per second. That is, delta (rsect)/s
Wsec/s: Number of write sectors per second. That is, delta (wsect)/s
RkB/s: the number of bytes read per second. It is half of rsect/s because the size of each slice is 512 bytes. (Computing required)
WkB/s: the number of K bytes written per second. Half of wsect/s. (Computing required)
Avgrq-sz: average data size (slice) of each device I/O operation ). Delta (rsect + wsect)/delta (rio + wio)
Avgqu-sz: Average I/O queue length. That is, delta (aveq)/s/1000 (because aveq is measured in milliseconds ).
Await: average wait time (in milliseconds) for each device I/O operation ). That is, delta (ruse + wuse)/delta (rio + wio)
Svctm: Average service time (in milliseconds) for each device I/O operation ). That is, delta (use)/delta (rio + wio)
% Util: the percentage of time in one second is used for I/O operations, or the number of I/O queues in one second is not empty. That is, delta (use)/s/1000 (because the Unit of use is milliseconds)

If % util is close to 100%, it indicates that too many I/O requests are generated and the I/O system is fully loaded.
There may be bottlenecks.
When the idle is less than 70% I/O, the load is high. Generally, the read speed is wait.
You can also view the parameters B (number of processes waiting for resources) and wa in combination with vmstat (percentage of CPU time occupied by I/O wait, higher than 30% when I/O pressure is high)

For more information, see
Generally, svctm is smaller than await (because the wait time for simultaneously waiting requests is calculated repeatedly). The size of svctm is generally related to disk performance, and the CPU/memory load will also affect it, too many requests may indirectly increase the svctm. The size of await generally depends on the service time (svctm), the length of the I/O queue, and the mode in which I/O requests are sent. If svctm is close to await, it means that I/O has almost no waiting time. If await is much larger than svctm, it means that the I/O queue is too long and the response time of the application is slow, if the response time exceeds the allowable range, you can consider replacing a faster disk, adjusting the kernel elevator algorithm, optimizing the application, or upgrading the CPU.
The queue length (avgqu-sz) can also be used as an indicator to measure the system I/O load. However, because avgqu-sz is based on the average per unit time, therefore, it cannot reflect the instantaneous I/O flood.

In the command line mode, how do I view CPU, memory usage, network traffic, and disk I/O?

Q: How can I view CPU, memory usage, network traffic, and disk I/O in the command line mode?

A: In command line mode,

1. Command for viewing CPU usage

$ Vmstat 5

Refresh Every 5 seconds, with CPU usage data at the rightmost.

$ Top

Top, then sort by Shift + P, by process processor usage

2. Command to view memory usage

$ Free

Top and then sort by Shift + M, by process memory usage

$ Top

3. View network traffic

You can use the iptraf tool.

$ Iptraf-g

"" Can be obtained by comparing the RX and TX data of two time network interfaces for the network traffic of an Interface.

$ Date; ifconfig eth1

$ Date; ifconfig eth1

4. view disk I/o

$ Iostat-d-x/dev/sdc3 2

Use iostat to view disk I/o of Disk/dev/sdc3, and refresh every two seconds.

$ Vmstat 2

Use vmstat to view io Information

Procs:
R->; number of processes waiting in the running queue
B->; number of processes waiting for io
W->; processes that can enter the running queue but are replaced

Memoy
Swap->; available swap memory (k)
Free->; idle memory (k)

Pages
Re -- recycling page
Mf -- non-serious error page
Pi -- number of incoming pages (k)
Po -- number of outgoing pages (k)
Fr -- number of free pages (k)
De -- number of missed pages read in advance
Sr-page scanned by clock algorithm

Disk Displays disk operations per second. S indicates the scsi disk, and 0 indicates the disk number.

Fault displays the number of interrupts per second
In -- device interruption
Sy -- System interruption
Cy -- cpu Switching

Cpu indicates the cpu usage status
Cs -- time used by the user process
Sy -- time used by the system process
Id -- cpu idle time

Where:
If r is often greater than 4 and the id is often less than 40, the cpu load is heavy.
If pi and po are not equal to 0 for a long time, the memory is insufficient.
If the disk is often not equal to 0 and the queue in B is greater than 3, the io performance is poor.

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.