In this quick tutorial, I'll show you how I reduced the RAM usage of Ghost and MySQL on my DigitalOcean Droplet. I'm using the cheapest available droplet, which you can get for 5$ per month. So let's get started!

The solution to this problem is pretty straightforward. You restart both Ghost and MySQL. For MySQL, you have to tweak some pieces to reduce its RAM usage even more. But for now, let's do it for Ghost.

ghost restart

For MySQL, we need to do a little bit more. After a little bit of research, I found out that MySQL has something called a performance schema. It allocates memory at the start of mysqld (this is just the command to use MySQL) instead of as it is needed, which can help with caching and performance under load. But since I use my DigitalOcean droplet as Ghost CMS for my actual website, I do not need these optimizations. So I can safely disable it.

And here's how you do it in Ubuntu.

First, get access to your server via terminal. With the following command, you open the file where you can disable the performance schema of MySQL.

sudo vim /etc/mysql/my.cnf

Then hit i on your keyboard. Through this, you can edit the file now. Add these two lines at the end.

performance_schema = off

After that, hit the escape-button. Then write wq, which stands for save and quit.

The last thing to do is to restart MySQL with

service mysql restart 

That's it! Now you can check how much RAM Ghost and MySQL are using with the command top. To sort the list by RAM usage, hit the key M.

Hopefully, this post helped you to reduce the RAM usage of your DigitalOcean Droplet. If you liked it, please share it with others who might encounter the same issue! Until next time, all the best!

With this link below you get $100 in credit over 60 days on DigitalOcean. In my case, this would be equivalent to a subscription period of 16.5 months. The link below is an affiliate link, so that means when you've spent your first $25 of your $100 free credits on DigitalOcean, I'll get a  little commission on that. If you want to support my blog, don't hesitate and use the link below. Otherwise, feel free to use Google and search for DigitalOcean. You've got the full choice!

DigitalOcean Referral Badge