How to interpret memory usage numbers?

Can someone explain this in a practical way? The sample is a use for one low-traffic Rails site using Nginx and 3 Mongrel clusters. I ask because I'm going to find out about page caching, wondering if these numbers make any significant sense for this process. Thanks. Great site!

me@vps :~$ free -m total used free shared buffers cached Mem: 512 506 6 0 15 103 -/+ buffers/cache: 387 124 Swap: 1023 113 910 
+4
source share
2 answers

Physical memory is all used up. What for? Because there, the system must use it.

You will also notice that the system uses 113M swap space. Bad? Good? It depends.

See also that there is 103M cached disk; this means that the system decided that it is better to cache 103M of the disk and replace these 113M; perhaps you have some memory-using processes that are not used and therefore are offloaded to disk.

As another poster said, you should use other tools to see what happens:

  • Your perception: the site works correctly when you use it?
  • Benchmarking: what is the response time your customers see?
  • Finer-grained diagnostics:
    • top: you can see which processes use memory and processor.
    • vmstat: it produces the following output:
  alex@armitage : ~ $ vmstat 1
 procs ----------- memory ---------- --- swap-- ----- io ---- -system-- ---- cpu-- -
  rb swpd free buff cache si so bi bo in cs us sy id id
  2 1 71184 156520 92524 316488 1 5 12 23 362 250 13 6 80 1
  0 0 71184 156340 92528 316508 0 0 0 1 291 608 10 1 89 0
  0 0 71184 156364 92528 316508 0 0 0 0 308 674 9 2 89 0
  0 0 71184 156364 92532 316504 0 0 0 72 295 723 9 0 91 0
  1 0 71184 150892 92532 316508 0 0 0 0 370 722 38 0 62 0
  0 0 71184 163060 92532 316508 0 0 0 0 303 611 17 2 81 0

which will show you that swapping is hurting you (high numbers on si, so), and it’s easier to see statistics over time.

+3
source

after reading this, you used almost all of your memory, have 6 M for free and collect about 10% of your swap. More useful tools are using the top, or perhaps ps, to find out how many of your individual mongers are using in RAM. As you switch to swap, you are likely to become slower. you may find that only 2 mongrels, not 3, could respond faster, because that would most likely not go to swap memory.

Caching a page will surely help a ton during the response, so if your pages are cachable (for example, they don’t have content that is unique to an individual user), I would say that be sure to check it

+1
source

All Articles