How to find out about 504 errors and the reasons?

AI-generated summary

The user Pad_Pors reports 504 Bad Gateway errors on their Discourse instance hosted on a t2-small AWS instance with 2GB of swap, particularly when users like or edit topics. They inquire whether the issue stems from insufficient server resources, Cloudflare, or installed plugins. Genyus clarifies that Cloudflare is unlikely the cause, as the 504 error indicates a failure to connect to the upstream server, and while plugins can affect performance, themes generally do not. Pad_Pors notes their plugin list is small and finds the error not to be due to high traffic. They ask where the 504 errors are logged and why some users experience them while others do not. They also share admin log warnings, questioning if these could be related. Ultimately, Pad_Pors resolves the issue by removing the nginx reverse proxy and using nginx within Docker, referencing a guide here.

our users report some 504 bad gateway errors for accessing the instance: for example when they like a topic or try to edit their response.

the forum is on a t2-small aws instace, and the swap is 2g.

the memory usage is something like this:

image

  1. does the 504 error mean we need to extend our host and add some memory?

  2. may the error be due to the cdn (cloudflare)?

  3. may it be because of plugins and themes that are installed in our forum?

how can I find out what is the problem and how can I solve it?

thanks in advance for your help :heart:

It’s unlikely Cloudflare is the cause of this problem, the error you’re seeing is because it can’t connect to your AWS server upstream:

https://support.cloudflare.com/hc/en-us/articles/218378978-What-should-I-do-after-seeing-a-502-or-504-gateway-error-on-my-site-

Themes don’t have any significant performance impact AFAIK, but plugins can do, depending on which ones you have installed.

thanks, the installed plugins seems few to me:

from the link, what I got was that we don’t need to extend our host either; as the traffic is not that much to overload the server.

is this error being logged anywhere on the server or cloudflare or discourse admin panel?

also is there anyway to find out what has caused the error? I’m still little bit confused about the reason.

another important question:

why some users experience this error and some not? e.g. I’ve rarely faced this problem myself!

we have lots of warnings in the admin log panel:

may this warning be the reason for the 504 error? is it ok to have this much of warnings?

are the 504 errors logged anywhere?

this problem has been solved after we removed the nginx reverse proxy and used the nginx inside docker; steps explained here.