Report this

What is the reason for this report?

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

Posted on November 21, 2018

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?



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!

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.

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…

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.