Linux command-line tools for Java Performance Tuning tools

Source: Internet
Author: User
Tags switches 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/1907026

Linux command-line tools for the Java Performance Tuning tool

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.