I’m running two personal sites on a 1GB RAM DigitalOcean droplet and have been for several years (was actually at 512MB droplet until recently). Trying to upgrade from 1.21.6 to 1.22.1. I’m getting an error message now that Ghost recommends you have at least 150MB of memory available for smooth operation. It looks like you have 75 MB available.
Hey, this works just fine and has for a while, so I’ll just upgrade with ‘-force’. Well, that doesn’t work, it skips updating. Ghost Doctor gives me essentially the same error message.
The obvious version would be to upgrade to more than a 1 GB plan, I get it, but this has worked on a much smaller droplet for a long time. Anything I can do to get this to work?
So there’s a bug in the memory checker logic because of the way the native free memory library works. There is a fix in progress, but in the meantime you can add the --no-mem-check flag to ignore the check
I updated my droplet to Ubuntu 20.04 without any problems. But now when I try to update Ghost, I get the memory error as described in the thread linked above.
Based on the output of free, I’m inclined to think that you were legitimately low on memory…
can you try running free -h and then immediately running ghost restart to see if ghost complains about memory?
If free + buff/cache >= ~150MB Ghost should not complain, but there are times where the buff/cache is not accounted in the lib.
ghost run should only be used for debugging since there is nothing to restart the Ghost process is if it crashes, and it won’t be running under the correct conditions.
FYI: I think that this should be split into a separate issue, but I didn’t see a way to do that. @vikaspotluri123, is that possible and necessary?
========
Although the memory warnings have stopped with the larger swap file, I used top to find out what processes are running. The culprit was mysqld, so I logged into the database and looked at the process list.
I have four processes running but I only have two Ghost instances, so I assume that these are unnecessarily doubled, correct? The processes are:
It might make sense that there are 2 ghost processes because there’s the ghost run process which performs validation (and is relatively lightweight), and the actual Ghost process itself. ref
@ScottSemple those are database connections not outright processes, it’s expected that there are at least 2 per Ghost instance because Ghost uses connection pooling to prevent requests being blocked waiting for database queries to finish. The number of connections will grow under heavier traffic then fall back down to 2 with low traffic.
Database connections are fairly light weight on their own but may have query caches using memory if that memory is freely available. If you have a particularly large site then the mysql memory usage as whole would be higher as more of the database is kept in memory to keep things running smoothly.
You can optimise mysql memory usage for lower-memory systems if needed. There are quite a few generic guides for that from a quick google search but you’ll need to understand your system usage and where potential bottlenecks are based on your specific requirements to avoid causing performance problems.
Both blogs are small with little traffic. I never had any memory warnings until I upgraded Ubuntu to 20.04. Then I regularly got the sub-150MB warning from Ghost. It never warned on ghost restart.
Increasing my swap file to 2GB got rid of the warnings, but usage is still close to 1GB. I haven’t been able to figure out why.
@ScottSemple Having this exact same issue on Ubuntu 22.04 while upgrading to latest release of Ghost 4 (in prep to jump to v5). Has anyone figured out why memory usage has gotten so high on these version of ubuntu, and how to avoid it?