New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate queries and slow performance with locations #4573
Comments
I don't know if this makes sense, but perhaps we could cache the queries to the tree for the duration of a single HTTP request? I searched for performance guidelines on the related project but didn't find anything very useful yet. |
Yeah, this is an unfortunate side effect of how we compute the |
I see this, but should a single one of those |
In 2.0, we added some basic caching of TreeModel.display fields as a part of #3702. Might be possible to pull part of that logic back into the LTM branch? |
Closed with 1.6.4, confirmed working. |
Environment
Steps to Reproduce
/api/dcim/locations
Expected Behavior
The API endpoint for locations or anything related to it is performant and doesn't perform an excessive amount of duplicate queries.
Observed Behavior
In a specific deployment with >100k locations, this is causing all endpoints that need to access
Location.display
(such as both the normal and the nested location API serializer) to exhibit very bad performance, because each individual query takes >1s, quickly summing to a minute for a normal pagination size.Notes
While unfortunately I am unable to reproduce the terrible performance outside of the specific environment, the duplication of queries is easily reproduced. If I then replace the
display
implementations of bothLocationType
andLocation
, there are no duplicated queries to the location tree left.The text was updated successfully, but these errors were encountered: