Page MenuHomePhabricator

Improve performance of repository discovery in repositories with >65K refs
ClosedPublic

Authored by epriestley on Jan 26 2021, 7:10 PM.

Details

Summary

Ref T13593. The commit cache in this Engine has a maximum fixed size (currently 65,535 entries).

If we execute discovery in a repository with more refs than this (e.g., 180K), we get fast lookups for the first 65,535 refs and slow lookups for the remaining refs.

Instead, divide the refs into chunks no larger than the cache size, and perform an explicit cache fill before each chunk is processed.

Test Plan
  • Created a repository with 1K refs. Set cache size to 256. Ran discovery.
    • Before patch: saw one large cache fill and then ~750 single-gets.
    • After patch: saw four large cache fills.
  • Compared bin/repository discover ... --verbose output before and after patch for overall effect; saw no differences.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.