Skip to content

fix: remove unbounded Range parsing cache - #78

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/remove-range-cache
Oct 22, 2026
Merged

chenjiahan merged 1 commit into
mainfrom
chenjiahan/remove-range-cache

Conversation

@chenjiahan

Copy link
Copy Markdown
Member

Summary

The module-level Range cache retains every distinct file-size/header combination for the lifetime of the process. Parse Range headers directly, following Rsbuild, and pass the file size and header separately to avoid building and splitting cache keys. Existing Range and strong-ETag tests cover the behavior without adding new fixtures.

Performance

Local HTTP keep-alive benchmark on Node 24.19.0 / Apple M5 Max, with 16 concurrent requests and separate server/client processes. Seven alternating rounds per scenario; repeated 64 KiB ranges were additionally measured over five longer rounds (2 s warmup, 4 s measurement).

  • No-Range control: throughput within ±1.1% across the two runs.
  • Repeated 64 KiB Range: throughput −4.0% initially and −6.4% in the longer follow-up (20,668 → 19,342 requests/s).
  • Distinct 512-byte Range: throughput +1.7%; strong-ETag Range: −2.4% in the initial run.
  • After 50,000 distinct Range requests, median retained heap growth after GC fell from 12.76 MiB to 0.04 MiB (three rounds).

This trades repeated-range parsing cost for bounded retention; these synthetic measurements are not a general throughput guarantee. Status, response bytes, Content-Length and Content-Range were checked. The full suite passed: 4,208 tests, 2 skipped.

Related Links

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T04:02:51.705545Z 574ea39 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chenjiahan
chenjiahan merged commit 0936368 into main Oct 22, 2026
5 checks passed
@chenjiahan
chenjiahan deleted the chenjiahan/remove-range-cache branch October 22, 2026 04:11
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.

1 participant