Repository navigation
Refresh HTTP cache policies in place - #22052
Conversation
9bfd20d to
60895fe
Compare
uv test inventory changesThis PR changes the tests when compared with the
|
| let path = cache_entry.path().to_path_buf(); | ||
| let span = Span::current(); | ||
| let payload = tokio::task::spawn_blocking(move || { | ||
| span.in_scope(|| { |
There was a problem hiding this comment.
We can give this its own scope so it shows up separately in traces
| /// Reading the format is done via an `AlignedVec` so that `rkyv` can correctly | ||
| /// read the archived representation of the data blob. The cache policy is | ||
| /// split into its own `AlignedVec` allocation. | ||
| /// Each file contains the payload, a random 16-byte generation ID, the archived |
There was a problem hiding this comment.
My read of below is that we use it to prevent an accidental clobber of another cache write, i.e. due to concurrency. But calling it a "generation" is arguably confusing since that implies an incrementing value, not a random ID like it currently is 🙂
Specifically here: https://github.com/astral-sh/uv/pull/22052/changes#diff-a327e08abfc6c0f1a83a8c92ad294c17f1b410f5133b1e81ccbdc76008c1f8b0R1057
Merging this PR will improve performance by ×3.8
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
We revert the cache-format stack so `main` retains the 0.12 cache formats and bucket versions. These changes are deferred to 0.13. This reverts the following PRs together, including the six cache bucket bumps and the serialization and Windows lock-name changes that depend on them: - #22052: Refresh HTTP cache policies in place - #22059: Store source distribution revision IDs inline - #22060: Remove the legacy hash digest cache representation - #22061: Derive serialization for cached artifact records - #22062: Use bounded wheel cache lock names on Windows - #22078: Pack HTTP cache policy flags and optional integers - #22079: Align cached HTTP policies within the payload buffer
Reapplies #22052 for 0.13. We now update the HTTP cache policy in place on a 304 response, avoiding a rewrite of the cached payload. The format change bumps the six cache buckets containing HTTP responses. Original benchmarks from #22052 on Linux/ext4, with 96 entries and 16 concurrent requests per batch (`c9dab42be` → `1562e401b`, using SeaHash): | Warm-cache workload | Main | PR | Paired change | |---|---:|---:|---:| | 304 refresh, 256 KiB | 80.39 ms | 9.84 ms | 87.4% faster | | 304 refresh, 1 MiB | 323.20 ms | 17.59 ms | 94.6% faster | | Fresh reads, 4 KiB | 0.711 ms | 0.712 ms | Approximately unchanged | | Fresh reads, 256 KiB | 2.140 ms | 2.112 ms | 2.9% faster | | Fresh reads, 1 MiB | 7.529 ms | 7.698 ms | No clear difference |
Reapplies #22052 for 0.13. We now update the HTTP cache policy in place on a 304 response, avoiding a rewrite of the cached payload. The format change bumps the six cache buckets containing HTTP responses. Original benchmarks from #22052 on Linux/ext4, with 96 entries and 16 concurrent requests per batch (`c9dab42be` → `1562e401b`, using SeaHash): | Warm-cache workload | Main | PR | Paired change | |---|---:|---:|---:| | 304 refresh, 256 KiB | 80.39 ms | 9.84 ms | 87.4% faster | | 304 refresh, 1 MiB | 323.20 ms | 17.59 ms | 94.6% faster | | Fresh reads, 4 KiB | 0.711 ms | 0.712 ms | Approximately unchanged | | Fresh reads, 256 KiB | 2.140 ms | 2.112 ms | 2.9% faster | | Fresh reads, 1 MiB | 7.529 ms | 7.698 ms | No clear difference |
Reapplies #22052 for 0.13. We now update the HTTP cache policy in place on a 304 response, avoiding a rewrite of the cached payload. The format change bumps the six cache buckets containing HTTP responses. Original benchmarks from #22052 on Linux/ext4, with 96 entries and 16 concurrent requests per batch (`c9dab42be` → `1562e401b`, using SeaHash): | Warm-cache workload | Main | PR | Paired change | |---|---:|---:|---:| | 304 refresh, 256 KiB | 80.39 ms | 9.84 ms | 87.4% faster | | 304 refresh, 1 MiB | 323.20 ms | 17.59 ms | 94.6% faster | | Fresh reads, 4 KiB | 0.711 ms | 0.712 ms | Approximately unchanged | | Fresh reads, 256 KiB | 2.140 ms | 2.112 ms | 2.9% faster | | Fresh reads, 1 MiB | 7.529 ms | 7.698 ms | No clear difference |
Reapplies astral-sh#22052 for 0.13. We now update the HTTP cache policy in place on a 304 response, avoiding a rewrite of the cached payload. The format change bumps the six cache buckets containing HTTP responses. Original benchmarks from astral-sh#22052 on Linux/ext4, with 96 entries and 16 concurrent requests per batch (`c9dab42be` → `1562e401b`, using SeaHash): | Warm-cache workload | Main | PR | Paired change | |---|---:|---:|---:| | 304 refresh, 256 KiB | 80.39 ms | 9.84 ms | 87.4% faster | | 304 refresh, 1 MiB | 323.20 ms | 17.59 ms | 94.6% faster | | Fresh reads, 4 KiB | 0.711 ms | 0.712 ms | Approximately unchanged | | Fresh reads, 256 KiB | 2.140 ms | 2.112 ms | 2.9% faster | | Fresh reads, 1 MiB | 7.529 ms | 7.698 ms | No clear difference |
We now update the HTTP cache policy in place on a 304 response, avoiding a rewrite of the cached payload. The format change bumps the six cache buckets containing HTTP responses.
Warm-cache benchmarks on Linux/ext4, with 96 entries and 16 concurrent requests per batch (
c9dab42be→1562e401b, using SeaHash):