Refresh/release swap space

My server had a DOS attack which almost used up the swap space, it decreased to 10% after the attack stopped and have been the same for several hours. It should be 0% with the current server load (always 0% when no attack), is it possible to update it somehow?

Code:
# swapinfo
Device          1K-blocks     Used    Avail Capacity
/dev/ad8s1b       2097152   203992  1893160    10%
 
That last 10% is probably rarely used stuff that got swapped out and will never be touched again. I brought up on IRC a while back - when I was asking about how on my Apache servers, performance always goes to hell if it gets into swap, so since I try keep it out of swap is there any need to have swap at all - about how things like getty and so on, if they're never used, will get swapped out and that frees up real RAM for other things that could use it.

So my guess is you're equating 0% swap with "healthy", and 10% swap with "unhealthy", and that's possibly incorrect.

But yes, swapoff/swapon will do the trick - just make sure that used RAM + used swap does not exceed the real ram of your server, as I think you'd cause a panic (correct me if I'm wrong on that).
 
fwaggle said:
So my guess is you're equating 0% swap with "healthy", and 10% swap with "unhealthy", and that's possibly incorrect.
Exactly. Swap usage in and of itself isn't a problem. It's excessive paging that will cause problems and slow things down.

So instead of looking at your swap usage you should look at your paging. If swap is being used but there's hardly any paging in/out of swap then it's not a problem.
 
[cmd=]systat -vmstat 1[/cmd]

Look at information at the top-right:

Code:
SWAP PAGER
in   out
 
Back
Top