Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sar performance testing tool

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Yum install sysstat

=

Sixth, the sar-n command is to view network information and flow speed.

=

Sar-n {DEV | EDEV | NFS | NFSD | SOCK | ALL}

Sar provides six different syntax options to display network information. The-n option uses six different switches: DEV | EDEV | NFS | NFSD | SOCK | ALL. DEV displays network interface information, EDEV displays statistics about network errors, and NFS statistics

Active NFS client information, NFSD statistics NFS server information, SOCK displays socket information, ALL displays all five switches. They can be used alone or together.

Sar-n DEV 2 3 [refresh the information once in 2 seconds, always display it 3 times, and finally show an average value]

Linux 2.6.32-431.el6.x86_64 (localhost.localdomain) 04 CPU 1916 _ x86 pound 641)

09:25:42 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s

09:25:44 AM lo 0.00 0.00 0.00

09:25:44 AM eth2 1.12 0.00 0.16 0.00 0.00 0.00

09:25:44 AM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s

09:25:46 AM lo 0.00 0.00 0.00

09:25:46 AM eth2 1.63 0.54 0.18 0.20 0.00 0.00 0.00

Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s

Average: lo 0.00 0.00 0.00

Average: eth2 1.38 0.28 0.17 0.10 0.00 0.00 0.00

Field description

IFACE LAN interface

Packets received by rxpck/s per second

Packets sent by txpck/s per second

Bytes received by rxbyt/s per second

Bytes sent by txbyt/s per second

Compressed packets received by rxcmp/s per second

Compressed packets sent by txcmp/s per second

Multicast packets received by rxmcst/s per second

# sar-n EDEV 2 10

Linux 2.6.18-53.el5PAE (localhost.localdomain) 03 Universe 29 Universe 2009

Www.2cto.com

01:42:18 AM IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s

01:42:20 AM lo 0.00 0.00 0.00

01:42:20 AM eth2 0.00 0.00 0.00

01:42:20 AM sit0 0.00 0.00 0.00

IFACE:LAN interface

Rxerr/s: bad packets received per second

Txerr/s: bad packets sent per second

Coll/s: collisions per second

Rxdrop/s: the number of received packets discarded per second because the buffer is full

Txdrop/s: the number of sent packets discarded per second because the buffer is full

Txcarr/s: carrier errors per second when sending packets

Rxfram/s: the number of frame alignment errors received per second

Rxfifo/s: number of FIFO overspeed errors per second of packets received

Txfifo/s: the number of FIFO overspeed errors per second of packets sent

# sar-n SOCK 2 10

Linux 2.6.18-53.el5PAE (localhost.localdomain) 03 Universe 29 Universe 2009

Www.2cto.com

01:44:32 AM totsck tcpsck udpsck rawsck ip-frag

01:44:34 AM 243 9 8 0 0

01:44:36 AM 242 9 7 0 0

01:44:38 AM 238 9 7 0 0

01:44:40 AM 238 9 7 0 0

Totsck: total number of sockets used

Tcpsck: number of TCP sockets used

Udpsck: number of UDP sockets used

Rawsck: number of raw sockets used

Ip-frag: number of IP segments used

= =

Explanation of sar detailed parameters

= =

Common format of the sar command line:

Sar [options] [- A] [- o file] t [n]

On the command line, the two parameters n and t are combined to define the sampling interval and times. T is the sampling interval and is a necessary parameter. N is the sampling number and is optional. The default value is 1m file, which means to store the command results in a file in binary format.

File is not a keyword here, it's a file name. Options is a command line option, and there are many options for the sar command. Only common options are listed below:

A: the sum of all the reports.

-u:CPU utilization

-v: process, I node, file, and lock table status.

-d: hard disk usage report.

-r: no memory pages and hard disk blocks are used.

-g: the situation of serial port IWeiO.

-b: buffer usage.

-a: the reading and writing of documents.

-c: system call situation.

-R: the activity of the process.

-y: terminal equipment activity.

-w: system exchange activity.

-n: record network usage

Default monitoring: sar 5 5 / / CPU and IOWAIT statistical status

(1) sar-b 55 / / IO transfer rate

(2) sar-B 55 / page exchange rate

(3) rate of sar-c 5 5 / / process creation

(4) active information of sar-d 55 / block devices

(5) sar-n DEV 55 / / status information of network devices

(6) the use of sar-n SOCK 55 / / SOCK

(7) sar-n ALL 55 / / all network status information

(8) sar-P ALL 55 / / usage status information and IOWAIT statistical status of each CPU

(9) length of sar-Q 5 5 / / queue (number of processes waiting to run) and load status

(10) sar-r 55 / / memory and swap space usage

