I’m having troubles with my Digital Ocean memory usage (base droplet with 1GB of RAM). I’m trying to set up one Ghost site with 2 posts for now and virtually no traffic (a lot of theme changes/uploads though), but the memory graph hits 100%. free -h command indicates only 56MB free memory…any recommendations?
Website data
URL: https://blog.damahealth.com/
Version: 5.12.0
Environment: Production
Database: mysql8
Mail: SMTP
Restart your server and on a fresh boot, see how much memory is being used. You’ll then have a better baseline to see how much Ghost is using on top of that
Start Ghost. Recheck memory usage.
You’ll then have a bit better sense of memory usage. You’re also paying for 1GB — might as well use as much of it as you can
Here are a couple tricks I use to maximize my memory on digital ocean. I recently shared theses tips plus more in a medium article. I was trying to host multiple ghost blogs on one droplet so these tweaks were important.
Optimizing your Digital Ocean Droplet
Swap File
Swap is a space on a disk that is used when the amount of physical RAM memory is full. When our droplet runs out of RAM, inactive pages are moved from the RAM to the swap space. The swap file will not be as fast as ram, but it will definitely help.
Note: If you have 1GB of RAM, then it is recommended that your swap file be 2GB.
Log Rotation
The Ghost blog platform doesn’t automatically set up log rotation when it is installed. As a result, Ghost will perpetually append to its log files until you run out of disk space. Setting up log rotation will ensure you only keep one week’s worth of ghost logs.
Adding the free version of Cloudflare will improve performance by blocking bad actors as well as caching your site on their CDN, which decreases the load on your server.
Regarding your htop results, who is using a 39% of memory is MySQL, I faced with the same problem with a blog using the AWS free tier with 1G, I configured the minimal configuration for MySQL and the MySQL RAM usage drop down almost 40% and I added a script to free up RAM every certain time using a cronjob. You can find how I did it here https://danfercf.info/how-to-add-a-ram-free-up-script-into-raspbian-for-a-raspberry-pi-2-b/ it’s for a Raspberry but I used the same for the AWS EC2.
I think 1GB is the bare minimum required by Ghost. I was having this exact same issue. I actually upgraded to a 2GB memory server and still faced around 60-80% load when running free
My solution was to switch entirely to a self-hosted Contabo VPS where they offer much more memory for a much better price.
While with Digital Ocean I had to spend weeks to figure out to how optimize and update the Droplet, with Pikapods I didn’t even spend 5 minutes in their admin panel, because it’s 100% managed and it never crashes like Digital Ocean.
They take care of Ghost updates, emergency backups and so on for a fraction of the price. Also, to setup the Ghost newsletter is very simple: just fill the ENV Vars form in the pod options with your Mailgun credentials, and you are good to go.
Since my last message in this topic I migrated everything to a basic server on Contabo. The price is 4.5€+VAT/month with more than enough space. I use it to power 4 Ghost blogs, one static HTML site and Plausible analytics. It is a bit of work but still, works perfect. Highly recommended!
Well damn, I have just migrated from Ghost Pro to DigitalOcean (1 week ago) and you told me this! I will migrate again and hopefully stay there for more than a week lol
Price aside, I think you can stay with Digital Ocean a few more months if you don’t need to update Ghost and have days of time to setup and customize everything. After one year I honestly gave up, I don’t have time for that…
it’s not about the price, it is about the management. I am also surprised that I had to do all that swap, log, mysql optimization, etc. stuff. Also you said PikaPods update droplets themselves, with DigitalOcean I see I have to update with ghost-cli. They also give some % to open-source projects. Basically, it is amazing and exactly what I was looking for.
I should have 2 month free in DigitalOcean so I am not in a hurry. Other self-hosted Ghost users should know about PikaPods, and maybe PikaPods should also have a referral program…