Hacker News new | ask | show | jobs
by tghw 5863 days ago
I may be fundamentally misunderstanding something here, but doesn't turning off swap pretty much guarantee that things will start failing if you have a spike in memory usage? Assuming you have something like 256M of RAM (like many small VPSs) running at 170M means that a relatively small spike could cause things to start having memory errors. Is there some way to mitigate this, other than enabling swap?
3 comments

Things will start "failing" from a user's perspective if you have to hit the disk for every transaction anyway (i.e. most requests will time out.)
Size your server properly and know the memory requirements of your application. That way you can guarantee that you will never hit swap.
That's a lot easier said than done. Unless you use ulimit to strictly enforce process memory limits (tricky) it's nearly impossible to know the how much memory a large complicated program (like MySQL) will allocate.
With no swap OOM Killer will kick in if you run out of RAM. It will kill a process in order to free up memory.