On Linux: We see following: Physical, Real, Swap,

2019-04-13 05:31发布

问题:

We use a Tool (Whats Up Gold) to monitor memory usage on a Linux Box. We see Memory usage (graphs) related to:

Physical, Real, Swap, Virtual Memory and ALL Memory (which is a average of all these).

'The ALL' Memory graphs show low memory usage of about: 10%. 
But Physical memory shows as 95% used.
Swap memory shows as 2% used.

So, do i need more memory on this Linux Box? In other words should i go by:

  • ALL Memory graph(which says memory situation is good) OR
  • Physical Memory Graph (which says memory situation is bad).

回答1:

Real and Physical

Physical memory is the amount of DRAM which is currently used. Real memory shows how much your applications are using system DRAM memory. It is roughly lower than physical memory. Linux system caches some of disk data. This caching is the difference between physical and real memory. Actually, when you have free memory Linux goes to use it for caching. Do not worry, as your applications demand memory they gonna get the cached space back.

Swap and Virtual

Swap is additional space to your actual DRAM. This space is borrowed from disk space and once you application fill-out entire DRAM, Linux transfers some unused memory to swap to let all application stay alive. Total of swap and physical memory is the virtual memory.

Do you need extra memory?

In answer to your question, you need to check real memory. If your real memory is full, you need to get some RAM. Use free command to check the amount of actual free memory. For example on my system free says:

$ free
                 total       used       free     shared    buffers     cached
    Mem:      16324640    9314120    7010520          0     433096    8066048
    -/+ buffers/cache:     814976   15509664
    Swap:      2047992          0    2047992

You need to check buffer/cache section. As shown above, there are real 15 GB free DRAM (second line) on my system. Check this on your system and find out whether you need more memory or not. The lines represent physical, real, and swap memory, respectively.