-
Notifications
You must be signed in to change notification settings - Fork 2
Find out the cause for long DRF response delays on the api/histogram_data_files/
endpoint
#30
Comments
@XavierAtCERN mentioned This provides some insights to the cpu time each page render takes. LocallyOn deployment |
Things to check
After testing, the custom Disabling pagination completely has also no impact. In fact, the response takes surprisingly less time than anticipated to render 6000+ results (same execution time as with 50 results):
Disabling API authentication completely has some, but not substantial, effect on performance
Adding the
|
SolutionA As this path was pointing to EOS, Django, when trying to populate a list of all available files in the specified directory, took somewhere between 20s and 3 minutes (depending on EOS load, I guess) for every API query. This explains why, for a single results page (50 results, serialized with the Making this field a 💀 Moral of the storyDon't use |
api/histogram_data_files/
endpoint
Description
Upon deployment, the ML Playground displays very long delays in rendering responses through the DRF API.
Initially, we were getting lots of
Broken pipe
messages, which were due to the proxy cutting off the connection due to the server not responding in time. Then, by increasing the proxy timeout to 180s, we were able to proceed with debugging the issue.Example 1
Example 2
Things we've tried
daphne
withasgi
undersettings.py
gunicorn
withwsgi
undersettings.py
manage.py runserver
daphne
. Responses take up to 2 seconds, maximum, meaning that the database is not the problem.DEBUG
. No change.settings.py
, so that we can see what's going on in Django's mind while rendering that. You can see below that the queries themselves are fast. A long time is spent between the lastSELECT
query and the start of theHTTP 200
response (~2.5 min).Other notes
Even after a
504
error, on the immediate next reload of the same page the page loads instantly (due to a 1-min cache of the responses), meaning that the response has already been cached from the first request, even if has not been returned to the client.Summary
We need to 👽probe deeper👽 to what's going on inside Django between the end of the DB query and the start of the HTTP response.
The text was updated successfully, but these errors were encountered: