Search This Blog

Tuesday, March 11, 2008

How do I find out Linux System Memory Utilization?

Q. How do I find out System / Server Memory Utilization under RHEL / CentOS / any other Linux distribution?

A. You need to use free command which, displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.

free command example

Type the free command at shell prompt: $ free $ free -m Output:

             total       used       free     shared    buffers     cached
Mem:          2010       1965         45          0        152        776
-/+ buffers/cache:       1036        974
Swap:         2047        137       1910

vmstat command

vmstat command provides more information : $ vmstat Output:

procs ———–memory———- —swap– —–io—- –system– —–cpu——
r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
0  0 140480  43636 158196 797692    1    0   108   220    1    4  7  5 87  1  0

Understanding vmstat memory options

  • swpd: the amount of virtual memory used.
  • free: the amount of idle memory.
  • buff: the amount of memory used as buffers.
  • cache: the amount of memory used as cache.
  • inact: the amount of inactive memory. (-a option)
  • active: the amount of active memory. (-a option)

$ vmstat -a Output:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
0  1 140480  37376 109516 1730040    1    0   108   220    1    4  7  5 87  1  0

The following command displays one new line of utilization data every second $ vmstat 1 The following command displays one new line per 2 second, but only for the next 10 seconds: $ vmstat 2 10 Output:

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
4  0 139216  23508 130644 1723680    1    0   108   220    1    5  7  5 87  1  0
2  0 139216  23252 130668 1723816    0    0     0   410 3242 11472  9  7 84  0  0
1  0 139216  23120 130656 1724012    0    0     0   750 3280 11592  3  6 90  1  0
0  0 139216  22996 130588 1724180    0    0     0   426 3272 11052  2  5 93  0  0
2  0 139216  20988 129932 1726980    0    0     6  1146 3353 12105 14  9 74  2  0
1  0 139216  20244 129900 1727216    0    0     0   392 3238 11752  8  7 85  0  0
1  0 139216  20120 129868 1727352    0    0     0   444 3197 11173  2  5 93  0  0
1  0 139216  25964 129852 1721044    0    0     0   268 3147 9269  1  4 95  0  0
3  0 139216  25964 129748 1721196    0    0     2   132 3199 10540  1  4 95  0  0
1  0 139216  25964 129676 1721332    0    0     0   456 3213 10608  2  4 93  1  0

No comments: