From 279462fcb0ab9aa077859c2126053d88fdfcd0d3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 27 Dec 2013 03:35:45 +0000 Subject: [PATCH] =?UTF-8?q?[Translated]=20Linux=20vmstat=20Command=20=A8C?= =?UTF-8?q?=20Tool=20to=20Report=20Virtual=20Memory=20Statistics?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ool to Report Virtual Memory Statistics.md | 109 ------------------ ...ool to Report Virtual Memory Statistics.md | 106 +++++++++++++++++ 2 files changed, 106 insertions(+), 109 deletions(-) delete mode 100644 sources/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md create mode 100644 translated/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md diff --git a/sources/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md b/sources/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md deleted file mode 100644 index 09dba18a26..0000000000 --- a/sources/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md +++ /dev/null @@ -1,109 +0,0 @@ -Translating----------------geekpi - - -Linux vmstat Command Tool to Report Virtual Memory Statistics -================================================================================ -As we already know that computer must have memory which called RAM to make the computer works. RAM is refer to a physical memory that planted into the computer mainboard. This RAM is used to load applications such as browser, word processor and so on. So actually, programs that you are using are running on the memory. - -Let say you have 2 GB of memory. When you are running an operating system, it may that your available memory is only 1,5 GB. Then you actively using a lot of applications. When the usage of the memory is full, you can load more applications anymore. In plain English, the computer may say Sorry, you can not run more applications, please close some programs if you would like to run more applications - -To solve this problem, operating system including Linux use a method named Virtual Memory. This method will search the area of memory which not used recently by any applications, then copy it into computer harddisk. This can give some free memory area and give you chance to run more applications. - -To monitor this virtual memory activities, we can use **vmstat** tool. - -### What is vmstat ### - -Vmstat is a tool that provide reporting virtual memory statistics. It covers systems memory, swap and processors utilizations in real time. - -### How to run vmstat ### - -Same with [mpstat][1], vmstat is included inside sysstat package. If you dont have it, please install sysstat package. - -To run vmstat, just type vmstat in your console. Running vmstat without parameter will show you a default result of vmstat. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_default.png) - -Lets see how to read the information provided by vmstat : - -### Procs ### - -Procs have **r** column and **b** column. **r** columns means the total number of processes that waiting access fot the processor. While b column means the total no processes in a sleep state. Below those columns, there are values. From the above screenshot, we have 2 processes that waiting access to the processor and 0 for sleep processes. - -### Memory ### - -Memory have **swpd, free, buff** and **cache** columns. This information is the same with **free -m** command. The **swpd column** show you about how much memory has been swapped to a swap file or disk. The **free column** show you the unallocated memory available. **Buff column** means how much in use memory. And **cache column** show you about how much memory that can be swapped into swap file or disk if there are some application is needed by them. - -### Swap ### - -Swap show us how much memory is sent or retrieved from the swap system. The **si** column tell us how much memory is moved **from swap to real memory** per second. The so column tell us how much memory that is moved **from real memory to swap**. - -### I/O ### - -The **io** show us the amount of input and output activity per second in terms of blocks read and blocks written. The **bi** column tell us about the number of blocks received and the **bo** tell us about the number of blocks sent. - -### System ### - -System show us the number of system operations per second. The **in** column tell us about the number system interrupts per second. The **cs** column tell us the number of context switches that the system makes in order to process all tasks. - -### CPU ### - -CPU show us the use of CPUs resources. The **us column** tell us how much time that processor spends on non-kernel processes. The **sy column** tell us about how much time that processor spends on kernel related tasks. The **id column** tell us about how long the processor are idle. The **wa column** tell us how much time that the processor has been waiting for I/O operations to complete before being able to continue processing tasks. - -### Using vmstat with delay ### - -As a tool for statistics, the best way of using vmstat is using a **delay**. So you can capture the activity periodically. Let say we want to run vmstat with 5 second delay. Just type **vmstat 5** on your console to do it. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_delay_5.png) - -The command will run every 5 seconds **until** you press Ctrl-C to stop it. -You can use **count** to limit how many times vmstat will running. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_count_7.png) - -The above command will run **vmstat with 5 seconds delay for 7 times**. - -### Show active and inactive memory ### - -To do it, you can add **-a** parameter to vmstat. Heres a sample. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_a.png) - -### Show summarize disk statistics ### - -vmstat can print your system disk statistics if you want. Use **-D** parameter to print it. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_disk_sum.png) - -### Show display unit ### - -You can choose what unit character you want to print. Use **-S followed by k (1000), K (1024), m (1000000), M (1048576)** bytes. If you dont choose the unit, vmstat will use K (1024). - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_define_unit.png) - -### Print detail statistics for specific partition ### - -To do it, you can use **-p parameter followed by device name**. Heres an example of it. - -![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_partition.png) - -### Files ### - -vmstat is using these files to works. - - /proc/meminfo - /proc/stat - /proc/*/stat - -### Conclusion ### - -If you feel your system is running out memory, before you add some physical memory, this tool can help you to determine the root cause of the problem. As usual, you can explore more detail about vmstat command by typing **man vmstat** on your console. It will bring you to vmstat manual page. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-command/linux-vmstat-command-tool-report-virtual-memory-statistics/ - -霂嚗[霂ID](https://github.com/霂ID) ∪笆嚗[∪笆ID](https://github.com/∪笆ID) - -祆 [LCTT](https://github.com/LCTT/TranslateProject) 蝧餉嚗[Linux銝剖稽(http://linux.cn/) 隤典 - -[1]:http://linoxide.com/linux-command/linux-mpstat-command/ \ No newline at end of file diff --git a/translated/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md b/translated/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md new file mode 100644 index 0000000000..f27c367b7a --- /dev/null +++ b/translated/Linux vmstat Command 每 Tool to Report Virtual Memory Statistics.md @@ -0,0 +1,106 @@ +Linux vmstat 賭誘 - 亙摮蝏霈∠撌亙 +================================================================================ +隡函伐霈∠箏憿餅蝘唬銝摧AM(箄挪桀摮)摮典其蝙敺霈∠箏極雿RAM舀刻恣蝞箔蜓蹂拍摮具餈RAM鋡怎其頧賢瘚閫具摮憭刻蝐餌蝔摨摰銝嚗雿雿輻函蝔摨質銵典摮銝 + +霈拇隞砍霈曆2GB摮敶雿刻銵雿蝟餌塚雿舐典摮航賢芣1.5GB亦雿雿輻其憭折蝔摨敶摮雿輻冽說銋嚗雿航賢銋瘜頧賣游蝔摨瘚曉啗秩嚗霈∠箏航賭霂:"望嚗雿銝賢刻銵游蝔摨鈭嚗憒雿餈閬餈銵嗡蝔摨霂瑕喲凋鈭蝔摨" + +銝箔閫唾銝芷桅嚗雿蝟餌昭inux雿輻其銝銝芣寞蝘唬銝箄摮餈銝芣寞隡蝝X餈銝其蝙函蝔摨摮箏嚗亦撠摰隞祆瑁啗恣蝞箇′銝餈隡曉箔鈭拐摮蝛粹渡雿箔餈銵游蝔摨 + +銝箔閫摮瘣餃剁隞砌蝙**vmstat**撌亙瑯 + +### 隞銋鈭 vmstat ### + +vmstat臭銝芣靘亙摮蝏霈∠撌亙瑯隞/憟寡鈭蝟餌摮鈭斗W摰嗅典拍函 + +### 憒雿餈銵 vmstat ### + +[mpstat][1]銝瘀vmstat怠究ysstat銝准憒雿餈瘝⊥嚗霂瑕鋆sysstat + +銝箔餈銵vmstat嚗芷冽批嗅啗史mstat銝撣血啗銵vmstat隡曄內vmstat暺霈斤 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_default.png) + +霈拇隞祉銝憒雿霂餃vmstat靘靽⊥荔 + +### Procs ### + +procs **r****b****r**隞銵函敺霈輸哽PU餈蝔圈b喟∠餈蝔圈刻鈭銝g臬隞祉潦隞銝Y芸曆葉嚗冽2銝芾蝔甇函敺霈輸哽PU嚗0銝芰∠餈蝔 + +### Memory ### + +memory**swpd free buff** **cache** 餈鈭.餈鈭靽⊥臬賭誘**free -m**詨**swpd**曄內鈭憭撠摮撌脩鋡思漱W唬鈭斗X隞嗆蝤**free**曄內鈭芸舐典摮**buff**曄內鈭雿輻其葉摮**cache**曄內鈭憭撠摮臭誑鋡思漱W唬漱X隞嗆蝤銝憒銝鈭摨券閬隞隞研 + +### Swap ### + +swap曄內鈭隞鈭斗Y頂蝏銝鈭憭撠摮**si**霂隞祆蝘憭撠摮鋡**隞swap蝘餃啁摰摮**銝准**so**霂隞祆蝘憭撠摮鋡**隞摰摮蝘餃酒wap**銝准 + +### I/O ### + +**io**靘桀霂餃曄內鈭瘥蝘颲亥箇瘣餃具**bi**霂隞砍嗅啁圈嚗**bo**霂隞砍圈 + +### System ### + +system曄內鈭瘥蝘蝟餌雿圈**in**曄內鈭蝟餌瘥蝘鋡思葉剔圈**cs**曄內鈭蝟餌銝箔憭隞乩遙∟銝銝Y圈 + +### CPU ### + +CPU霂鈭隞拴PU韏皞雿輻冽萸**us**曄內鈭憭典券貊摨瘨園氬**sy**曄內鈭憭典典貊詨喃遙∩瘨園氬**id**曄內鈭憭函蝛粹脫園氬**wa**曄內鈭憭典函敺IO雿摰隞亦誧蝏剖隞餃∩園氬 + +### 隞撱嗉雿輻肖mstat ### + +雿銝箔銝芰霈∪極瘀雿輻肖mstat憟賜寞臭蝙**撱嗉**雿臭誑湔剖唳瘣餃具霈拇霈曆誑5蝘撱嗉雿輻肖mstat芷閬其批嗅唬葉颲**vmstat 5**撠梯 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_delay_5.png) + +賭誘撠隡瘥5蝘餈銵銝甈**游**雿銝Ctrl-C亦甇W雿臭誑雿輻**count**交曄內vmstat餈銵甈⊥啜 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_count_7.png) + +銝Y賭誘隡**隞5蝘湧餈銵7甈」mstat** + +### 曄內瘣餉瘣餉摮 ### + +閬餈銋嚗雿臭誑肖mstat**-a**憿嫘餈臭葵蝷箔 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_a.png) + +### 曄內蝤蝏霈⊥唳格餌 ### + +憒雿喉vmstat臭誑啁頂蝏蝤蝏霈∼雿輻**-D**憿孵停銵 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_disk_sum.png) + +### 曄內雿 ### + +雿臭誑拐單啁曄內雿摮蝚艾**-S頝銝k (1000) K (1024) m (1000000) M (1048576)** 摮. 憒雿銝喲拙雿嚗暺霈支蝙函涔 (1024) + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_define_unit.png) + +### 銝箇孵箸啗祕蝏蝏霈⊥唳 ### + +閬餈銋嚗雿臭誑雿輻**-p憿寡銝霈曉**餈銝芯摮 + +![](http://linoxide.com/wp-content/uploads/2013/12/vmstat_partition.png) + +### 隞 ### + +vmstat雿輻刻鈭隞嗅極雿 + + /proc/meminfo + /proc/stat + /proc/*/stat + +### 餌 ### + +vmstat** on your console. It will bring you to vmstat manual page. +憒雿閫蝟餌餈銵頞箏摮鈭嚗其憓拍摮嚗餈銝芸極瑕臭誑撣桀拐蝖桀桅寞砍撣訾嚗雿臭誑冽批嗅唬葉颲**man vmstat**瑕游喃vmstat霂衣靽⊥胯餈隡撣虫餈史mstat憿萸 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/linux-vmstat-command-tool-report-virtual-memory-statistics/ + +霂嚗[geekpi](https://github.com/geekpi) ∪笆嚗[∪笆ID](https://github.com/∪笆ID) + +祆 [LCTT](https://github.com/LCTT/TranslateProject) 蝧餉嚗[Linux銝剖稽(http://linux.cn/) 隤典 + +[1]:http://linoxide.com/linux-command/linux-mpstat-command/ \ No newline at end of file