Linux Common Performance Analysis commands

Source: Internet
Author: User

Performance analysis

Vmstat

Virtual Memory Statistics

Usage

Usage:

Vmstat [Options] [delay [count]]

Options:

-A,--active active/inactive memory

-F,--forks number of forks since boot

-M,--slabs Slabinfo

-N,--one-header do not redisplay header

-S,--stats event counter statistics

-D,--disk disk statistics

-D,--disk-sum summarize disk statistics

-P,--partition <dev> partition specific statistics

-S,--unit <char> define display unit

-W,--wide wide output

-T,--timestamp show timestamp

-H,--help display this help and exit

-V,--version output version information and exit

Example

[Email protected] ~]# Vmstat

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

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

0 0 71256 92720 0 565120 0 0 1 115 22 36 1 0 99 0 0

which

  • R: Number of processes running and waiting for CPU time slices. If the value is greater than the number of system CPUs, the CPU is low

  • B: Number of processes that are waiting for resources

  • SWPD: Memory size to switch to memory swap (in kilobytes)

  • Free: The size of the spare physical memory, my machine memory total 2G, the remaining 92M.

  • Buff:linux/unix system is used to store, what content in the directory, permissions and other caches

  • Cache: Directly used to remember our open files, buffer the files, the free part of the physical memory to do the file and directory cache, is to improve the performance of the program execution, when the program uses memory, buffer/cached will be used quickly

  • Si: The size of the virtual memory read from disk per second, if the value is greater than 0, indicates that the physical memory is not enough or memory leaks, to find the consumption of memory process resolved.

  • So: the size of virtual memory written to disk per second, if this value is greater than 0, ibid.

  • BI: Number of blocks received per second by block devices (read disk) (KB/S)

  • Bo: Number of blocks sent per second by block device (write disk) (KB/S)

  • In: Number of CPU interrupts per second, including time interrupts

  • CS: The number of context switches per second.

  • US: Percentage of CPU time consumed by user processes

  • SY: Kernel processes consume a percentage of CPU time, and when the value of SY is higher, it means that the kernel consumes a lot of CPU resources

  • ID: Percentage of idle CPU time

  • Wt:io% waiting CPU time

Free

Memory usage Status

[[email protected] ~]# free

Total used free shared buff/cache available

mem:1849336 1193336 90344 1752 565656 460000

swap:2097148 71248 2025900

[Email protected] ~]# free-h

Total used free shared buff/cache available

mem:1.8g 1.1G 88M 1.7M 552M 449M

swap:2.0g 69M 1.9G

[Email protected] ~]# free-m

Total used free shared buff/cache available

mem:1805 1165 88 1 552 449

swap:2047 69 1978

[Email protected] ~]# Free-h 2

Total used free shared buff/cache available

mem:1.8g 1.1G 88M 1.7M 552M 449M

swap:2.0g 69M 1.9G

[[email protected] ~]# Free-h-S 2

Total used free shared buff/cache available

mem:1.8g 1.1G 88M 1.7M 552M 449M

swap:2.0g 69M 1.9G

Total used free shared buff/cache available

mem:1.8g 1.1G 88M 1.7M 552M 449M

swap:2.0g 69M 1.9G

Total used free shared buff/cache available

mem:1.8g 1.1G 88M 1.7M 552M 449M

swap:2.0g 69M 1.9G

Uptime

Statistics of current system operation

[Email protected] ~]# uptime

09:59:55 up 2 days, 7 min, 1 user, load average:0.00, 0.01, 0.05

Load average: System 1 minutes, 5 minutes, average load of 15 minutes

Netstat

Current Network information

Usage

Usage:netstat [-VWEENNCCF] [<af>]-R netstat {-v|--version|-h|--help}

netstat [-vwnncaeol] [<socket> ...]

netstat {[-vweennac]-i[<iface>] | [-veennac]-I. | [-cnne]-M | -S [ -6TUW]} [delay]

-R,--route display routing table

-I,--interfaces=<iface> display interface table for <Iface>

-I,--interfaces display interface table

-G,--groups display multicast group memberships

-S,--statistics display networking statistics (like SNMP)

-M,--masquerade display masqueraded connections

-V,--verbose be verbose

-W,--wide don ' t truncate IP addresses

-N,--numeric don ' t resolve names

--numeric-hosts don ' t resolve host names

--numeric-ports don ' t resolve port names

--numeric-users don ' t resolve user names

-N,--symbolic resolve hardware names

-E,--extend display other/more information

-P,--programs display Pid/program name for sockets

-O,--timers display timers

-C,--continuous continuous listing

-L,--listening display listening server sockets

-A,--all display all sockets (default:connected)

-F,--FIB display Forwarding information Base (default)

-C,--cache display routing cache instead of FIB

-Z,--context display SELinux security context for sockets

<SOCKET>={-T|--TCP} {-u|--udp} {-u|--udplite} {-w|--raw} {-x|--unix}

