Skip to content

Reuse two authenticated chunks during byte-stream seeks - #116

Merged
carsonfarmer merged 1 commit into
mainfrom
cf/byte-stream-seek-cache
Sep 28, 2026
Merged

carsonfarmer merged 1 commit into
mainfrom
cf/byte-stream-seek-cache

Conversation

@carsonfarmer

Copy link
Copy Markdown
Owner

Repeated seeks during this repository's first Git push fetched each incoming-pack chunk 112 times. Cache the two most recently used authenticated chunks in ByteReader, evicting the older chunk before a cache miss awaits storage. Sparse reads, the durable format and publication protocol remain unchanged.

On the same 6,282-object history through local stock Spin/MinIO, backend traffic fell from 360,831,805 to 37,717,245 bytes (89.6%). Requests fell from 18,494 to 18,272; time changed only slightly, 16.58 to 16.12 seconds. Incremental push/fetch counters are unchanged, and cold clones pass strict fsck. The per-reader cache bound increases from 2 to 4 MiB; caller-held byte slices can retain evicted chunks.

Validation: full make check, strict native/WASIp2 checks, independent Rust correctness/simplification review, and tests for eviction, failed/cancelled reads, counters, authentication, slice ownership and expired views. The core runtime change is seven net lines. Closes #113.

Keep a fixed two-slot cache in ByteReader to avoid repeatedly fetching whole
storage chunks when sparse reads alternate between nearby offsets. Evict the
older slot before a miss and install new bytes only after authentication, so
failed or cancelled reads preserve the recent authenticated chunk.

Document the per-reader cache bound increase from 2 MiB to 4 MiB and cover
alternating reads, larger streams, eviction, failures, cancellation, and the
original view lifetime.

Co-authored-by: Codex <noreply@openai.com>
@carsonfarmer
carsonfarmer merged commit 5eb9e4a into main Sep 28, 2026
3 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.

Reduce Git push storage amplification on real repository history

1 participant