Troubleshooting 504 errors?


I am running a Discourse installation on a DO droplet with 2GB Ram, 40GB SSD, and for almost two years, everything has been running well, until suddenly we’ve noticed a lot of slowdowns and 504 errors.

I’ve noticed that almost the entire 2GB of RAM is consumed (according to htop), but isn’t swapping much, but the big user it seems is sidekiq, and the unicorn workers.

I rebooted the server about 8hr ago and it seemed to work but then returned to having sporadic 504 errors.

I was wondering if these amounts of CPU/RAM usage are normal? If not, how can one go about finding the root of the issue to aid in the troubleshooting process?

(Jeff Atwood) #2

What version are you on? Do you have the required 2gb swap? I recommend updating to latest via ssh.


I’m currently on v1.7.0.beta5 +196

The droplet has 1 gig of swap enabled, but only seems to be using 5mb of it, so swapping doesn’t quite seem to be the issue from what I can tell. Regarding storage, the disk has 11GB of 40GB remaining, so that doesn’t quite seem to be the problem either from what I can tell.

I can try to update to the latest, or should I also perhaps not be using the beta stream in a production environment?

(Jeff Atwood) #4

Being on latest (tests-passed) is what we always recommend unless you have compelling reasons to do otherwise. You will want 2GB swap for rebuilds at a minimum.


Ok, I’m not sure how true the matter is, but Digital Ocean recommends against swapping on their SSD drives due to drive degradation, so I’ve upgraded our droplet to have more actual RAM, but is more swap still necessary? It’s a bit confusing since our original droplet was swapping so little anyways?

(Joshua Rosenfeld) #6

From Matt in a previous topic:

For normal, everyday usage, most sites are just fine with 1 GB of RAM. When upgrading, significantly more RAM is needed, hence the need for swap when using less than 2 GB of physical RAM. Since you stated your droplet was swapping minimally, I doubt you need more RAM for day-to-day operations. Certainly up to you (your money) but you very likely can go back down in droplet size once the upgrade is complete.


Thanks for the response, I’m just wondering then what could be causing the 504 errors if it isn’t indeed the swapping/ram as an issue? Is it simply the version of Discourse then? I am wondering what metrics/logs I could look at to try to get to the bottom of the 504s - or what the 504 is most typically caused by? (too little cpu, ram, disk issues etc?)

(Joshua Rosenfeld) #8

Unfortunately that’s beyond my knowledge. You’ll need someone with more sysadmin experience to chime in.

(Matt Palmer) #9

Tracking down 504s is all about what’s in your logs. Trace the request in at each step, examining the logs and looking for reports of problems.