Recommendations & policies on Swap usage for idle memory-hungry applications?

November 21, 2018 637 views
Databases Docker Debian

I’m in a situation where I often have a lot of Docker containers - multiple applications, supporting databases, etc. Many of them are memory hungry containers like JIRA, GitLab, and the occasional Minecraft server. However, only a small handful are actually active at the same time, and the vast majority of them sit idle for most of the day. I estimate that out of a typical ~10GB memory usage, only ~2GB are actively being used at any given point in time.

The 16GB plan is out of my price range as a hobbyist, and feels quite wasteful for my use case. However, I have past successes with allocating a large swap area and letting idle applications page out when not being used. For example, would I be allowed to use the 4GB plan and allocate a 10GB swapfile?

1 Answer

I don’t see why not. Based on my understanding of swap, you’re allowed to allocate as much swap as you have on your hard drive and your system is going to allocate memory to swap based on usage, so the least used memory would be stored in swap while your actively used memory is kept in RAM. Seems to me like it would work…

Have another answer? Share your knowledge.