Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions runtime/src/iobuf/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,13 @@ impl BufferPoolConfig {
/// Cache-line alignment is used because network buffers don't require page
/// alignment for DMA, and smaller alignment reduces internal fragmentation.
pub const fn for_network() -> Self {
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
patrick-ogrady marked this conversation as resolved.
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.

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.

parallelism: NZUsize!(1),
thread_cache_config: BufferPoolThreadCacheConfig::Enabled(None),
}
Expand All @@ -212,12 +211,12 @@ impl BufferPoolConfig {
pub fn for_storage() -> Self {
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.

min_size: page,
max_size: NZUsize!(8 * 1024 * 1024),
max_per_class: NZU32!(64),
prefill: false,
alignment: page,
alignment: NZUsize!(1),
Comment thread
patrick-ogrady marked this conversation as resolved.
Comment thread
cursor[bot] marked this conversation as resolved.
parallelism: NZUsize!(1),
thread_cache_config: BufferPoolThreadCacheConfig::Enabled(None),
}
Expand Down
Loading