Recently saw a Daniel's analysis report, just know how superficial I understand the 4 commands, in fact, to read the memory of the information, is to some skill.
1. Top
VIRT Total virtual memory, Virt=swap+res
Swap-out size in virtual memory used by swaps
The amount of physical memory that has not been swapped out for the RES process
SHR shared memory size, in kilobytes
S Process State
Percentage of physical memory used by the%MEM process
%cpu CPU time consumption percentage
MEM:191272K Total Physical Memory
Total physical memory used by 173656k used
17616k free Memory Total
The amount of memory that 22052k buffers uses as the kernel cache
Total swap area of swap:192772k
Total swap area used by 0k used
192772k Free Swap Area total
123988k cached Buffers The total number of swap areas. The in-memory content is swapped out to the swap area and then swapped in to memory, but the used swap area has not been overwritten, which is the size of the swap area where the content already exists in memory. When the corresponding memory is swapped out again, it is no longer necessary to write to the swap area.
2. Free
Main focus Values
Mem Physical Memory statistics
Total physical memory.
Used total allocated to the cache (contains buffers and cache) used by the number
Free Memory Not allocated
GKFX Shared Memory
Buffers the number of buffers that the system allocates but not used, one of the two main cache modes for disk block reads and writes:
Cached system allocated but unused cache number, one of two main cache modes, for file inode read and write
-/+buffers/cached cache statistics for physical memory
Used (first-line mem value) used-buffers-cached, total amount of memory actually used by the system
Free (first line mem value) buffers + cached, system currently available memory
Mem is analyzed from the operating system level, buffers cached is allocated (used) memory
-/+ buffers/cached analysis from the application level, buffers cached can be used at any time, and is preferred
Usage of Swap swap partition
3, Vmstat
R indicates that a CPU bottleneck occurs when the queue is running and the value exceeds the number of CPUs.
b Represents a blocked process
SWPD virtual memory used size, if greater than 0, indicates insufficient physical memory, note program memory leaks
Free Physical Memory size
Buff
The cache directly remembers the open files, buffers the files, Linux/unix 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 reads the size of virtual memory from disk in seconds, with a value greater than 0, indicating insufficient physical memory or memory leaks
The size of virtual memory written to disk per second, with a value greater than 0, indicates insufficient physical memory or memory leaks www.it165.net
Number of blocks received by BI block devices per second
Number of blocks sent by Bo block devices per second
In CPU interrupts per second, including time interrupts
CS per second, such as the number of context switches, such as we call the system function, the context switch, the thread of the switch, but also the process context switch, the smaller the value of the better, too big, to consider the number of threads or processes, such as Apache and Nginx in the Web server, We generally do performance testing will carry out thousands of concurrent or even tens of thousands of concurrent tests, the selection of the Web server process can be the process or the peak of the thread has been down, pressure measurement, until CS to a relatively small value, the process and the number of threads is a more appropriate value. System calls are also, each time the system function is called, our code will enter the kernel space, resulting in context switching, this is very resource-intensive, but also try to avoid frequent calls to system functions. Too many context switches means that most of your CPU is wasted in context switching, resulting in less time on the CPU to do serious work, and CPU underutilized, which is undesirable
US User CPU Time
SY system CPU time, if too high, indicates a long system call time, for example, the IO operation is frequent
ID Idle CPU Time
WT Wait IOCPU time
4, Iostat
Basic use:
Iostat [-c] [-d] [-n] [-n] [-h] [-K |-m] [-t] [-v] [-X] [-z] [device [...] | ALL] [-p [device [,...] | ALL] [Inter-val [Count]]
[-c]: Output CPU statistics
[-d]: Output disk Statistics Note: The default is two outputs
[-n]: Output IO information according to device Mapper, which is what we often call LVM
[-n]: Output IO information based on network file system (NFS) (Kernel version> 2.6.17)
[-h]: Better readability of NFS statistics
[-K |-m]: replace original block/s with kb/s|mb/s
[-T]: print time to collect information at the moment Note: Time printing format and system variable S_time_format related
[-V]: version information
[-X]: Output Expansion Statistics NOTE: summary below
[-z]: RESET disk input/output information
[Device [...] | ALL]: Device list
[-P [device[...]| ALL]]: Device list, but this will output the IO information of the sub-device. such as SDB, it will even sdb1, SDB2 and so on the partition information output together
[Inter-val [Count]]:inter-val is the statistical time interval unit is S,count is the number of statistics
Interpretation of output information:
Basic CPU Output information:
%user: Percentage of CPU consumed by the user process
%nice: User process priority tuning CPU usage
% SYS: CPU scale consumed by the system kernel
%iowait: CPU consumption for disk IO
%idle: Percentage of idle CPUs (not including s that wait for disk IO)
Basic device output information:
Device: Name
Tps: Number of IO transmissions per second (possibly multiple IO) on the device
blk_read/s: reads blocks per second from the device (kernel 2.4 or more, block= 512byte) Number of
BLK_WRTN/S: Writes per second to the number of device blocks (kernel 2.4, block=512byte)
Blk_read: The total number of blocks read from the device during the interval
Blk_wrtn: The total number of blocks written to the device during the time interval
Note: Activating the-K|-M option will change to kb_* or mb_*
The
-x option expands the output information:
rrqm/s: Number of read operations per second for merge (multiple IO merges)
wrqm/s: Number of write operations per second for merge (multiple IO merges)
R/S: Number of Read IO devices completed per second
W/S: Number of Write IO devices completed per second
RSEC/S: Number of Read sectors per second
WSEC/S: Number of Write sectors per second note: Activation-k|-m will become rkb/s wkb/s | rmb/s wmb/s
Avgrq-sz: Average per IO device size (in sectors) because the merge reads or writes, so each IO size needs to be calculated
Avgqu-sz: Average I/O Queue Length
Await: The wait time for each IO device, including IO service time (milliseconds). The size of the
await typically depends on the service time (SVCTM) and the length of the I/O queue and the emit mode of the I/O request.