views:

248

answers:

2

Can someone explain this in a practical way? Sample represents usage for one, low-traffic Rails site using Nginx and 3 Mongrel clusters. I ask because I am aiming to learn about page caching, wondering if these figures have significant meaning to that process. Thank you. 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
+1  A: 

by my reading of this, you have used almost all your memory, have 6 M free, and are going into about 10% of your swap. A more useful tools is to use top or perhaps ps to see how much each of your individual mongrels are using in RAM. Because you're going into swap, you're probably getting more slowdowns. you might find having only 2 mongrels rather than 3 might actually respond faster because it likely wouldn't go into swap memory.

Page caching will for sure help a tonne on response time, so if your pages are cachable (eg, they don't have content that is unique to the individual user) I would say for sure check it out

Cameron Booth
+3  A: 

Physical memory is all used up. Why? Because it's there, the system should be using it.

You'll note also that the system is using 113M of swap space. Bad? Good? It depends.

See also that there's 103M of cached disk; this means that the system has decided that it's better to cache 103M of disk and swap out these 113M; maybe you have some processes using memory that are not being used and thus are paged out to disk.

As the other poster said, you should be using other tools to see what's happening:

  1. Your perception: is the site running appropiately when you use it?
  2. Benchmarking: what response times are your clients seeing?
  3. More fine-grained diagnostics:
    1. top: you can see live which processes are using memory and CPU
    2. vmstat: it produces this kind of output:
 alex@armitage:~$ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 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 whether swap is hurting you (high numbers on si, so) and a more easier to see performance-over-time statistic.

alex