Harshit Saini
Harshit Saini
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
I'm stress testing complete user journey so I'm hitting around 13 endpoints which return response which vary in shape of empty response to a complex json response.
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
You are asking about expected success result or the erroneous result?
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
I did try hypercorn and it was quite effective in reducing error rate. However it does produce similar 503 Server Error type errors though in significantly less amount as compared to uvicorn.
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
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
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Yep, on my todo list 🙂
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Thanks for the info, will now dig deeper into fastapi/uvicorn then ...
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
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
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Maybe, but getting the 503 errors as mentioned above 😅
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Yep, have some plans for that, but for now I wanted to squeeze out performance from simple single worker config and see what it can deliver at its best ...
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
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
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Didn't configure it, using the defaults
27 replies
RRailway
Created by Harshit Saini on 9/4/2023 in #✋|help
Getting 503 Server Error during load tests
Project Id: a5a6f516-4f3a-4f38-979b-b0689c7e5ab7
27 replies