티스토리 뷰

엔지니어링

vmstata로 부하 체크

warpmemory 2020. 3. 6. 20:54

vmstat

가상 메모리 상태를 리포트한다.

사용방법

vmstat [-a] [-n] [delay [ count]]
vmstat [-f] [-s] [-m]
vmstat [-S unit]
vmstat [-d]
vmstat [-p disk partition]
vmstat [-V]
옵션 설명
-a 메모리의 buff/cache 정보 대신 active/inactive 메모리 정보를 리포팅
-f 부팅된 이후로 fork 된 프로세스의 토탈 값을 리포팅
-m slabinfo 리포팅(비교 : cat /proc/slabinfo)
-s 이벤트 카운터 와 메모리 정보 리포팅
-d 디스크 상태 리포팅
-p [파티션이름] 파티션 상태 리포팅
-S [단위] 리포팅 결과를 단위 별로 출력(k=1000, K=1024, m=1000000, M=1048576)
-V 버젼 정보 확인

로드 확인

가상 메모리 정보 확인

# vmstat -S M 1 10
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0     65    146     22  14854    0    0   154    58    1    1  3  4 91  2  0
 1  0     65    140     22  14854    0    0   168   904  549 2133  9 11 76  4  0
 3  0     65    151     22  14855    0    0  1216    56  438  634  5  9 83  4  0
 1  0     65    150     22  14857    0    0  2088     0  426  692  4  9 83  3  0
 1  1     65    160     22  14857    0    0     4  5132  790 1174  7  9 76  8  0
 2  2     65    160     22  14857    0    0     0  3980  873  203  4  9 74 13  0
 1  0     65    155     22  14857    0    0    40  2064  775 2344  7 11 76  6  0
 1  0     65    163     22  14857    0    0     0     0  269  146  4  9 87  0  0
 1  0     65    163     22  14857    0    0     0   208  331  208  4  8 87  0  0
 1  0     65    154     22  14857    0    0     4  1004  568 1387  8  8 83  1  0

가상 메모리 정보를 1초 단위로 10개의 리포팅 결과를 Mb단위로 리포팅

변화량을 보면서 시스템의 로드 상태를 한눈에 파악할 수 있다.

필드 상세
Procs r: The number of processes waiting for run time.
b: The number of processes in uninterruptible sleep.
Memory swpd: the amount of virtual memory used.
free: the amount of idle memory.
buff: the amount of memory used as buffers.
cache: the amount of memory used as cache.
inact: the amount of inactive memory. (-a option)
active: the amount of active memory. (-a option)

Swap si: Amount of memory swapped in from disk (/s).
so: Amount of memory swapped to disk (/s).

IO bi: Blocks received from a block device (blocks/s).
bo: Blocks sent to a block device (blocks/s).

System in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.

CPU These are percentages of total CPU time.
us: Time spent running non-kernel code. (user time, including nice time)
sy: Time spent running kernel code. (system time)
id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

디스크 정보 확인

# vmstat -d 10 2
disk- ------------reads------------ ------------writes----------- -----IO------
       total merged sectors      ms  total merged sectors      ms    cur    sec
ram0       0      0       0       0      0      0       0       0      0      0
ram1       0      0       0       0      0      0       0       0      0      0
ram2       0      0       0       0      0      0       0       0      0      0
ram3       0      0       0       0      0      0       0       0      0      0
ram4       0      0       0       0      0      0       0       0      0      0
ram5       0      0       0       0      0      0       0       0      0      0
ram6       0      0       0       0      0      0       0       0      0      0
ram7       0      0       0       0      0      0       0       0      0      0
ram8       0      0       0       0      0      0       0       0      0      0
ram9       0      0       0       0      0      0       0       0      0      0
ram10      0      0       0       0      0      0       0       0      0      0
ram11      0      0       0       0      0      0       0       0      0      0
ram12      0      0       0       0      0      0       0       0      0      0
ram13      0      0       0       0      0      0       0       0      0      0
ram14      0      0       0       0      0      0       0       0      0      0
ram15      0      0       0       0      0      0       0       0      0      0
sda   177384304 14686897 5604656144 601391488 65158669 143528504 1683865154 1665986380      0 326591
sdb   105722566  21960 846104872 54900932 1658625 90066001 733797956 171918508      0  57350
md0        0      0       0       0      0      0       0       0      0      0
ram0       0      0       0       0      0      0       0       0      0      0
ram1       0      0       0       0      0      0       0       0      0      0
ram2       0      0       0       0      0      0       0       0      0      0
ram3       0      0       0       0      0      0       0       0      0      0
ram4       0      0       0       0      0      0       0       0      0      0
ram5       0      0       0       0      0      0       0       0      0      0
ram6       0      0       0       0      0      0       0       0      0      0
ram7       0      0       0       0      0      0       0       0      0      0
ram8       0      0       0       0      0      0       0       0      0      0
ram9       0      0       0       0      0      0       0       0      0      0
ram10      0      0       0       0      0      0       0       0      0      0
ram11      0      0       0       0      0      0       0       0      0      0
ram12      0      0       0       0      0      0       0       0      0      0
ram13      0      0       0       0      0      0       0       0      0      0
ram14      0      0       0       0      0      0       0       0      0      0
ram15      0      0       0       0      0      0       0       0      0      0
sda   177384368 14686933 5604657864 601391884 65158730 143528545 1683865970 1665986500      0 326591
sdb   105722566  21960 846104872 54900932 1658625 90066001 733797956 171918508      0  57350
md0        0      0       0       0      0      0       0       0      0      0

