Hacker News new | ask | show | jobs
by cuu508 4530 days ago
I prefer having swap disabled by default and hitting the wall hard when out of memory. Some swap is nice on desktop systems where memory usage can vary a lot. On server, RAM usage should be relatively stable. Tune your stack, pick appropriate plan that leaves some RAM headroom, and be done with it. Ah, and add alerts for when memory usage goes over some threshold.
2 comments

Server memory usage may be stable but there are likely to be some cold spots that rarely (maybe never) actually get accessed so having a some swap space should have very little negative performance impact and give you a little more headroom before you hit the limit and processes start dying on you.

If you hit the point when it thrashes because the working set isn't fitting in memory then that is obviously a bad place but there is a fair chance you can stay a host size smaller and save money by running some swap.

As for what the cold spots might be I can easily imagine libraries being included/required in an interpreted language and only small fractions of their functionality used. Unlike native libraries they won't just be memory mapped in without using real memory.

This makes sense! Can you give a pointer on how to set up the alerts you mentioned? (home sysadmin here)
I'm using NewRelic's free plan for this. Instructions for setting up their monitoring daemon on Ubuntu server: https://docs.newrelic.com/docs/server/server-monitor-install...