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?
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).
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.