Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

www ~: free
             total       used       free     shared    buffers     cached
Mem:          2048       1848        199          0         21        274
-/+ buffers/cache:       1552        496
Swap:         4095       4086          9

On my Ubuntu production webserver that runs apache/nginx/MySQL and services lots of web customers, it looks like our free Swap memory space is almost all used up. What does this mean? I know that we should add more RAM/memory to the server, but I want to know how bad it will be if current usage continues? We were going to wait until this weekend, when Swap space runs out will the server crash? Grind to a halt? Run really slow?

share|improve this question
up vote 2 down vote accepted

It means you are low on memory. If it isn't already running ungodly slow because of constant disk activity, then you may have some process that has allocated memory but isn't using it, and then it is getting swapped out. If it runs out the system will start somewhat randomly killing processes (search for OOM killer for lots of discussion about how exactly the OOM chooses what is to die).

So what are some remedies solutions to this problem?

Use a command like top to figure out what is using up all the memory. Determine if the memory hog actually needs the memory, or if it is a bug. If it is a bug, try and track down a fix.

If you can't afford the outage to add memory you might check if you can afford a short outage and just kill kill/restart that process.

With Linux you can create swap files, swap doesn't need to be on its own partition. So if you want/need to add more swap you can do it pretty easily without rebooting.

share|improve this answer
So what are some remedies solutions to this problem? – MikeN Aug 4 '10 at 16:33
Get more memory or run fewer processes (or fix the ones which may be hogging the RAM. Find out with 'top') – Matt Simmons Aug 4 '10 at 16:54
Thanks for the advice. I actually had tons of zombie processes I had to kill, my webserver spawned off a lot of pdftk instances that seemed to stall and tie up memory due to disk permissions. Killing them all freed up a lot of swap space before it ran out. – MikeN Aug 4 '10 at 17:36

Your Answer


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.