Page MenuHomePhabricator

Harden and speed up git-pkgs/proxy for heavy CI use
Open, Needs TriagePublic

Description

In CI, many jobs ask for the same packages at the same moment. These changes to git-pkgs/proxy, all merged upstream and released in 0.9.0 and 0.9.1, make it handle that well: each package and metadata document is fetched from the registry once however many jobs ask for it, a cold cache no longer returns errors under load, and cached requests are served at more than twice the throughput, with cached metadata up to 36 times faster.

ChangeBenefitPRMergedRelease
The file backend no longer writes a metadata sidecarReads of an artifact stay reliable while it is being cached#328yes0.9.0
Concurrent requests for an uncached artifact share one upstream fetchEach artifact is fetched from the registry once, however many jobs ask for it at the same moment#329yes0.9.0
Stale entries are replaced inside the shared fetch (requested by the maintainer)A re-published version is refreshed cleanly, with no request removing another's fresh entry#348yes0.9.0
Fixed the handler test build on mainTests and lint pass again for every open PR#362yes0.9.0
An eviction pass that cannot evict anything endsEviction stays cheap and quiet even when deletes fail#363yes0.9.0
Each fetch gets its own storage path (requested by the maintainer; feedback addressed)Fetches of one artifact from different URLs or digests never touch each other's bytes#367yes0.9.0
Cache hits are batched and written once a secondOn the integration-cache-proxy testing instance, more than doubles warm-cache throughput on SQLite, from about 1,000 to about 2,300 requests a second. On Postgres it halves database commits and cuts Postgres CPU by about 40%#383yes0.9.1
Concurrent requests for the same uncached metadata share one upstream fetchOn the integration-cache-proxy testing instance, cuts upstream metadata requests by about 85% with metadata caching off, and to exactly one per document with it on. Helps Composer most, whose metadata every CI job fetches#400yes0.9.1
Expanding Composer's minified metadata copies only the field it changesComposer metadata is rewritten about a third faster, with identical output#401yes0.9.1
Rewritten npm and Composer metadata is cached in memoryCached metadata requests are 15 to 36 times faster (for example 7.1 ms to 0.38 ms for @babel/core) and allocate almost nothing#402yes0.9.1

Event Timeline

Mhurd updated the task description. (Show Details)
Mhurd renamed this task from Harden git-pkgs/proxy for heavy CI use (fetch coalescing) to Harden and speed up git-pkgs/proxy for heavy CI use.Mon, Oct 5, 9:35 PM
Mhurd updated the task description. (Show Details)