Skip to content
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

Post API performance pass #1551

Merged
merged 1 commit into from
Sep 10, 2020
Merged

Post API performance pass #1551

merged 1 commit into from
Sep 10, 2020

Conversation

chigby
Copy link
Contributor

@chigby chigby commented Aug 28, 2020

Refs #1533

This makes a first pass at improving performance via reducing the
number of database queries made by requests to the Posts API. Much of
what's being changed here is "low-hanging fruit" in the form of
applying prefetch_related and select_related to our initial query
to prevent further queries later.

In my local testing, this definitely reduced the number of queries
performed, and I'd be interested in seeing what the performance looks
like in the production environment before working too much more on
further improving the performance.

I'll note that one big source of additional queries is the
get_content_type function. Some of these queries, particularly ones
related to finding a page's wagtail-ancestor and its specific page
type, I am not sure exactly how to prefetch or if they can be (though
it may very well be possible).

This makes a first pass at improving performance via reducing the
number of database queries made by requests to the Posts API.  Much of
what's being changed here is "low-hanging fruit" in the form of
applying `prefetch_related` and `select_related` to our initial query
to prevent further queries later.

In my local testing, this definitely reduced the number of queries
performed, and I'd be interested in seeing what the performance looks
like in the production environment before working too much more on
further improving the performance.

I'll note that one big source of additional queries is the
`get_content_type` function.  Some of these queries, particularly ones
related to finding a page's wagtail-ancestor and its specific page
type, I am not sure exactly how to prefetch or if they can be (though
it may very well be possible).
@nmorduch nmorduch merged commit da96999 into master Sep 10, 2020
@nmorduch nmorduch deleted the post-api-performance branch September 11, 2020 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants