Long time. Okay so today we will look into how to Interpret "free" command output. Actually this understanding helps when we analyze the systems which going through bad phase of perfromance.
total used free shared buffers cached
Mem: 4147720 3974664 173056 0 358608 3285520
-/+ buffers/cache: 330536 3817184
Swap: 6289436 36 6289400
- All the numbers are reported in 1024-byte blocks.
- Here, we see a system with 4147720 blocks (about ~4G) of physical RAM, with 3974664 (about ~3.7 GB) currently in use.
- The "shared" column lists the amount of physical memory shared between multiple processes. Here, we see that about 0 MB of pages are being shared (I suspect it is not a good sign; memory is not being utilized well however on maximum number of servers I've observed the same thing).
- The "buffers" column shows the amount of memory being used by the kernel buffer cache. The buffer cache is used to speed up disk operations, by allowing disk reads and writes to be serviced directly from memory. The buffer cache size will increase or decrease as memory usage on the system changes; this memory is reclaimed if it is needed by applications. Therefore, although we see that ~3.7 GB of system memory is in use, not all (but most) of it is being used by application programs.
- The "cache" column indicates how many memory pages the kernel has cached for faster access later. Since the memory used for buffers and cache can easily be reclaimed for use by applications, the second line (-/+ buffers/cache) provides an indication of the memory actually used by applications (the "used" column) or available to applications (the "free" column). The sum of the memory used by buffers and cache reported in the first line is subtracted from the total used memory and added to the total free memory to give the two figures on the second line.
- In the third line, we see the total amount of swap, 6289436 blocks (about 6 GB). In this case, only very little of the swap is being used; there is plenty of physical RAM available. If additional applications were started, larger parts of the buffer cache memory would be used to host them. Swap space is generally used as a last resort when the system can't reclaim physical memory in other ways. Note that the amount of swap reported by free is somewhat less than the total size of your swap partitions and files. This is because several blocks of each swap area must be used to store a map of how each page in the swap area is being utilized. This overhead should be rather small; only a few kilobytes per swap area.