Harshit Saini
Getting 503 Server Error during load tests
So I carried few more experiments to find the root cause of 503 Server Error type errors:
Experiment 1: Original Setup (Default uvicorn config)
Result: I found following response header and text
{'content-type': 'text/html', 'x-railway-fallback': 'true', 'content-length': '2942', 'date': 'Mon, 04 Sep 2023 10:01:25 GMT', 'server': 'railway'}
Text: A html page which says
<h1 class="error-404">Nothing here... yet</h1>
<h1 class="error-503">Application failed to respond</h1>
<a href="https://railway.app" target="_blank"> Go to Railway </a>
</main>
Experiment 2: Changed uvicorn's limit_concurrency to 10 in order to force induce 503 errors.
Result: {'date': 'Mon, 04 Sep 2023 10:17:40 GMT', 'server': 'railway', 'content-type': 'text/plain; charset=utf-8', 'transfer-encoding': 'chunked'}
Service Unavailable
From above experiments I see a difference between response headers mainly 'x-railway-fallback': 'true' being set when the 503 error is not thrown directly by uvicorn/fastapi in Experiment 1, plus I don't see 503 errors in the railway's Observability section in the same Experiment.
Whereas 'x-railway-fallback': 'true' is missing from headers in Experiment 2 and I see 503 errors in the railway's Observability section in this experiment.
Any ideas what this could mean?
27 replies
Getting 503 Server Error during load tests
Not sure if uvicorn is having trouble with handling 10 requests per second, I seen it deliver much more. I'm looking more deep into the cause. However I strongly feel 503 Server Error type errors are something a proxy or a load balancer would throw to rate limit requests. Wanted to check if railway has some mechanism/service which is blocking these request by certain criteria or is it more to do with fastapi/uvicorn?
27 replies
Getting 503 Server Error during load tests
Nope, my assumption is nixpacks is picking up main.py from project root, here is how main.py looks like
import os
from app import app
import uvicorn
if name == "main":
uvicorn.run(app, host="0.0.0.0", port=int(os.getenv("PORT", 8000)))
27 replies