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

Invalidation performance improvement #2057

Merged
merged 4 commits into from
Jan 20, 2025
Merged

Conversation

habdelra
Copy link
Contributor

@habdelra habdelra commented Jan 17, 2025

This PR improves invalidation performance. I've used EXPLAIN ANALYZE on our query that discovers files to invalidate. In doing so I've found that our SORT incurs unnecessary overhead (there is no need to sort these results, they are not displayed), as well as our COALESCE which actually subverts our GIN index on the deps column. Also, I added a new compound index on the type and realm_url columns as indicated in the EXPLAIN. These items together cut the invalidation query to about <10ms in staging (which amounts to a lot in the aggregate).

The much bigger item, tho, is to skip the retrieval of the ignore rules when there are no ignore rules (which is almost all the time). This saves about 8-10 sec on the from-scratch indexing when booting.

TODO:

  • measure performance after prod deployment

@habdelra habdelra changed the title Invalidation improvement Invalidation performance improvement Jan 17, 2025
Copy link

Host Test Results

    1 files  ±0      1 suites  ±0   23m 45s ⏱️ + 2m 5s
729 tests ±0  727 ✔️ ±0  2 💤 ±0  0 ±0 
734 runs  ±0  732 ✔️ ±0  2 💤 ±0  0 ±0 

Results for commit d3f0987. ± Comparison against base commit cc54e6e.

@habdelra habdelra requested a review from a team January 17, 2025 16:40

let ignoreFile = new URL('.gitignore', url).href;
// it costs about 10 sec to try to get the ignore file when it doesn't
// exist, so don't get it if it's not there.
Copy link
Contributor

Choose a reason for hiding this comment

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

wow 😯

@habdelra habdelra merged commit 8ea6f45 into main Jan 20, 2025
47 checks passed
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