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

Optimize the legacy JSON endpoints #11920

Merged
merged 15 commits into from
Jul 22, 2022
Merged

Optimize the legacy JSON endpoints #11920

merged 15 commits into from
Jul 22, 2022

Conversation

dstufft
Copy link
Member

@dstufft dstufft commented Jul 22, 2022

  • Denormalizes Release.is_prerelease to prevent burning CPU on computing it.
  • Drops the use of traversals which uses multiple unoptimized queries for one specifically optimized for this endpoint.
    • This will be a heavier query in the case of doing a redirect, but I believe we moved those to VCL.
  • Move classifier ordering into the database, and sync classifiers during deploy instead of on demand during upload.
  • Switches migrations to wrap each migration in a transaction instead of one transaction for all the migrations

Overall, with our development data, this took the legacy.api.json.release endpoint from 70ms to 12ms and from 12 queries down to 6.

Closes #11702

@dstufft dstufft marked this pull request as ready for review July 22, 2022 03:25
@dstufft dstufft requested a review from a team as a code owner July 22, 2022 03:25
@ewdurbin ewdurbin merged commit d8683b3 into pypi:main Jul 22, 2022
@dstufft dstufft deleted the optimize-json branch July 22, 2022 14:47
SamirPS pushed a commit to SamirPS/warehouse that referenced this pull request Aug 30, 2022
* Add Release.is_prerelease to denormalize prerelease data

* Migrate existing data and switch to using Release.is_prerelease

* Switch legacy JSON endpoints to a better performing query

* Move migration revision forward

* Move classifier ordering into the database

* Update trove-classifiers

* Use the new methods in trove-classifiers

* Fix tests

* reformat

* more test fixes

* Run each migration in it's own transaction

* Run 100000 updates per chunk

* reformat

* reformat
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.

2 participants