Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use vmstat in Linux system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use vmstat in Linux system". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Vmstat is used to view memory usage in real time, which is more intuitive than using top.

If you use it directly, you can only get the current situation, and it is best to use a time interval to collect it.

Vmstat T in which T is marked with a specific time, in seconds, for example: vmstat 5 form is collected every 5 seconds.

In this way, when refreshing, you can systematically see which column is abnormal.

Procs:

Rmusic->; number of processes waiting in the run queue

BMQ->; number of processes waiting for io

Wmurf->; a process that can enter the run queue but be replaced

Memoy

Swap-- >; currently available swap memory (k for)

Free-- >; free memory (k stands for)

Pages

Re-- "recycled pages"

Mf-- "pages with non-critical errors

Number of pages entered by "pi--" (k represents)

Number of po-- "pages (k stands for)

Fr-- "number of pages free (k stands for)

Number of misses in pages read in advance by de--

Sr-- "pages scanned by clock algorithm

Disk shows disk operations per second. S for sci disk, 0 for disk number

Fault shows the number of interrupts per second

In-- "device interrupt

Sy-- "system interruption

Cy-- "cpu exchange

Cpu indicates the usage status of cpu

Cs-- "time used by user processes

Sy-- "time used by system processes

Id-- "cpu idle time

Where:

If r is often greater than 4 and id is often less than 40, the load on cpu is very heavy.

If pi,po is not equal to 0 for a long time, there is not enough memory.

If disk is often not equal to 0 and the queue in b is greater than 3, it means that io performance is not good.

Example:

The code is as follows:

[root@localhost ~] # vmstat 2 # displays system memory statistics every two seconds

Procs-memory--swap---io-----system---cpu

R b swpd free buff cache si so bi bo in cs us sy id wa

0 0 0 219908 62964 175548 0 0 47 12 12 17 0 1990

00 0 219900 62964 175548 00 00 11 12 00 100 0

00 0 219900 62964 175548 00 00 9900 100 0

The code is as follows:

[root@localhost ~] # vmstat 2 5 # displays system memory statistics every two seconds for a total of 5 times

Procs-memory--swap---io-----system---cpu

R b swpd free buff cache si so bi bo in cs us sy id wa

0 0 0 219908 62964 175548 0 0 46 12 12 17 0 1990

00 0 219900 62964 175548 00 00 12 14 00 100 0

00 0 219900 62964 175548 00 00 11 11 0 1 100 0

00 0 219900 62964 175548 00 00 10 11 00 100 0

00 0 219900 62964 175548 00 00 10 900 100 0

The code is as follows:

[root@localhost ~] # vmstat-d # displays disk information

Disk--reads--writes--IO-

Total merged sectors ms total merged sectors ms cur sec

Ram0 0 0 0

Ram1 0 0 0

Ram2 0 0 0

Ram3 0 0 0

Ram4 0 0 0

Ram5 0 0 0

Ram6 0 0 0

Ram7 0 0 0

Ram8 0 0 0

Ram9 0 0 0

Ram10 0 0 0

Ram11 0 0 0

Ram12 0 0 0

Ram13 0 0 0

Ram14 0 0 0

Ram15 0 0 0

Loop0 0 0 0

Loop1 0 0 0

Loop2 0 0 0

Loop3 0 0 0

Loop4 0 0 0

Loop5 0 0 0

Loop6 0 0 0

Loop7 0 0 0

Sda 12341 5909 471542 465300 1325 2081 127088 32204 0 19

Sr0 0 0 0

This is the end of "how to use vmstat in Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report