D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] VPS Memory Usage

 

On Thu, 7 Apr 2011, Simon Waters wrote:

On 07/04/11 15:36, Gibbs wrote:
I don't know a great deal about memory usage but I'm struggling to
understand this. On my VPS memory usage is typically between 65-95%.
This is fine as its there to be used but I do get concerned when it
reaches the 90%+ region for periods.

Another thing I don't really understand is that none of it is buffered
or cached. Here's the output of "free -m":

             total       used       free     shared    buffers     cached
Mem:           960        807        152          0          0          0
-/+ buffers/cache:        807        152
Swap:            0          0          0


Can anyone explain if this high usage is OK? I have around 20 websites
on this Ubuntu VPS including mail. Amavis, Clam, Apache and MySQL are
taking the majority.

VPS implementations vary, I assume your VPS is KVM based.

I'm fairly sure that Parallels/Virtuozzo is the one that Gibbs's hosting company is using... I think it's a containery type of thing similar to OpenVZ and LXC with one kernel and lots of containers using the same kernel image.. Actually, OpenVZ seems connected with them too..

I have a diddy KVM virtual host which we use as a DNS server. It shows
similar characteristics.

It does surprise me, but I guess that's a "feature" :)

I believe swap for KVM has only recently been sanely implemented, and it
may not make commercial sense (they want to sell you as much memory as
you might need, and they don't want to create a disk I/O issue for
themselves).

Reducing disk IO is the main reason - kills performance of other VM's in the same host...

Afraid the answer to is the high memory use an issue is "how much do you
need?". If it ever starts killing processes because it is out of RAM,
then you don't have enough (or some process suddenly expanded for some
other reason).

The dreaded Oom oops ...

Virtual servers lacking swap support is one of the drawbacks of virtual
servers (well Gordon and his telephones might not care), but for website
and database stuff paging out rarely used pages is nearly always a
performance gain, and a soft landing with paging out is often to be
preferred in low memory situations compared to killing off the next
process that asks for more RAM (always seems to be cron or mysql in my
experience, and losing cron can be painful especially if you use it for
back-ups).

My KVM VPS shows:

# free -m
            total       used       free     shared    buffers     cached
Mem:           200        113         86          0          0          0
-/+ buffers/cache:        113         86
Swap:            0          0          0

I'm using LXC for my hosted VoIP boxes:

$ free -m
             total       used       free     shared    buffers     cached
Mem:          3515       2807        708          0        754       1656
-/+ buffers/cache:        397       3118
Swap:            0          0          0

And I do care about swap - it's the absolute last thing I want for the VoIP boxes - fortunately they're very well behaved and don't grow at all.

For my general purpose LAMPy ones, (which also use LXC) they do have a bit of swap, but not much - basically it's there to take the pressure of something that does need a bit (e.g. cron backup jobs!) more rather than being intended as cheap memory...

Newer LXCs can limit container memory and swap size.

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq