Out Of Memory Exception in the Cloud

Luis Munoz
2 min readOct 24, 2019

DevOps story. I needed a Jenkins instance to run some builds. I start-up the cheapest digitalocean.com droplet:

1 GB 1 vCPU 1 TB 25 GB $5/mo

The Jenkins website says

Recommended hardware configuration for a small team:
1 GB+ of RAM
50 GB+ of drive space

I install it and run my build. Crash Out Of Memory Exception.

Now the $5 dollar question is, what would you do?

I would bet most DevOp experts think my build is too resource intensive and I need to pay for a bigger instance (obviously), and they would be wrong.

When you go to your Linux console and type “free” you’ll see an overview of your system memory

$ free
total used free shared buff/cache available
Mem: 32813740 15806404 5965896 1226872 11041440 15316520
Swap: 0 0 0

What I find interesting is how swap by default is always 0 nowadays. Yet I remember back in the days running Windows 95 the standard was that everyone needed swap space or else obviously the program wouldn’t work. Now all the sudden swap space is terrible?

The fact is that many applications will work just fine when you add some swap space. From the perspective of the application it can now have double the RAM. When it accesses the RAM maybe it will slower, but most likely the application will be fine. We underestimate how smart the operating system is at putting the least used memory on the disk.

So guess what: Jenkins and my builds work just fine with swap space.