Swap On!

Swap On!
Superhero who brings virtual memory to people in need.

I've never had stability issues with my VPS provider of choice ... until I started using Ghost. As soon as I started publishing posts, the whole VPS would freeze up and I'd have to force reset it. It felt as though if I were gentle with the system, it would remain stable, longer. So weird.

I went back-and-forth with support. I thought maybe the underlying hardware might be at fault. They determined no other VPSs were reporting stability issues. Somehow, they thought to point out that swap is off by default.

Underlying Ghost is MySQL. It would manage to consume all available RAM, at which point everything else stops working, which is entirely expected on a system running without virtual memory.

So, yeah, for future reference, enable swap on your VPS if it isn't already (if you might run out of RAM).

Some links I found with step-by-step instructions for enabling swap, summarized here (mostly so that I can quickly find this next time around):

sudo swapon --show
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show

Additionally, don't neglect to add the swap file to your fstab so that it starts at boot:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

The best way to get the kids to fall asleep without going through the entire bedtime routine is to “snipe” them: you put on a tv show, but it is a boring tv show. They’ll enthusiastically watch the tv because, well, it’s the tv. They’re lulled into a sense of safety that they’re getting something that they want (or so they think), but then it turns out to be a ~2 hour show on refueling a nuclear power plant, and before you know it (before they know it?), they’re asleep.


GoDaddy - Enable swap on my VPS Hosting
Turn on swap to troubleshoot memory issues on your server.
Using SWAP on VPS - Knowledge Base
Learn how to use SWAP on a VPS to improve performance and ensure the stability of your server. Understand how to configure and optimize virtual memory usage in your virtual environment.
How To Add Swap Space on Ubuntu 22.04 | DigitalOcean
One way to guard against out-of-memory errors in applications is to add some swap space to your server. In this guide, we will cover how to add a swap file t…
How to Set Up SWAP on Hostinger VPS
Configuring and Optimizing SWAP memory for enhanced perform

Subscribe to A garage sale for your mind

Don’t miss out on the latest posts. Sign up now to get access to the library of members-only posts.
[email protected]
Subscribe