21 November 2015

Dealing with Intermittent Build failures due to Memory - Jenkins + EC2

It is not uncommon to see a Jenkins build failure due to a memory choke now and then while running thousands and thousands of rspec examples. The examples may be too much for the memory allocated within the EC2 instance. One simple solution is to enable Swap memory. Going through the typical EC2 route you need to have a dedicated Swap Partition. However if you feel you don't want to go through that route, you can simply do it via a swap file.

Make sure you have root access and follow these instructions to enable swap memory usage. Typically you could go from 1 to 2 times the allocated RAM but that is not a hard rule. In the current scenario I am going to elicit what I did.

Done! you may check whether this is enabled by typing the free command.


Note: This will only persist until the machine is running. If you reboot this will go away. If you still want to persist the swap after a restart you may do

Hope you find this article helpful. This is a trimmed down version of a wonderful article from DigitalOcean.

Cheers!
Braga

No comments: