Linux command-line tools for Java Performance Tuning tools

Source: Internet
Author: User
Tags disk usage

1.top command

The top command shows the resource usage of each process in the system in real time. Use the top command output as follows:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8E/A0/wKiom1jHVJLgHSbjAACsB_s6xy0204.png "title=" _ 20170314102504.png "alt=" Wkiom1jhvjlghsbjaacsb_s6xy0204.png "/>

The first half is statistical information, and the latter part is the process information.

In the statistical information:

First line: Task queue: <=>uptime command. Left-to-right: System current time, system run time, number of currently logged on users. Load average: The average load on the system, that is, the average length of the task queue, 3 values, respectively: 1 minutes, 5 minutes, 15 minutes to the current average.

Second line: Process statistics: Left-to-right: number of processes running, number of sleep processes, number of processes stopped, number of zombie processes.

Third line: CPU statistics,

US: User space CPU usage,

SY: Kernel Space CPU usage,

NI: User process space has changed the priority of process CPU utilization,

ID: Idle CPU usage,

WA: Percentage of CPU time waiting for input and output,

Hi: Hardware interrupt request,

SI: Software interrupt request.

Line four: Left-to-right: total memory, used memory, free memory, kernel buffering.

Line five: Total swap area, swap area used, size of free swap area, buffer swap area

The second part

Pr= Priority: Precedence

ni= nice value: Negative priority > Positive priority

virt= Virtual Image (KB): The total amount of VM memory used by the process, in kilobytes. Virt=swap+res

Res= resident Size (KB): The amount of physical memory that the process uses, not swapped out, in kilobytes

Shr= shared Mem Size (KB): Shared memory sizes, in kilobytes

s= process Status: Progress State, D: Non-disruptive sleep state, R: Run, T: Trace/Stop, Z: Zombie Process

time+= CPU time, hundredths: total CPU times used by the process, units 1/100 seconds

command= command name/line: Name or command line

Information that may also appear (the top command can be selected by pressing the F key)

PPID = Parent Process Pid

Ruser = Real User Name

UID = User Id

Groups = Group Name: Name of all process participants

TTY = controlling TTY: The terminal name of the startup process, not the process starting from the terminal is displayed as 2

P = Last used CPU (SMP): Finally used CPU, only meaningful in the case of multiple CPUs

Swap = swapped size (KB): The amount swapped out in the virtual memory used by the process

Time = CPU timing: Total CPU times used by the process, in seconds

Code = code Size (KB): Executable codes occupy physical memory size

data = Data+stack Size (KB): A portion of the executable code (data segment + stack) occupies physical memory size

Nflt = page Fault count: Page error count

NDRT = Dirty pages Count: Last written to now, number of pages modified

Wchan = sleeping in Function: Displays the name of the system function in sleep if the process is dormant

Flags = task flags <SCHED.H>: Task flag

2.sar command

SAR [Options][<interval>[<count>]]

Interval: Sample period, Count: number of samples,

Options

-A: Sum of all reports;-u:cpu utilization;

-D: Hard disk usage report;-b:i/o situation;

-Q: View queue Length;-r: Memory usage statistics;

-N: Network information statistics;-o: Sample results are output to a file.

sar-u 1 3, sampled once per second, sampled 3 times, the last row output average, output such as;

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8E/A3/wKioL1jHm8eDeb5uAAAj6KaU8Pg622.png "title=" _ 20170314152847.png "alt=" Wkiol1jhm8edeb5uaaaj6kau8pg622.png "/>

3.vmstat

View memory, interactive partitioning, I/O operations, context switches, clock interrupts, CPU usage.

Vmstat interval Count-------------vmstat 1 3 output is as follows

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8E/A3/wKioL1jHnKDRPz4LAAAdngGT7IQ376.png "title=" _ 20170314153231.png "alt=" Wkiol1jhnkdrpz4laaadnggt7iq376.png "/>

Procs:

R: Number of processes waiting to run;

B: Process state in non-sleep state.

Memory

SWPD: Virtual memory usage, unit KB;

Free: idle memory, KB;

Buff: As the number of cache memory, KB.

Swap

Si: Number of swap pages from disk swap to memory, in kb/seconds

So: number of swap pages from memory swap to disk, in kb/seconds

Io:

BI: Number of blocks sent to block device, units: Blocks/sec

Bo: Number of blocks received from a block device, units: Blocks/sec

System:

In: Number of interrupts per second, including clock interrupts

CS: Number of context switches per second

Cpu:

US: User CPU Usage time

SY: Kernel CPU System usage time

ID: Idle Time

4.iostat

