1753456 Members
5398 Online
108794 Solutions
New Discussion юеВ

vmstat vs top

 
SOLVED
Go to solution
vmstat vs top
Occasional Contributor

vmstat vs top

Someone may explain how to match results between VMSTAT and TOP?

vmstat shows the next
procs memory page faults cpu
r b w avm free re at pi po fr de sr in sy cs us sy id
1 0 0 1249634 1567471 182 59 0 0 0 0 0 1320 104945 12977 5 49 45


and top


System: htx668 Thu May 17 16:28:58 2007
Load averages: 0.04, 0.03, 0.04
284 processes: 235 sleeping, 49 running
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 0.07 0.2% 0.0% 0.2% 99.6% 0.0% 0.0% 0.0% 0.0%
1 0.04 0.0% 0.0% 0.4% 99.6% 0.0% 0.0% 0.0% 0.0%
2 0.05 0.0% 0.0% 3.0% 97.0% 0.0% 0.0% 0.0% 0.0%
3 0.00 5.2% 0.0% 6.4% 88.4% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 0.04 1.4% 0.0% 2.4% 96.2% 0.0% 0.0% 0.0% 0.0%

Memory: 5684000K (3830848K) real, 6893300K (4889776K) virtual, 6269244K free Page# 1/18


So I haven't match for any way those results :(
9 REPLIES 9
Patrick Wallek
Honored Contributor

Re: vmstat vs top

I wouldn't even try.

Top is one of the worst utilities to use to check memory usage.
Don Morris_1
Honored Contributor
Solution

Re: vmstat vs top

vmstat is pages, top is reporting Kb... a page is typically 4Kb... so these are about right.

avm: 1249634 pages or 4998536Kb.
Free Virtual: 1567471 pages or 6269884Kb.

Close enough to top for me.
A. Clay Stephenson
Acclaimed Contributor

Re: vmstat vs top

... and don't even think about trying to correlate either of these to physical memory. They only know about memory associated with processes; they know nothing about kernel data structures like buffer cache. I use top ONLY to show me the most active processes and I use vmstat ONLY to display the pageout (po) column. Everything else is almost useless. Moreover, it is very, very hard to total memory usage on a system. For example, you may have 50 instances of vi running. They each have a data segment but they share common text segments (code) and common shared library functions (which may also be in use by many other processes). How do you count those? As 1? as 50? as 3.5? There are also shared memory segments and memory-mapped files. How are those counted? In short, this is very difficult and tools written decades ago have a hard time producing meaningful numbers. Glance does a much better job but even then you have to know what you are seeing.
If it ain't broke, I can fix that.
Jov
Honored Contributor

Re: vmstat vs top

Hi Guys,

Since we're covering memory usage I'd like to know your opinion/answer on the following:

If you have a machine that is running out of memory or thrashing, what will you address first? The paging or the swap?

Personally I'm not aware of anything you can do for how the system does its Paging.

Also Clay, according to what you're stating regarding the usefulness of vmstat is this just for HP-UX or is the issue across the other Unix flavors as well?

Apologies for the hijack, but for what its worth HP-UX has a lot better tools than both.. eg. glance.


Jov
A. Clay Stephenson
Acclaimed Contributor

Re: vmstat vs top

While the terms "paging" and "swapping" are used almost interchangably, for all practical purposes, everything today does paging (ie, only parts of a process are paged out rather than the entire process image). HP-UX does deactivate processes but only when the box is under extreme memory pressure. The goal for modern UNIX boxes is to never (or almost never) page out at all --- and when your box does begin to page out at significant rates --- you have lost the performance battle.

Regardless of the UNIX flavor, I really only pay attention to the pageout column because if that number is big (meaning anything over about 20 or so and I really like 0), none of the other columns mean much of anything.
If it ain't broke, I can fix that.
Jov
Honored Contributor

Re: vmstat vs top

Well if you're in such a losing battle i.e. when the system is thrashing, the one thing I can think of is to nice certain processes to ride out the storm as its usually due to some batch processing or large processing that kicks in. If that doesn't work the system will eventually crash, thus its a matter of judgement call for the given instance.


Jov
Nitin Kumar Gupta
Trusted Contributor

Re: vmstat vs top

Secondo me,

top is used to see the current user's memory utilization. Whereas, vmstat is used for virtual memory statistics. So, it will differer in any case.

I think for Unix glance is better utility

Ciao
Emil Velez
Honored Contributor

Re: vmstat vs top


See if the box has OVPA (measureware). It will collect the data and you can extract historical data from your system on hundreds of metrics in 5 minute averages.
Trng
Super Advisor

Re: vmstat vs top

Hi,


Glanceplus and Openview(OVO is userfriendly and given more info) are the best utility to check allmost all system componets like memory,cpu,disk etc


rgds
suresh
administrator