디스크 정보를 10초 단위로 2개의 리포팅 결과를 출력

10초 동안 사용 디스크에 reads/writes 된 양을 측정할 수 있다.

필드 상세
Reads total: Total reads completed successfully
merged: grouped reads (resulting in one I/O)
sectors: Sectors read successfully
ms: milliseconds spent reading
Writes total: Total writes completed successfully
merged: grouped writes (resulting in one I/O)
sectors: Sectors written successfully
ms: milliseconds spent writing
IO cur: I/O in progress
s: seconds spent for I/O

파티션 정보 확인

# vmstat -p sda7
sda7          reads   read sectors  writes    requested writes
            98051551 1003789066   20893244  167145864
필드 상세
reads Total number of reads issued to this partition
read sectors Total read sectors for partition
writes Total number of writes issued to this partition
requested writes Total number of write requests made for partition

카운트 정보 확인

# vmstat -s      
     16418312  total memory
     16246136  used memory
     15519640  active memory
       380740  inactive memory
       172176  free memory
        29516  buffer memory
     15369956  swap cache
      1959920  total swap
        66792  used swap
      1893128  free swap
     72643998 non-nice user cpu ticks
           85 nice user cpu ticks
     75778486 system cpu ticks
   1894720309 idle cpu ticks
     45473199 IO-wait cpu ticks
       669631 IRQ cpu ticks
      4294355 softirq cpu ticks
            0 stolen cpu ticks
   3224661344 pages paged in
   1208764319 pages paged out
         5131 pages swapped in
        20275 pages swapped out
   1358027128 interrupts
   3451127912 CPU context switches
   1341349230 boot time
     98464178 forks

메모리와 cpu 정보뿐 아니라, 페이지 정보와 부팅 후 포크 된 프로세스 개수, 인터럽트 및 context switche 된 개수 등을 정보 등을 확인할 수 있다.

슬랩 정보 확인