(11) sar-R 5 5 / / memory statistics (allocation and release of memory pages, memory pages used by the system as BUFFER per second, memory pages cache per second)

(12) usage and IOWAIT information of sar-u 55 / / CPU (same as default monitoring)

(13) status information of sar-v 55 / / inode, file and other kernel tablesd

(14) sar-w 55 / / number of context exchanges per second

(15) Statistics exchanged by sar-W 55 / / SWAP (si so with the same monitoring status as iostat)

(16) sar-x 2906 55 / / displays statistical information for the specified process (2906), including errors caused by the process, user-level and system-level user CPU usage, and which CPU is running on

(17) activity status of sar-y 55 / / TTY devices

(18) output to file (- o) and read record information (- f)

For example, 1:oracle@oracle [/ home/oracle] sar-u 10-e 16:00:00 > data.txt / / records the use of CPU every second, and until 15:00, the data will be saved to the data.txt file. (the-e parameter indicates the end time. Note the time format: it must be in hh:mm:ss format)

Linux 2.6.18-194.el5 (oracle) 10 ax 11 Universe 2011

02:20:28 PM CPU user nice system iowait steal idle

02:20:29 PM all 0.00 0.00 0.00 100.00

02:20:30 PM all 0.00 0.00 0.00 100.00

02:20:31 PM all 0.00 0.00 0.00 100.00

02:20:32 PM all 0.00 0.00 0.00 100.00

02:20:33 PM all 0.00 0.00 0.00 100.00

02:20:34 PM all 0.00 0.00 0.25 0.00 0.00 99.75

02:20:35 PM all 0.00 0.00 0.00 100.00

02:20:36 PM all 0.00 0.00 0.00 100.00

02:20:37 PM all 0.25 0.00 0.00 0.00 99.75

02:20:38 PM all 0.00 0.00 0.00 100.00

Average: all 0.02 0.00 0.02 0.00 0.00 99.95

The system prints CPU usage by default without using parameters

% user: the percentage of time CPU spent in user mode.

The percentage of time system:CPU spent in system mode.

% iowait: the percentage of time that CPU waits for input and output to complete.

% idle: percentage of CPU idle time.

In all the displays, we should mainly note that the values of% iowait and% idle,%iowait are too high, indicating that the hard disk has an I O bottleneck, and a high% idle value means that the CPU is idle. If the% idle value is high but the system response is slow, it is possible that the CPU is waiting to allocate memory, so the memory capacity should be increased at this time. If the% CPU value is consistently lower than 10, then the system's CPU processing capacity is relatively low, indicating that the resource that needs to be solved most in the system is CPU.

In a multi-CPU Linux system, the sar command can also decompose this information for each CPU, using the following command: sar-u-P ALL 55

Oracle@oracle [/ home/oracle] sar-u-P ALL 5 2

Linux 2.6.18-194.el5 (oracle) 10 ax 11 Universe 2011

02:41:20 PM CPU user nice system iowait steal idle

02:41:25 PM all 0.00 0.00 0.10 0.00 0.00 99.90

02:41:25 PM 0 0.00 0.00 0.20 0.00 0.00 99.80

02:41:25 PM 1 0.00 0.00 0.00 100.00

02:41:25 PM 2 0.20 0.00 0.20 0.00 0.00 99.60

02:41:25 PM 3 0.00 0.00 0.00 100.00

02:41:25 PM CPU user nice system iowait steal idle

02:41:30 PM all 0.00 0.00 0.05 0.00 0.00 99.95

02:41:30 PM 00.00 0.00 0.00 0.00 100.00

02:41:30 PM 1 0.00 0.00 0.00 100.00

02:41:30 PM 2 0.00 0.00 0.00 100.00

02:41:30 PM 3 0.00 0.00 0.00 100.0

Example 2: use the command sar-v t n

Oracle@oracle [/ home/oracle] sar-v 30 5 / / process, I node, file and lock table status

Linux 2.6.18-194.el5 (oracle) 10 ax 11 Universe 2011

02:28:45 PM dentunusd file-sz inode-sz super-sz super-sz dquot-sz dquot-sz rtsig-sz rtsig-sz

02:29:15 PM 8675 9690 7119 0 0.00 0 0.00 0 0.00

02:29:45 PM 8676 9690 7119 0 0.00 0 0.00 0 0.00

02:30:15 PM 8677 9690 7119 0 0.00 0 0.00 0 0.00

02:30:45 PM 8684 9690 7126 0 0.00 0 0.00 0 0.00

02:31:15 PM 8685 9690 7126 0 0.00 0 0.00 0 0.00

Average: 8679 9690 7122 0 0.00 0 0.00 0 0.00

