0

I'm new to working with ASGI and I'm having some performance issues with my Django API server so any insight would be greatly appreciated.

After running some load tests using JMeter it seems that the application is able to handle under 10 or so simultaneous requests as expected, but any more than that and the application's threads seem to lock up and the response rate vastly diminishes (can be seen in sample #14 and up on the 'Sample Time(ms)' column in the screenshot provided). It's as if requests are only being processed on 1-2 threads after that point as opposed to the configured 4. Here is my startup.sh config:

gunicorn --workers 8 --threads 4 --timeout 60 --access-logfile \
'-' --error-logfile '-' --bind=0.0.0.0:8000  -k uvicorn.workers.UvicornWorker \
--chdir=/home/site/wwwroot GSE_Backend.asgi

I am aware that the individual API responses are quite slow. That is something I want to address. However, is there perhaps something I am doing wrong on the ASGI level here? Thanks.

Edit: I have also added a second load test screenshot. This one uses an API that just sleeps for 10 seconds so should have little CPU/memory impact. A similar pattern occurs again where fewer and fewer requests are responded to at one time.

Server load test using database query apiServer load test using sleep api

4

0 回答 0