Reuse buffers in ServerMessage<BsatnFormat>#2911
Merged
Conversation
f4b0fb9 to
ed80830
Compare
Collaborator
|
Can you make the first commit its own independent PR? |
Contributor
Author
Will do 👍 |
0e9622d to
6b90886
Compare
5f2394e to
b961e78
Compare
This was referenced Jul 4, 2025
b961e78 to
bbeec32
Compare
a7aa61a to
b0cc2d4
Compare
fa008fb to
9411e5e
Compare
f3be26f to
f112436
Compare
d23f3ff to
72a3dab
Compare
kim
approved these changes
Dec 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Fixes #2824.
Defines a global pool
BsatnRowListBuilderPoolwhich reclaims the buffers of aServerMessage<BsatnFormat>and which is then used when building newServerMessage<BsatnFormat>s.Notes:
BsatnRowListBuilderPoolreports the same kind of metrics to prometheus asPagePooldoes.BsatnRowListBuildernow works in terms ofBytesMut.fn to_bsatn_extendis redefined to be capable of dealing withBytesMutas well asVec<u8>.ConsumeEachBufferis defined fromServerMessage<BsatnFormat>and down to extract buffers.<ServerMessage<_> as ConsumeEachBuffer>::consume_each_buffer(...)is then called inmessages::serialize(...)just after bsatn-encoding the entire message and before any compression is done. This is the place where the pool reclaims buffers.Benchmarks
Benchmark numbers vs. master using
cargo bench --bench subscription -- --baseline subson i7-7700K, 64GB RAM:The improvements in
footprint-scanare mostly thanks to #2918, but 7 ms of the improvements here are thanks to the pool. The improvements tofull-scanshould be only thanks to the pool.API and ABI breaking changes
None
Expected complexity level and risk
2?
Testing
Pool<T>also apply toBsatnRowListBuilderPool.