Dentunusd: the number of entries that are not used in buffered directory entries.

File-nr: the number of file handles used by the system.

Inode-nr: the number of inodes used.

Pty-nr: the number of pty used.

Example 3: use the command sar-d t n

Oracle@oracle [/ home/oracle] sar-d 30 2 / / View device usage

Linux 2.6.18-194.el5 (oracle) 10 ax 11 Universe 2011

02:30:33 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm util

02:31:03 PM dev8-047.95 12099.97 58.38 253.56 0.08 1.74 1.03 4.95

02:31:03 PM dev8-1 0.00 0.00 0.00

02:31:03 PM dev8-2 0.00 0.00 0.00

02:31:03 PM dev8-3 47.95 12099.97 58.38 253.56 0.08 1.74 1.03 4.95

02:31:03 PM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm util

02:31:33 PM dev8-0 38.67 9648.00 62.93 251.14 0.07 1.75 1.01 3.89

02:31:33 PM dev8-1 0.00 0.00 0.00

02:31:33 PM dev8-2 0.00 0.00 0.00

02:31:33 PM dev8-3 38.67 9648.00 62.93 251.14 0.07 1.75 1.01 3.89

DEV disk device

The disk device names such as sda,hdc can be printed out with the parameter-p. If the parameter-p is not used, the device node may be dev8-0dev22-0.

Tps: the number of times per second from the physical disk. Multiple logical requests will be merged into a single disk request, and the size of a transfer is uncertain.

Rd_sec/s: the number of times sectors are read per second.

Wr_sec/s: the number of times sectors are written per second.

Avgrq-sz: the average data size (sector) of each device Istroke O operation.

Avgqu-sz: the average length of the disk request queue.

Await: the average elapsed time of each request, including the waiting time of the request queue, from the request disk operation to the completion of the system processing, in milliseconds (1 second = 1000 milliseconds).

Svctm: the average time the system processes each request, excluding the time spent in the request queue.

% util:I/O requests as a percentage of CPU. The higher the ratio, the more satisfied you are.

Example 4: use the command sar-n t n

Oracle@oracle [/ home/oracle] sar-n ALL 5 2

Linux 2.6.18-194.el5 (oracle) 10 ax 11 Universe 2011

02:52:49 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/ s rxmcst/s

02:52:54 PM lo 0.00 0.00 0.00

02:52:54 PM eth0 127.15 112.57 38894.41 20819.16 0.00 0.00 0.00

02:52:54 PM eth2 0.00 0.00 0.00

02:52:54 PM sit0 0.00 0.00 0.00

02:52:49 PM IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s

02:52:54 PM lo 0.00 0.00 0.00

02:52:54 PM eth0 0.00 0.00 0.00

02:52:54 PM eth2 0.00 0.00 0.00

02:52:54 PM sit0 0.00 0.00 0.00

02:52:49 PM call/s retrans/s read/s write/s access/s getatt/s

02:52:54 PM 0.00 0.00 0.00

02:52:49 PM scall/s badcall/s packet/s udp/s tcp/s hit/s miss/s sread/s swrite/s saccess/s sgetatt/s

02:52:54 PM 0.00 0.00 0.00

02:52:49 PM totsck tcpsck udpsck rawsck ip-frag

02:52:54 PM 274 99 41 0 0

02:52:54 PM IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/s rxmcst/s

02:52:59 PM lo 0.40 0.40 20.00 20.00 0.00 0.00 0.00

02:52:59 PM eth0 139.00 120.60 47988.20 22587.00 0.00 0.00 0.00

02:52:59 PM eth2 0.00 0.00 0.00

02:52:59 PM sit0 0.00 0.00 0.00

02:52:54 PM IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/ s rxfram/s rxfifo/s txfifo/s

02:52:59 PM lo 0.00 0.00 0.00

02:52:59 PM eth0 0.00 0.00 0.00

02:52:59 PM eth2 0.00 0.00 0.00

02:52:59 PM sit0 0.00 0.00 0.00

02:52:54 PM call/s retrans/s read/s write/s access/s getatt/s

02:52:59 PM 0.00 0.00 0.00

02:52:54 PM scall/s badcall/s packet/s udp/s tcp/s hit/s miss/s sread/s swrite/s saccess/s sgetatt/s

02:52:59 PM 0.00 0.00 0.00

02:52:54 PM totsck tcpsck udpsck rawsck ip-frag

02:52:59 PM 274 99 41 0 0

Average: IFACE rxpck/s txpck/s rxbyt/s txbyt/s rxcmp/s txcmp/ s rxmcst/s

Average: lo 0.20 0.20 9.99 9.99 0.00 0.00 0.00

Average: eth0 133.07 116.58 43436.76 21702.20 0.00 0.00 0.00

