Cloud computing development tutorial: operation and maintenance engineers will be skills --sar

Today this article is to share some of the cloud computing development tutorial, explaining today are: operation and maintenance engineers will be skills -sar.

SAR is a system activity reports (System Activity Report) English word acronym. As its name suggests, as, SAR is used to gather in a Unix and Linux operating systems, reporting and saving CPU, memory, input-output port usage command. SAR command can dynamically generate reports, the reports can also be saved in a log file.

If you do not have the package installed, you can use the following single command to install it.

[root@localhost ~]# yum install sysstat

Start sadc (system activity data collector) Services (sysstat), this report will be written to the log file "/ var / log / sa / saDD" and is already present in the document will be archived. DD is the current date.

[root@localhost ~]# systemctl start sysstat

[root@localhost ~]# systemctl enable sysstat

It was collected every 10 minutes and a data report is formed per day.

Use the sar command

sar command popular formats

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

among them:

t is sample separation, n is the sample number, the default value is 1;

-o file said it would command the result is stored in binary format in the file, file is the file name.

View CPU usage

sar -u: default cpu usage and other information display case is sar -u

View average load

sar -q: View average load

After you specify -q, you can see the number of the run queue process, the process on the system size, average load, etc.; compared with other commands, can see the situation of the indicators over time;

runq-sz: running queue length (the number of processes waiting to run)

The number of process list process (processes) and threads (threads) of: plist-sz

ldavg-1: last minute of system load average ldavg-5: average load of the system for 5 minutes

The average system load over the last 15 minutes: ldavg-15

Network traffic

sar -n DEV card

IFACE indicates the device name

Number rxpck / s packets received per second

Number txpck / s packets sent per second

Data amount rxKB / s per second receiving unit KByte 1KB = 1000byte = 8000bit

Data amount txKB / s emitted per second, the unit KByte

If the server packet loss is very serious, we need to see if the card is abnormal flow. Receiving data portion rxpck greater than 4000, or rxKB greater than 5000, there is likely to be attacked, normal LAN server traffic is not so big. Unless you copy the data.

Calculating the actual speed, taking the peak of txkb rxkb or, in terms of KB, such as a 686KByte, then 686 * 8/1000 = 5.4MBit

Bytes bytes, abbreviated to [B] is the smallest unit of computer hard disks

bit position, 1Byte = 8bit smallest unit [Network]

bps = bit per second bits per second

pps = package per second packet Mb per second, Gb, 10Gb

10Gb = 10000Mb [PC 1GB = 1024MB, network 1Gb = 1000Mb]

Broadband 10Mb, download speed is 1.25MB, 10Mb = 10Mbit 10Mbit / 8 = 1.25Mbyte = 1.25MB

View memory usage

sar -r: After you specify -r, can view the physical memory usage;

kbmemfree: The free and free command value in basically the same, so it does not include the space and the cache buffer.

kbmemused: The free command value used value in basically the same, so that it includes the cache and buffer space.

% Memused: physical memory usage, and this value is kbmemused total amount of memory (not including swap) a percentage.

kbbuffers and kbcached: these two values ​​is the free command buffer and cache.

kbcommit: the current system to ensure the required memory, i.e., the need to ensure that no overflow memory (RAM + swap).

% Commit: this value is a percentage of the total amount of memory kbcommit (including swap) of.

See page swapping outbreak situation

sar -W: see page swapping situation occurs

Exchange page occurs, the server throughput will be substantially reduced; when the poor state of the server, if the suspect because of insufficient memory caused by the occurrence of page swapping, you can use this command to confirm that a large number of exchange occurs;

pswpin / s: change into the system per page exchange (swap page) Number

pswpout / s: System swapped out per page exchange (swap page) Number

The integrated use of sar

To determine system bottlenecks, and sometimes take several sar command options to combine;

Suspected CPU bottlenecks, and the sar -q sar -u available to view, etc.

Suspect memory bottlenecks, available sar -B, sar -r and so on to see the sar -W

Suspected I / O bottlenecks, available sar -b, sar -u view and the like sar -d

Other sar Parameter Description

-A summary of all reports

-a report file read and write usage

-B report on the use of additional cache

-b report on the use of cache

Usage -c reporting system calls

-D reports disk usage

-g serial port usage report

-h reports statistics on the use of buffer

-m report IPC message queues and semaphores usage

-n name usage reports of cache

-p Report paging activity usage

-q exchange reports run queue and the average length of the queue

-R activities of the reporting process

-R report does not use memory pages and disk blocks

-u Report CPU utilization

-v reporting process, i nodes, files, and lock table state

-w Report system switching activity status

-y Report TTY device activity status

Guess you like

Origin blog.csdn.net/qfxulei/article/details/91580127