In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use vmstat in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
What is vmstat?
Vmstat is a tool that provides reporting on virtual memory statistics. It includes system memory, swap, and real-time processor utilization.
How to run vmstat
Like mpstat, vmstat is included in the sysstat package. If you haven't already, please install the sysstat package.
To run vmstat, simply type vmstat on the console. Running vmstat with no parameters displays the default results of vmstat.
Let's take a look at how to understand the information provided by vmstat:
Procs
Procs has r columns and b columns. The r column represents the number of processes waiting to access the CPU. Column b means the number of sleep processes. Below these columns are their values. From the screenshot above, we have 2 processes waiting to access CPU,0 sleep processes.
Memory
Memory has columns like swpd, free, buff, and cache. This information is the same as the command free-m. The swpd column shows how much memory has been swapped to the swap file or disk. The free column shows the unallocated available memory. The buff column shows the memory in use. The cache column shows how much memory can be swapped to swap files or disks if some applications need them.
Swap
Swap shows how much memory was sent or retrieved from the swap system. The si column tells us how much memory is moved from swap to real memory (In) per second. The so column tells us how much memory is moved from real memory to swap (Out) per second.
I/O
Io shows the activity of input and output per second based on the read and write of the block. The bi column tells us the number of blocks received, and the bo column tells us the number of blocks sent.
System
System shows the number of system operations per second. The in column shows the number of system interruptions per second. The cs column shows the number of context switches the system has made in order to handle all tasks.
CPU
CPU told us about the use of CPU resources. The us column shows how much time the processor spends in non-kernel programs. The sy column shows how much time the processor spent on kernel-related tasks. The id column shows the idle time of the processor. The wa column shows the time that the processor is waiting for the IO operation to complete before continuing with the task.
Run vmstat at intervals
As a statistical tool, the way to use vmstat*** is to use interval time. You can capture the state of the system intermittently. Let me assume that vmstat is running at an interval of five seconds. Just type vmstat 5 in your console.
The command will run every 5 seconds until you press Ctrl-C to terminate it. You can also use the second parameter to control the number of times vmstat runs.
The above command runs vmstat seven times at intervals of five seconds.
Show active and inactive memory
To do this, you can add the-an option after vmstat. This is an example.
Show disk statistics summary
Vmstat can also print system disk activity statistics if you want. Just use the-D option.
Display unit
You can choose the display unit characters you want to print. Follow-S with k (lowercase, 1000), K (uppercase, 1024), m (lowercase, 1000000), M (uppercase, 1048576) bytes. If you do not want to select units, the default is K (1024).
Displays detailed statistics for a disk partition
To do this, you can use the-p option to follow the device name. Here's an example.
File
Vmstat is actually the data obtained using these files.
/ proc/meminfo/proc/stat/proc/*/stat, this is the end of the article on "how to use vmstat in Linux". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.