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?
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 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.
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.
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.