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

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?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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…