-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use version of chainbase which implements a slab allocator for small size buffers. #1070
base: main
Are you sure you want to change the base?
Conversation
Note:start |
@@ -2191,6 +2195,7 @@ struct controller_impl { | |||
section.read_row(rows_for_this_tid, db); | |||
read_row_count.fetch_add(2u, std::memory_order_relaxed); | |||
|
|||
// utils_t::preallocate(db, rows_for_this_tid.value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this would help, but upon testing it didn't seem to make a difference, so I commented it out. I thought that maybe we'd want to experiment further in the future which is why I left it commented out. In any case I probably should add a comment that it doesn't appear to make a difference.
Resolves #1049.
As the issue describes, the current chainbase does a lot of small buffer allocations directly through the bip allocator which hits the segment manager directly. Not only this is inefficient (the rbtree of free buffers need to be rebalanced for every alloc/free), it also has a higher memory overhead.
The slab allocators for small buffers (in the updated chainbase submodule) batches allocations of small buffers into larger blocks, reducing the fragmentattion within the shared memory segment, and providing better efficiency and a smaller memory footprint.
For comparison, here are some results comparing snapshot loading on my linux box (release build)
snapshot from Aug 11, 2024
snapshot from Sept 29, 2024
I also expect a slight performance increase for processing transactions, as the
_undo_stack
deque allocations used to go through the segment allocator as well (for blocks of 16undo_state
), and these allocations are now batched.Associated chainbase PR
AntelopeIO/chainbase#54