# vmstat -m          
Cache                       Num  Total   Size  Pages
fib6_nodes                    5     59     64     59
ip6_dst_cache                 4     12    320     12
ndisc_cache                   1     12    320     12
RAWv6                        11     14   1088      7
UDPLITEv6                     0      0   1088      7
UDPv6                         0      0   1088      7
tw_sock_TCPv6                 0      0    192     20
request_sock_TCPv6            0      0    192     20
TCPv6                         4      6   1920      2
ip_fib_alias                 10     59     64     59
ip_fib_hash                  10     59     64     59
dm_mpath_io                   0      0     40     92
dm_target_io                  0      0     24    144
dm_io                         0      0     40     92
scsi_cmd_cache              133    150    384     10
sgpool-128                    2      2   4096      1
sgpool-64                     3      4   2048      2
sgpool-32                     2      4   1024      4
sgpool-16                    28     48    512      8
sgpool-8                    213    285    256     15
scsi_io_context               0      0    112     34
ext3_inode_cache          97740 116588    968      4
ext3_xattr                22258  56540     88     44
journal_handle              159    288     24    144
journal_head               4555   4600     96     40
revoke_table                 14    202     16    202
revoke_record                 6    112     32    112
uhci_urb_priv                 0      0     56     67
UNIX                         97    116    896      4
flow_cache                    0      0    128     30
cfq_io_context              186    250    152     25
cfq_queue                   158    224    136     28
mqueue_inode_cache            1      7   1088      7
isofs_inode_cache             0      0    768      5
hugetlbfs_inode_cache         1      5    752      5
ext2_inode_cache              0      0    976      4
ext2_xattr                    0      0     88     44
dnotify_cache                 0      0     40     92
dquot                       921    975    256     15
inotify_event_cache           0      0     40     92
inotify_watch_cache           1     53     72     53
kioctx                        0      0    384     10
kiocb                         0      0    256     15
fasync_cache                  0      0     24    144
shmem_inode_cache           381    416    960      4
nsproxy                       0      0     56     67
posix_timers_cache            0      0    160     24
uid_cache                    11     36    320     12
ip_mrt_cache                  0      0    128     30
UDP-Lite                      0      0    960      4
tcp_bind_bucket             287    560     32    112
inet_peer_cache               1     59     64     59
secpath_cache                 0      0     64     59
xfrm_dst_cache                0      0    384     10
ip_dst_cache                350    350    384     10
arp_cache                     2     30    256     15
RAW                           9     12    896      4
UDP                          14     28    960      4
tw_sock_TCP                 366    580    192     20
request_sock_TCP             86    150    128     30
TCP                          82    104   1728      4
eventpoll_pwq                10     53     72     53
eventpoll_epi                10     30    128     30
blkdev_ioc                  183    354     64     59
blkdev_queue                 19     24   1752      4
blkdev_requests             156    156    288     13
biovec-256                    2      2   4096      1
biovec-128                    2      2   2048      2
biovec-64                     4     20   1024      4
biovec-16                     6     60    256     15
biovec-4                     41    177     64     59
biovec-1                    330    404     16    202
bio                         333    390    128     30
sock_inode_cache            245    296    832      4
skbuff_fclone_cache         235    280    512      7
skbuff_head_cache           671    795    256     15
file_lock_cache              41    100    192     20
Acpi-Operand               2321   2773     64     59
Acpi-ParseExt                 0      0     64     59
Acpi-Parse                    0      0     40     92
Acpi-State                    0      0     80     48
Acpi-Namespace             1139   1232     32    112
proc_inode_cache          17334  17595    752      5
sigqueue                    320    528    160     24
radix_tree_node           75259  95375    552      7
bdev_cache                   35     40    960      4
sysfs_dir_cache            5073   5280     80     48
mnt_cache                    29     60    256     15
inode_cache                 337    460    720      5
dentry                   111795 143082    216     18
filp                       3966   6420    256     15
names_cache                  96    110   4096      1
avc_node                     15     53     72     53
selinux_inode_security      218    560     96     40
key_jar                      31     80    192     20
idr_layer_cache             119    119    528      7
buffer_head               61868  86173    104     37
mm_struct                   295    404    896      4
Cache                       Num  Total   Size  Pages
vm_area_struct             9874  13574    176     22
fs_cache                    402    780    128     30
files_cache                 233    450    768      5
signal_cache                352    504    832      9
sighand_cache               265    345   2176      3
task_struct                 322    400   1936      2
anon_vma                   1771   2852     40     92
pid_namespace                 0      0   2104      3
pid_1                       626    900    128     30
shared_policy_node            0      0     48     77
numa_policy                   7    144     24    144
size-4194304(DMA)             0      0 4194304      1
size-4194304                  0      0 4194304      1
size-2097152(DMA)             0      0 2097152      1
size-2097152                  0      0 2097152      1
size-1048576(DMA)             0      0 1048576      1
size-1048576                  0      0 1048576      1
size-524288(DMA)              0      0 524288      1
size-524288                   0      0 524288      1
size-262144(DMA)              0      0 262144      1
size-262144                   0      0 262144      1
size-131072(DMA)              0      0 131072      1
size-131072                   1      1 131072      1
size-65536(DMA)               0      0  65536      1
size-65536                    0      0  65536      1
size-32768(DMA)               0      0  32768      1
size-32768                    7      7  32768      1
size-16384(DMA)               0      0  16384      1
size-16384                   15     15  16384      1
size-8192(DMA)                0      0   8192      1
size-8192                     3      3   8192      1
size-4096(DMA)                0      0   4096      1
size-4096                   328    338   4096      1
size-2048(DMA)                0      0   2048      2
size-2048                   563    614   2048      2
size-1024(DMA)                0      0   1024      4
size-1024                  1091   1200   1024      4
size-512(DMA)                 0      0    512      8
size-512                    689    720    512      8
size-256(DMA)                 0      0    256     15
size-256                   1480   1620    256     15
size-128(DMA)                 0      0    128     30
size-64(DMA)                  0      0     64     59
size-32(DMA)                  0      0     32    112
size-32                    5383   5712     32    112
size-128                   1848   1920    128     30
size-64                   76645 406156     64     59
kmem_cache                  145    160    384     10

슬랩 정보를 확인할 수 있다.

필드 상세
cache Cache name
num Number of currently active objects
total Total number of available objects
size Size of each object
pages Number of pages with at least one active object
totpages Total number of allocated pages
pslab Number of pages per slab

 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
페이지
«   2024/11   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
글 보관함