Skip to content

Optimize database performance of the footer API #5530

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

Merged
merged 2 commits into from
Apr 3, 2019

Conversation

davidfischer
Copy link
Contributor

Currently, the number of database queries in the footer API depends on the number of versions of the project in question. This optimizes the API to always be a constant number of queries.

This PR partially fixes #3712 in that it fixes the major performance issues with the resolver when generating a number of URLs for different versions of the same project. Currently project.ordered_active_versions is only used by the footer API but anywhere else looking to generate URLs for a list of versions could use that function to get the same performance benefits.

The test case does seem a little bit brittle but I'm not sure what the best way to improve that is.

@davidfischer davidfischer requested a review from a team March 22, 2019 23:23
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid improvement! Will be curios to see how this improves performance on the footer API. I wonder if it's worth another PR to add these improvements to the version listing page, at the least?

@davidfischer
Copy link
Contributor Author

Will be curios to see how this improves performance on the footer API

This should be a large improvement but it's hard to say exactly how large it will be because footer API calls with 1-2 versions won't be improved as much.

I wonder if it's worth another PR to add these improvements to the version listing page, at the least?

That's a good idea.

@ericholscher ericholscher merged commit ac3185a into master Apr 3, 2019
@delete-merged-branch delete-merged-branch bot deleted the davidfischer/optimize-footer-api branch April 3, 2019 16:59
@ericholscher
Copy link
Member

Gonna ship this today.

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.

Improve URL resolver performance
2 participants