Average: eth2 0.00 0.00 0.00

Average: sit0 0.00 0.00 0.00

Average: IFACE rxerr/s txerr/s coll/s rxdrop/s txdrop/s txcarr/s rxfram/s rxfifo/s txfifo/s

Average: lo 0.00 0.00 0.00

Average: eth0 0.00 0.00 0.00

Average: eth2 0.00 0.00 0.00

Average: sit0 0.00 0.00 0.00

Average: call/s retrans/s read/s write/s access/s getatt/s

Average: 0.00 0.00 0.00

Average: scall/s badcall/s packet/s udp/s tcp/s hit/s miss/s sread/s swrite/s saccess/s sgetatt/s

Average: 0.00 0.00 0.00

Average: totsck tcpsck udpsck rawsck ip-frag

Average: 274 99 41 0 0

Sar provides four different syntax options to display network information. The-n option uses four different switches: DEV, EDEV, SOCK, and FULL. DEV displays network interface messages, EDEV displays statistics about network errors, and SOCK displays socket information.

FULL displays all three switches. They can be used alone or together.

Field description

IFACE LAN interface

Packets received by rxpck/s per second

Packets sent by txpck/s per second

Bytes received by rxbyt/s per second

Bytes sent by txbyt/s per second

Compressed packets received by rxcmp/s per second

Compressed packets sent by txcmp/s per second

Multicast packets received by rxmcst/s per second

The latter one is only explained for each command, not tested.

Example 5: sar-r 55 / / memory and swap space usage

Kbmemfree: this value is basically the same as the free value in the free command, so it does not include buffer and cache space.

Kbmemused: this value is basically the same as the used value in the free command, so it includes buffer and cache space.

% memused: this value is a percentage of kbmemused and total memory (excluding swap).

Kbbuffers and kbcached: these two values are buffer and cache in the free command.

Kbcommit: guarantee the memory needed by the current system, that is, the memory needed to ensure that it does not overflow (RAM+swap).

% commit: this value is a percentage of kbcommit to total memory (including swap).

Example 6: sar-B 55 / page exchange rate

Pgpgin/s: indicates the number of bytes per second from disk or SWAP to memory (KB)

Pgpgout/s: indicates the number of bytes per second from memory to disk or SWAP (KB)

Fault/s: the number of missing pages generated by the system per second, that is, the sum of primary and secondary missing pages (major + minor)

Majflt/s: the number of main missing pages generated per second.

Pgfree/s: the number of pages placed in the idle queue per second

Pgscank/s: number of pages scanned by kswapd per second

Pgscand/s: the number of pages directly scanned per second

Pgsteal/s: the number of pages cleared from cache per second to meet memory requirements

% vmeff: percentage of pages cleared per second (pgsteal) to total scanned pages (pgscank+pgscand)

Example 7: sar-Q 5 5 / / queue length (number of processes waiting to run) and load status

Runq-sz: the number of processes that are running or ready

Plist-sz: the total number of processes now (including threads).

Ldavg-1: the load in the last minute.

Ldavg-5: the load for the last five minutes.

Ldavg-15: the load for the last ten minutes.

The average load and queue data are from / proc/loadavg

Example 8: monitoring of sar-n NFS 55 / / NFS client

Call/s: every second a successful RPC call increases the value of call/s, such as a read / write to NFS.

Retrans/s: the number of RPC retransmissions per second, for example, when timeout is generated due to server problems, the client needs to retransmit.

Read/s: the number of reads per second from the NFS server.

Write/s: the number of writes to the NFS server per second.

Access/s: the number of times per second to access NFS, such as COPY files from the NFS server.

Getatt/s: the number of times per second to get NFS server file attributes, such as ls-l / NFSSERVER/,. If NFSSERVER has 300 files, it will generate 300 such requests.

Example 9: sar-b 55 / / IO transfer rate

Tps: the number of times per second from the physical disk. Multiple logical requests will be merged into a single disk request, and the size of a transfer is uncertain.

Rtps: number of read requests per second

Wtps: number of write requests per second

Bread/s: number of blocks read from disk per second (in blocks 1 block = 512B, kernel after 2.4B)

Bwrtn/s: number of blocks written to disk per second (in blocks 1 block = 512B, kernel after 2.4B)

In general, tps= (rtps+wtps)

Sar can also monitor non-real-time data and run it to a specified directory through cron cycles.

For example, we want to look at the memory resources from 0 to 23:00 on the 27 th of this month.

Sa27 is the 27 th of this month, and the specific time can be specified by-s (start) and-e (end).

Sar-f / var/log/sa/sa27-s 00:00:00-e 23:00:00-r

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report