--ax25--ipx--netrom

<af>=use ' -6|-4 ' or '-A <af> ' or '--<af> '; Default:inet

List of possible address families (which support routing):

inet (DARPA Internet) Inet6 (IPV6) ax25 (Ampr ax.25)

Netrom (AMPR Net/rom) IPX (Novell IPX) DDP (Appletalk DDP)

X25 (CCITT x.)

which

    • -A (All) displays all options and does not show listen related by default

    • -T (TCP) displays only TCP-related options

    • -U (UDP) displays only UDP-related options

    • -N refuses to display aliases, showing all numbers converted to numbers

    • -l list only service status in Listen (listening)

    • -P Displays the program name that establishes the associated link

    • -R display routing information, routing table

    • -e display extended information, such as UID, etc.

    • -S statistics according to each protocol

    • -C executes the netstat command every other fixed time.

Hint: The status of listen and listening can only be seen with-a or-l

Top

[email protected] java_demos]# Top

Top-14:36:14 up 2 days, 4:43, 1 user, load average:0.00, 0.01, 0.05

tasks:110 Total, 2 running, 108 sleeping, 0 stopped, 0 zombie

%CPU (s): 0.3 us, 0.2 sy, 0.0 ni, 99.3 ID, 0.2 wa, 0.0 hi, 0.0 si, 0.0th

KiB mem:1849336 Total, 963348 free, 542372 used, 343616 Buff/cache

KiB swap:2097148 Total, 2011496 free, 85652 used. 1126908 Avail Mem

PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND

1858 MySQL 0 1465504 200800 6212 S 1.0 10.9 34:56.46 mysqld

1 root 0 56636 4308 2808 S 0.0 0.2 0:02.05 systemd

2 Root 0 0 0 0 S 0.0 0.0 0:00.04 Kthreadd

3 Root 0 0 0 0 S 0.0 0.0 0:01.53 ksoftirqd/0

5 root 0-20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0h

7 Root RT 0 0 0 0 S 0.0 0.0 0:00.07 migration/0

8 Root 0 0 0 0 S 0.0 0.0 0:00.00 RCU_BH

9 Root 0 0 0 0 S 0.0 0.0 0:00.00 rcuob/0

Root 0 0 0 0 S 0.0 0.0 0:00.00 RCUOB/1

Root 0 0 0 0 S 0.0 0.0 0:00.00 RCUOB/2

Root 0 0 0 0 S 0.0 0.0 0:00.00 RCUOB/3

Root 0 0 0 0 S 0.0 0.0 0:14.63 rcu_sched

Root 0 0 0 0 S 0.0 0.0 0:10.43 rcuos/0

Root 0 0 0 0 S 0.0 0.0 0:04.67 RCUOS/1

which

First line:

    • 14:36:14 Current system time

    • Days, 4:43 the system has been running for 2 day, 4 hours, 43 minutes (not restarted during this period)

    • 1 users currently have 1 user login systems

    • Load average:0.00, 0.01, 0.05, followed by three numbers are 1-minute, 5-minute, and 15-minute loads. The load average data is the number of active processes that are checked every 5 seconds and then calculated by a particular algorithm. If this number is divided by the number of logical CPUs, the result above 5 indicates that the system is overloaded.

Second Line: Tasks task (process),

    • The system now has 10 processes, of which there are 2 running, 108 in hibernation (sleep), 0 in the stoped state, and 0 in the zombie State (zombie).

Third line: CPU status

    • Percent of CPU occupied by US user space

    • SY kernel space% CPU occupied

    • NI has changed the priority of the process to occupy the percentage of CPU

    • ID Idle CPU percent

    • WA io waits a percentage of CPU usage

    • Hi Hard Interrupt (Hardware IRQ)% of CPU occupied

    • Si soft interrupt (software interrupts)% of CPU occupied

Line four: Memory status

    • Total Physical Memory

    • Total Free Memory

    • Used amount of memory in use

    • Buff/cache The amount of memory cached

Line five: Swap swap partition

    • Total Swap Area

    • Total Free Swap Area

    • Total swap area used by used

    • Avail Mem buffer Swap area total

Line six: status monitoring of each process (Task)

    • PID Process ID

    • USER Process Owner

    • PR Process Priority

    • NI nice value. Negative values indicate high priority, positive values indicate low priority

    • The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res

    • The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data

    • SHR shared memory size, in kilobytes

    • S process state. d= non-disruptive sleep status r= run s= sleep t= track/stop z= zombie Process

    • %cpu percentage of CPU time that was last updated to current

    • Percentage of physical memory used by the%MEM process

    • Total CPU time used by the time+ process, Unit 1/100 sec

    • Command process name (commands name/command line)

To Monitor the number of Java threads :

Ps-elf grep java wc-l

Monitor network client connections:

netstat-n grep tcp grep listening port wc-l

Linux Common Performance Analysis commands

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.