Iostat [-c] [-d] [-h] [-n] [-K |-m] [-t] [-v] [-X] [-z] [device [...] | ALL] [-p [device [,...] | all] [interval [count]]

Iostat-d-K 2

The parameter-D indicates that the device (disk) usage status is displayed; k Some columns that use block are forced to use kilobytes, and 2 indicates that the data appears refreshed every 2 seconds.

The output is as follows

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8E/A3/wKioL1jHor-yE_G9AAAf_1xRDDc204.png "title=" _ 20170314155837.png "alt=" Wkiol1jhor-ye_g9aaaf_1xrddc204.png "/>

TPS: The number of transmissions per second of the device (indicate, transfers per second, were issued to the.). "One transfer" is the "one-time I/O request". Multiple logical requests may be merged into "one I/O request". The size of the "one transfer" request is unknown.

KB_READ/S: The amount of data read from the device (drive expressed) per second;

KB_WRTN/S: The amount of data written to the device (drive expressed) per second;

Kb_read: The total amount of data read;

KB_WRTN: The total amount of data written, these units are in kilobytes.

iostat-x 1 2 output is as follows

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8E/A3/wKioL1jHpafzTcmnAABNJ0xQzLY931.png "title=" _ 20170314161101.png "width=" 740 "height=" 216 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:740px;height:216px; "alt=" Wkiol1jhpafztcmnaabnj0xqzly931.png "/>

RRQM/S: How much of this device-dependent read request is merge per second (when the system call needs to read the data, the VFS sends the request to each FS, and if FS finds that different read requests read the same block data, FS will merge the request);

WRQM/S: How much of this device-related write request is being merge per second.

RSEC/S: Number of sectors read per second;

WSEC/S: Number of sectors written per second.

RKB/S: The average amount of data per second that is requested to read data to the device.

WKB/S: The average amount of data per second that is requested to write to the device.

Avgrq-sz: The size of the average request sector

Avgqu-sz: Is the length of the average request queue. The shorter the queue length, the better.

Await: The average time (in milliseconds) that each IO request is processed. Can be understood as the response time of the IO, generally the system IO response time should be less than 5ms, if greater than 10ms is relatively large.

This time includes the queue time and service time, that is, in general, await is greater than SVCTM, their difference is smaller, then the shorter the queue time, conversely, the greater the difference, the longer the queue time, indicating that the system has a problem.

SVCTM: Represents the average service time (in milliseconds) for each device I/O operation. If the value of SVCTM is close to await, indicating that there is little I/O waiting, disk performance is good, and if the value of await is much higher than the value of SVCTM, the I/O queue waits too long for the applications running on the system to become slower.

%util: All processing io time, divided by total statistic time, in the statistical time. For example, if the statistic interval is 1 seconds, the device has 0.8 seconds to process Io, and 0.2 seconds is idle, then the device's%util = 0.8/1 = 80%, so this parameter implies the device's busy level. Generally, if this parameter is 100% indicates that the device is already running close to full load (of course if it is a multi-disk, even if%util is 100% because of the concurrency of the disk, disk usage may not be the bottleneck).

Common usage

Iostat-d-K 1 #查看TPS和吞吐量信息 (disk read-write speed in kilobytes)

Iostat-d-M 2 #查看TPS和吞吐量信息 (MB per disk read and write speed)

iostat-d-x-k 1 #查看设备使用率 (%util), Response time (await)

Iostat-c 1 #查看cpu状态

5.pidstat Tools

Use: Pidstat [options] [<interval> [<count>]]

Options are:

[-C <command>] [-d] [-h] [-I.] [-l] [-R] [-T] [-u] [-V] [-W]

[-p {<pid> [,...] | Self | All}] [-t {TASK | Child | All}]


Case LIST:

pidstat-u <=>pidstat output CPU usage for all processes to view CPU information for a process

JPS (get PID)--pidstat-p pid-u 1 3 output is as follows
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/8E/AB/wKiom1jIqnTC59zoAAAVqa8CG2s023.png "title=" _ 20170315104323.png "alt=" Wkiom1jiqntc59zoaaavqa8cg2s023.png "/>

pidstat-p pid 1 3-u-t to output thread information

Pidstat [-P PID]-D [-t] 1 3 display disk information

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8E/AC/wKioL1jI34HiXnjTAABD9DYExiM161.png "title=" _ 20170315142953.png "alt=" Wkiol1ji34hixnjtaabd9dyexim161.png "/>

TID: Thread ID

KB_RD/S: The amount of data (in kilobytes) that the process reads from disk per second

KB_WR/S: The amount of data (in kilobytes) that the process writes to disk per second

KB_CCWR/S: The number of disk writes per second that the process is canceling (in kilobytes)

Command: Pull up the commands corresponding to the process

Pidstat [-P PID]-R [-T] 1 3 display memory information

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8E/AC/wKioL1jI4LPRFg3WAAAVeqTOCp8268.png "title=" _ 20170315143457.png "alt=" Wkiol1ji4lprfg3waaaveqtocp8268.png "/>

MINFLT/S: The total number of minor page faults (no paging of memory pages from disk) per second for this process

MAJFLT/S: The total number of major page faults (memory pages that need to be paged out of disk) per second for this process

VSZ: Virtual memory (in kilobytes) used by the process

RSS: The amount of physical memory used by the process (in kilobytes)

%MEM: Percentage of memory used by the process

Command: Pull up the commands corresponding to the process


This article is from the "10543553" blog, please be sure to keep this source http://10553553.blog.51cto.com/10543553/1907029

Linux command-line tools for Java Performance Tuning tools

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.