Common Performance analysis tools

Source: Internet
Author: User
Tags memory usage cpu usage

Recorded

Top

Column meaning

Vmstat

Procs

Memory

Swap

Io

System

Cpu

Uptime

Free

Iostat

Cpu

Device

Sar

Mpstat

Pmap

Netstat

Tcpdump

Strace

Lsof

Proc File system

Benchmark

Before Linux performance tuning, first need to understand the current service running state, find the program bottleneck, this need to use a series of Linux performance monitoring tools, the following common tools to do some summary.

Look at a map of the various tools, to understand the exact meaning of all the tools in this diagram, the Linux operating system, as well as the implementation of the kernel have a certain understanding, all the tools can be man specific use details.

Top

The top tool is a common tool for viewing process information, by default, the process display is sorted by CPU load, or it can be sorted by pid,time and memory utilization.

top-20:40:53 up 411 days, 2:55, 1 user, load average:2.75, 2.65, 2.43

tasks:233 Total, 1 running, 232 sleeping, 0 stopped, 0 zombie

Cpu (s): 19.9%us, 4.0%sy, 0.0%ni, 71.9%id, 2.7%wa, 0.0%hi, 1.5%si, 0.0%st

mem:8052640k Total, 8001296k used, 51344k free, 51668k buffers

swap:2104504k Total, 25832k used, 2078672k free, 6776596k cached

PID USER PR NI virt RES SHR S%cpu%mem time+ COMMAND

18161 mqq 0 3796m 1.7g 927m S 166 22.1 9171:12 Iphonepushservi

830 mqq 0 342m 199m 198m S 2.5 49542:15 Videorelay

1342 Admin 0 0 0 0 D 1 0.0 209:54.07 flush-8:0

32390 mqq 0 502m 5164 2524 S 1 0.1 162:26.01 Tafnode

16238 MQQ 0 5664 1320 876 R 0 0.0 0:00.02 Top

The lines have the following meanings:

First line: System Information

20:40:53: System Current time

Up 411 Day, 2:55: System has started time

1 User: Number of users currently logged in

Load average: Current machine load, three numbers are 1 minutes, 5 minutes, 15 minutes of load, the program every 5 seconds to check the number of active processes, and then according to a specific algorithm calculated values. If this number is divided by the number of logical CPUs, the result is higher than 5, indicating that the system is overloaded.

Second line: Process information

In turn, the total number, the number of running processes, the number of sleep processes, the number of stop processes, and zombie processes

Third line: CPU information

US: Percentage of CPU consumed by user space

Sy: Percentage of CPU consumed by kernel space

NI: Percentage of CPU per process that has changed priority

ID: Free CPU percent

Wa:io% of CPU waiting to be consumed

Hi: Hard Interrupt (Hardware IRQ) Percentage of CPU usage

Si: Soft interrupt (Software interrupts)% of CPU usage

Line four: Memory information

Total: Overall memory size

Used: Memory size is already used

Free: Idle memory size

Buffers: Cache memory Size

Line five: Exchange area information

Total: Overall swap area size

Used: Swap area size already used

Free: Idle swap area size

cached:cached Cache Size

Column meaning

The columns have the following meanings:

PID: Process ID

User: Created by

PRI: Process Priority

Ni:nick level, negative value indicates high priority

Virt: Total virtual memory used by the process, in kilobytes (Virt=swap+res)

RES: The amount of physical memory used by the process, not swapped out in kilobytes (Res=code+data)

SHR: Shared memory size, per kb

S: Process status. d= non-disruptive sleep state r= run s= sleep t= trace/stop z= zombie Process

%cpu: Percentage of CPU time last updated to now

%mem: Percent of physical memory used by the process

Time+: Total CPU time used by the process, in units 1/100 seconds

COMMAND: Process Name

In addition, press 1 to display each CPU condition, top-h can display each thread condition.

Vmstat

Vmstat can view the process, memory, paging, IO and CPU information, perform Vmstat 2 (2 seconds), the output is as follows:

procs-----------Memory-------------Swap-------io-----system-------CPU------

R b swpd free buff cache si so bi bo in CS us sy ID WA St

4 0 25832 50440 52928 6841116 0 0 125 192 0 0 6 2 91 0-0

2 0 25832 50440 52932 6839432 0 0 0 0 48744 61153 19 6 76 0-0

2 0 25832 53176 52944 6836144 0 0 0 370 48132 63201 19 6 75 0-0

2 0 25832 52184 52952 6836428 0 0 0 30 48525 63944 19 5 75 0-0

Note: The first row of data shows the average load that the system has had since it was last started and needs to be excluded.

Procs

R: Number of processes waiting to be executed (shows the number of processes that the CPU is executing and waiting for CPU resources, which is larger than the number of CPUs and may have CPU performance bottlenecks)

B: Number of processes waiting for IO

Memory

SWPD: Virtual memory size in use

Free: Idle memory size

Buff: Buff size used, buffering read and write to block devices

Cache: Cached Cache size for file system

Swap

Si: The size of memory written per second from the Swap area (KB/S)

So: the size of each second written from memory to the swap area

Io

BI: Number of blocks read per second (read disk)

Bo: Number of blocks written per second (write disk)

System

In: Number of interrupts per second, including clock interrupts

CS: Number of context switches per second

Cpu

meaning See top-cpu information

Uptime

See top first line: System Information

Free

The free command primarily looks at memory usage:

Total used free shared buffers Cached

mem:8052640 8000400 52240 0 52872 6853252

-/+ buffers/cache:1094276 6958364

swap:2104504 25832 2078672

Second line meaning:

Total: Overall physical memory size

Used: Memory size used (including system cache)

Free: Idle memory size

Shared: Memory size shared by multiple processes

Buffers:buffer size (block device cache)

Cached:cache size (file system cache)

Third line:

Used/free: Used memory size and free memory size, the same as the second row of the same field is subtracted from the buffer and Cache,buffer and cache from the operating system is already used memory, but when the system is not available memory, The operating system releases buffer and cache, and this part of memory is available to the process.

Line four: Reference top

Iostat

This command user output CPU and disk IO-related statistics, the default output is not the parameters of the system after the start of the current statistics, generally when the system started very long time, does not have much reference significance:

Linux 2.6.32.43-tlinux-1.0.8-state (10_135_11_35_KQQ) 01/13/2015 _x86_64_

AVG-CPU:%user%nice%system%iowait%steal%idle

5.64 0.49 2.84 0.41 0.00 91.20

Device:tps blk_read/s blk_wrtn/s Blk_read Blk_wrtn

SDA 25.64 2006.79 3075.79 71288307775 109262888974

SDA1 0.99 14.09 5.05 500582972 179528792

Sda2 0.00 0.00 0.00 13182 142936

Sda3 3.54 25.77 80.34 915263981 2853850978

SDA4 21.11 1966.93 2990.39 69872425096 106229366268

The field meaning is as follows:

Cpu

%user: Percentage of CPU used to run at user level

Percentage of CPU used by the%nice:nice operation

%sys: Percentage of CPU used at System level (kernel)

When%IOWAIT:CPU waits for hardware I/O,

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.