Skip to content

[runtime/iobuf/pool] improve buffer pool defaults#3860

Merged
patrick-ogrady merged 10 commits into
mainfrom
andre/runtime-improve-pool-defaults
May 22, 2026
Merged

[runtime/iobuf/pool] improve buffer pool defaults#3860
patrick-ogrady merged 10 commits into
mainfrom
andre/runtime-improve-pool-defaults

Conversation

@andresilva
Copy link
Copy Markdown
Member

No description provided.

@andresilva andresilva self-assigned this May 22, 2026
@andresilva andresilva moved this to Ready for Review in Tracker May 22, 2026
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 22, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
commonware-mcp 05605a6 May 22 2026, 09:08 PM

@andresilva andresilva requested a review from patrick-ogrady May 22, 2026 16:39
Comment thread runtime/src/iobuf/pool.rs
let cache_line = NZUsize!(cache_line_size());
Self {
pool_min_size: 1024,
pool_min_size: 0,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pool is now faster than going to the system allocator, so there's no reason to bypass it in the defaults.

Comment thread runtime/src/iobuf/pool.rs
pool_min_size: 0,
min_size: NZUsize!(1024),
max_size: NZUsize!(64 * 1024),
max_size: NZUsize!(128 * 1024),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? This means this pool will use 1GB of memory at peak, same as the storage pool below.

Comment thread runtime/src/iobuf/pool.rs
max_per_class: NZU32!(4096),
prefill: false,
alignment: cache_line,
alignment: NZUsize!(1),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually need any specific alignment here, and while this doesn't make any difference once the buffer is allocated and pooled the initial allocation is slower.

Comment thread runtime/src/iobuf/pool.rs
let page = NZUsize!(page_size());
Self {
pool_min_size: 1024,
pool_min_size: 0,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

Comment thread runtime/src/iobuf/pool.rs
Comment thread runtime/src/iobuf/pool.rs
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 22, 2026

Deploying monorepo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 05605a6
Status: ✅  Deploy successful!
Preview URL: https://c2bb93bc.monorepo-eu0.pages.dev
Branch Preview URL: https://andre-runtime-improve-pool-d.monorepo-eu0.pages.dev

View logs

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

Benchmark results

Tip

PASSED: No benchmark exceeded the regression threshold.

Benchmark comparison table
Benchmark Baseline (main) Current Delta Threshold Status
qmdb::merkleize/variant=any::unordered::fixed::mmr keys=10000 ch=false sync=false 1.586 ms 1.601 ms +0.92% 10.00% ✅ PASS
qmdb::merkleize/variant=current::ordered::fixed::mmb chunk=256 keys=10000 ch=true sync=false 3.072 ms 3.073 ms +0.03% 10.00% ✅ PASS

Baseline commit(s): a7e8f487bc33

Comment thread runtime/src/iobuf/pool.rs
Comment thread runtime/src/iobuf/buffer.rs
@patrick-ogrady
Copy link
Copy Markdown
Contributor

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 05605a6. Configure here.

@patrick-ogrady patrick-ogrady merged commit 979d2a2 into main May 22, 2026
176 checks passed
@patrick-ogrady patrick-ogrady deleted the andre/runtime-improve-pool-defaults branch May 22, 2026 21:16
@github-project-automation github-project-automation Bot moved this from Ready for Review to Done in Tracker May 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.77%. Comparing base (225574b) to head (05605a6).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
runtime/src/iobuf/mod.rs 77.77% 1 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main    #3860      +/-   ##
==========================================
+ Coverage   95.76%   95.77%   +0.01%     
==========================================
  Files         486      486              
  Lines      200680   201234     +554     
  Branches     4858     4876      +18     
==========================================
+ Hits       192180   192741     +561     
+ Misses       6866     6858       -8     
- Partials     1634     1635       +1     
Files with missing lines Coverage Δ
runtime/src/iobuf/buffer.rs 99.21% <100.00%> (-0.01%) ⬇️
runtime/src/iobuf/pool.rs 98.71% <100.00%> (+0.12%) ⬆️
runtime/src/lib.rs 97.78% <ø> (ø)
runtime/src/iobuf/mod.rs 99.77% <77.77%> (-0.07%) ⬇️

... and 30 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 225574b...05605a6. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants