Fixing Ghost Blog crashing on Digital Ocean Basic 1 GB Droplet

Electroica
Electroica Blog
Published in
4 min readSep 22, 2023

I was using WordPress earlier but decided to migrate to Ghost CMS for my website ( blog.electroica.com) and decided to self-host it on a digital ocean droplet.

Everything was fine until the traffic on the website started to increase. The droplet started to shut down frequently. Thanks to the Uptime monitor for sending a “downtime” notification to my email.

What is Uptime monitor: To monitor my site’s uptime I use Uptime robot’s free plan which checks the status of my website at every 5 mins and notifies me via email if the website is down. I have been using it uptime robot for my other blogs also and it does a good job to keep a check of a website’s live status.‌

Investigating the Issue with the droplet

I contacted the digital ocean support center to look into the problem and resolve it. The support was prompt, there was no issue with their server the issue was with my droplet. They asked me to monitor the CPU usage of the droplet and check for processes that are consuming high CPU resources.

It is not a CPU usage problem.

Although the CPU usage spiked before and after the droplet shuts down It is not the real cause of the problem because the CPU usage stays unbelievably low (1%-2%) mostly.‌

It is a memory issue

While googling the issue I came across a similar problem faced by users hosting their website on digital ocean droplets. Some of the answers suggested adding a “swap memory”.

This lead me to check for the memory usage trend of the droplet and Voila I found the issue “The memory” was on fire🔥 100% consistently.‌

Solving the 100% memory issue in Digital ocean Basic 1 GB RAM droplet

Do not upgrade if you have low traffic, just add a swap memory, tutorial on how to add a swap memory safely is below.

What is a Swap memory?

Swap memory/ swap files are used in a Linux file when the RAM is full, it act as virtual RAM. It is slower than the physical RAM as it uses HDD space.

[FIX] Adding Swap to Digital Ocean droplet

I used this tutorial on the digital ocean community to create the 3 GB swap file in the droplet.‌

The tutorial is well-documented and I didn’t face any issues while following it.

In no time I successfully created Swap space in the Linux system 🥳.

Result after adding Swap memory

After adding the swap memory I haven’t observed any downtime or abrupt shutting down of the droplet.

However, there was an increase in the disk usage of the droplet, the reason being the Swap file created on the HDD.‌

So far adding a swap proved to be a solution to mitigate the high memory usage and abrupt shutting down of the droplet.‌

I hope this helps and solves your problem too.

P.S. Use an uptime monitor to track your site status.

Originally published at https://blog.electroica.com on September 22, 2023.

--

--