Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a VPS which has 512 MB of dedicated memory, and up to 1GB burstable.

I recently installed nginx, and I noticed a spike in memory usage. With Apache, it was using around 170MB. With nginx, it's around 350-400MB.

I ran the "top" command via SSH, but nothing returned to be using a high amount of memory. MySQLD appeared to be the only one with the most memory usage, at 3%.

What is causing this?

share|improve this question
    
Need more details. If you run PHP for instance and you allowed 5 apache processes before but you now allow 30 php processes then that'd explain it... But so would a million other things. Please provide far more comprehensive details. –  Martin Fjordvald Jul 31 '11 at 9:30

2 Answers 2

up vote 2 down vote accepted

You'll probably find that your ram is being used as buffers/cache, take a look at Linux ate my RAM.

share|improve this answer
    
Most likely. I've opened a support ticket with my server provider to verify. Thanks. –  Spencer Jul 30 '11 at 22:12
    
Probably not, actually; "burstable RAM" means Parallels/Virtuozzo/OpenVZ, which doesn't account for buffers/cache as part of the guest's memory usage (because buffers/cache aren't per-guest). –  womble Jul 31 '11 at 0:22
    
This is mind boggling. What could be causing this issue? –  Spencer Jul 31 '11 at 1:18

As womble pointed, this is probably an OS-level virtualization (Virtuozzo, OpenVZ, lxc, etc), which means a single kernel for all users; the 'virtualization' means just that you can't see other user's processes on the same (real) machine.

Since Apache is (still) more popular than nginx, it's possible that somebody else was also running it on the same host. That means the kernel could share a significant portion of memory. In effect, loading it once to run it twice.

If nobody else on this host was running Nginx, you lose that advantage, and the kernel has to load it specifically for you, and it shows in your RAM budget.

Said that, i don't think the nginx binary code is so big (180+ MB); most of it seems to be some generous allocations in the config.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.