Fixing 100% CPU usage on DigitalOcean Ubuntu droplets

DigitalOcean offers $6 droplets (Virtual Machines) perfect for light workloads. I use it for my blog and love it because of its price and performance.

However, over the last couple of weeks, my blog has been acting up. I've been receiving downtime alerts from UptimeRobot. By the time I have a chance to take a look, everything goes back to normal.

However, I just got lucky 15 minutes back.

I could not reach my website:

Here's what the Digital Ocean dashboard showed me:

I tried to ssh into the VM. It made me wait for quite a bit, but it let me in eventually. The next thing I did was run htop to find the offending process. It was snapd. (I wish I had taken a screenshot.)

I do not use snap or care for it. I googled around and found a way to stop it:

systemctl stop snapd
systemctl disable snapd

And boy did that get my site back up and running!