1824875 Members
3805 Online
109674 Solutions
New Discussion юеВ

interpret vmstat output

 
SOLVED
Go to solution
K.C. Chan
Trusted Contributor

interpret vmstat output

Gurus,
what is the diff btw buff and cache col of vmstat output. Here's an example output: "
procs memory swap io system cpu
r b w swpd free buff cache si so bi bo in cs us sy id
3 0 0 4276 5496 17216 124056 0 0 0 0 120 329 0 0 100
3 0 0 4276 5448 17216 124100 0 0 5 0 203 660 13 1 86
2 0 0 4276 5408 17216 124124 0 0 0 0 177 598 11 1 88
2 0 0 4276 5408 17216 124124 0 0 0 22 323 789 2 1 96
0 0 0 4276 5408 17216 124124 0 0 0 0 173 440 1 0 99
1 0 0 4276 4584 17216 124948 0 0 0 0 253 589 9 2 89
0 0 0 4276 4580 17216 124948 0 0 0 0 103 245 0 0 100
2 0 0 4276 4580 17216 124948 0 0 0 0 101 246 0 0 100 "

Thanks for your input.
Reputation of a thousand years can be determined by the conduct of an hour
7 REPLIES 7
Bill McNAMARA_1
Honored Contributor

Re: interpret vmstat output

K.C. Chan
Trusted Contributor

Re: interpret vmstat output

Bill,
I've have problem accessing the link. please verify. Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
Bill McNAMARA_1
Honored Contributor

Re: interpret vmstat output

http://www.sun.com/sun-on-net/itworld/UIR960901perf.html

yea, it works fine.. there's probably some cookie thing..

Try from here if the above doesn't work directly..

http://www.sun.com/sun-on-net/itworld/

some good stuff there really.

Later,
bill
It works for me (tm)
Marco Paganini
Respected Contributor

Re: interpret vmstat output

Hello Michael.

You can get a lot of information by using the "man vmstat" command in linux. You'll find there the definitions but making sense of all this data is a different matter though. Here's a basic scoop:

r: This is the number of processes waiting to run. The more load on the system, the higher this number tends to be. This is related directly to the indicators you see when you use "uptime", "w" and "top" (only those are averages)

b: This is the number of blocked processes. They may be waiting for I/O or something else. Ideally, this should be very close to 0 all the time.

w: Number of processes swapped out.

swpd/free/buff: Memory information. Please note that "free" doesn't show the real free memory. The kernel is intelligent enough to divert unused memory to buffers. You should be really concerned if free AND cache AND buffers start to get low...


si/so: Amount of memory (KB/s) swapped in/out. Keep an eye for high numbers here, meaning excessive swapping/paging.


bi/bo: Blocks device I/O (in locks/second)

us/sy/id: Percentage of time spent in User time, System Time and Idle.

Hope it helps

Paga
Keeping alive, until I die.
Eric Ladner
Trusted Contributor
Solution

Re: interpret vmstat output

To answer your question, buffers are only used for file metadata (inodes, etc) and data from raw block devices. It's accessed via block device and block number.

Cache has file data blocks, and memory mapped information (i.e. files mapped with mmap() calls). It's accessed primarily via inode number.

So, the main difference would be scope, I guess. One's more concerened with blocks on a device, the other with information in a file.

Either buffer can flush to disk, however. The buffer to the device file and the cache through the file system layer to the block device.
K.C. Chan
Trusted Contributor

Re: interpret vmstat output

Eric,
since Linux (possibley Solaris) handles memory diffrently than HP-UX, then How do you know how much is free. This is under the assumption that everytime I start up my Linux server, there doesn't seem to be a lot of memory on the free col. There's nothing running on it. Does this mean free does not really mean free?

Can someone give a short concepts of how Linux uses memory? Does it cache everyting during boot up? Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
Eric Ladner
Trusted Contributor

Re: interpret vmstat output

If you have a lot of free memory (really free), the kernel will use more space for buffers and for cache. If the amount of real memory needed grows, these areas can shrink somewhat before the system actually starts using swap.

You will always have some cache or buffer usage on your system because data has to go through there from being modified in memory to the disk, and from the disk into memory.

Cache will grow and shrink more than buffer, I think.

Looking at "Free Mem" in top really isn't a good judge of system performance, memory wise. What you want to be aware of is how much swap it's using. If you are using a good deal of swap (more than a couple meg), that's a good indication you need more memory