In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the process of virtual memory viewing command vmstat in Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the process of virtual memory viewing command vmstat in Linux.
Vmstat is a tool for viewing virtual memory usage. It can see server usage, memory usage, virtual memory swapping, IO read and write. Compared to top, you can see the CPU,memory,IO usage of the whole machine, not just the utilization of each process.
By default, the vmstat command is not installed, you need to install the sysstat package, which contains the vmstat program.
It is commonly used to add two digital parameters to the command, the first parameter is the sampling interval (seconds), and the second parameter is the number of sampling times.
Basic parameters:
Vmstat [- a] [- n] [- t] [- S unit] [delay [count]]
[- a]: displays active and inactive memory
[- n]: display the field name only once at the beginning, and output a bit more humanized in the case of multiple collections of information
[- t]: displays the time when the information was collected at the end of each message
[- S unit]: displays in specified units. The parameters are k, K, m, M, which represent 1000, 1024, 1000000, and 1048576 bytes (byte), respectively. The default unit is K (1024 bytes)
[delay [count]]: delay is the interval of information collection, and count is the number of times information is collected
Vmstat [- s] [- n] [- S unit]
[- s]: displays memory-related statistics
Vmstat [- m] [- n] [delay [count]]
[- m]: displays the slabinfo,slabinfo information recorded in the / proc/slabinfo file. Slab is a memory allocation mechanism of linux.
Vmstat [- d] [- n] [delay [count]]
[- d]: displays statistics for related disks
Note: the difference between this and downstairs-p statistical information is different, statistical object this is disk-p is a subpartition, this cannot specify all output
Vmstat [- p disk partition] [- n] [delay [count]]
[- p disk partition]: displays statistics for disk partitions, which are not as useful as iostat information
Vmstat [- f]
[- f]: the number of fork since boot. Note: the fork here should be the fork () function of the kernel. In the parent process, fork returns the process ID of the newly created child process.
Vmstat [- V]
[- V]: version information
Example
The code is as follows:
Root@192.168.22.54:~# vmstat 2 10
Procs-memory--swap---io-----system---cpu-
R b swpd free buff cache si so bi bo in cs us sy id wa st
13 0 0 542604 323512 12356052 0 0 0 2 0 0 17 18 65 0 0
42 00 552500 323512 12356112 00 00 18669 49903 42 45 14 00
72 0 0 563416 323512 12356132 0 0 0 18394 49895 41 43 16 0 0
73 0 0 570924 323512 12356164 0 0 0 19666 51678 37 41 22 0 0
13 0 0 581208 323512 12356204 0 0 0 280 18990 49541 43 43 15 0 0
18 0 0 587148 323512 12356228 0 0 0 32 19360 49203 37 39 24 0 0
27 00 520016 323512 12356292 00 00 20423 52865 39 40 21 00
18 0 0 527512 323512 12356336 0 0 0 19613 53052 42 43 16 0 0
23 0 0 538608 323512 12356376 0 0 0 18860 50645 41 42 18 0 0
80 0 0 548608 323512 12356444 0 0 0 19781 50917 41 42 17 0 0
Based on the above example, the following is the field description:
Procs (process)
R: indicates the number of processes running the queue, in other words, how many processes are actually assigned to cpu. The server is configured with a cpu of 8 cores. Here, because the server is running a large number of programs, when this value exceeds the number of cpu and the id is small, there may be cpu bottlenecks. The running queue is too large, indicating that cpu is very busy, which generally results in high cpu utilization.
B: the number of processes waiting for io.
Memory
Swpd: virtual memory usage (in KB)
Free: free memory
Buff: the amount of memory used as a buffer, the part of memory in which a program code is cached and cannot be moved to swap.
Cache: memory size used for caching, data cache, allowed to be given to swap
Swap
Si: the number of swap pages swapped from disk to memory, the amount of virtual memory read from disk per second. If this value is greater than 0, physical memory is insufficient or memory is leaked.
So: the number of swapped pages swapped from memory to disk, the size of virtual memory written to disk per second. If this value is greater than 0, physical memory is insufficient or memory is leaked.
Bi:Blocks received from a block device (blocks/s). The number of blocks received from the block device per second, that is, the read block device.
Bo:Blocks sent to a block device (blocks/s). The number of blocks sent to the block device per second, that is, the write block device.
System
In: interrupts per second, including clock interrupts.
Cs: context switches per second. The smaller the value, the better. For example, every time the system function is called and the thread is switched, the code will enter the kernel space, resulting in context switching. Too many times means that most of the cpu is wasted in context switching, resulting in the underutilization of cpu.
CPU (as a percentage)
Us: user process execution time, user cpu utilization, operation operation, etc.
Sy: system process execution time, system cpu utilization, reading hard disk, operating hardware, etc.
Id: idle time (including IO wait time)
Wa: waiting time for IO
At this point, I believe you have a deeper understanding of the process of "virtual memory viewing command vmstat in Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.