I’m using a 2GB Digital Ocean Droplet and I keep getting 500 errors when users are trying to post new comments.
I checked the server logs and I see them full of these 2 lines:
44:M 22 Feb 12:10:04.079 * 1 changes in 900 seconds. Saving…
44:M 22 Feb 12:10:04.079 # Can’t save in background: fork: Cannot allocate memory
Also, when I ssh into my droplet, I see that memory consumption is at 82%.
I tried updating everything to latest, resetting the machine, but nothing helps on the long run. It works ok for a bit an then starts throwing the errors again.
Even 1GB works fine, provided you have 2GB of swap, over a series of years running Discourse.
There are sometimes brief periods (usually during upgrades; it is strange to hear about this during regular use) where memory needs to be a bit larger.
It is definitely interesting to hear that no swap at all is affecting 2GB RAM instances cc @sam
@pfaffman The swap file seems to have fixed the issue so far. Thanks again! @codinghorror Let me know if you would like me to provide any other details that could be helpful in case you would like to investigate the possible cause. And thanks all for this great platform!
Btw, this is what I get now when running “free -h”
Sorry to bring this up from Februrary but whanted to ask if it’s normal to have intermittent Error 500 with ~80% memory usage (like the OP).
The site is under heavy usage, but just wanted to know if there is some kind of “estimations” for a correlation Users/VolumeOfTraffic - Memory.
I saw that a “Swap” was recommended, pardon my ignorance, but how do you achieve that, it’s recommended? Or is like removing the incorporated Rate Limiter (which was not recommended by Sam)
If you search the howto category here there is a topic about adding swap. Running without swap is definitely not recommened, unless you have well over 2GB of RAM on your server already allocated to Discourse.