I am running a Django server locally using runserver_plus with –nothreading option.
Sometimes I send a request to any endpoint (from different clients, like the React frontend running in Google Chrome, Django admin, or Postman) and it takes a very long time to respond (usually 1.5+ minutes). Let’s call the first request #1. While this request is being processed, if I open another tab and open any endpoints – thus, send request #2, the server immediately responds to request #2 and then immediately responds to request #1.
The processing of request #1 does not start executing until the processing of request #2 is finished.
To clarify: it is not a problem with the view related to request #1. I can’t understand why the request processing does not start for a while. Here is the data from the django debug toolbar profiling. The processing itself seems to be fast, but this request took 1.5 minutes to start processing.
Django 4.2, Django extensions 3.2, DRF 3.15. The development server is run in docker-compose. MacOS Sonoma 14.4.
5
The Google Chrome browser caused the issue in my case. It somehow affected requests sent with Postman after using Google Chrome. To test whether this is the cause of your problem, try switching to another browser and see whether the issue disappears.
I fixed this issue for Google Chrome by disabling the “Preload pages” setting on Google Chrome (chrome://settings/?search=Preload).