Skip to content

AMQP 1.0, AMQP 0-9-1: dynamically adjust client connection socket buffer size #13363

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

Merged
merged 1 commit into from
Feb 27, 2025

Conversation

lhoguin
Copy link
Contributor

@lhoguin lhoguin commented Feb 18, 2025

No description provided.

@michaelklishin michaelklishin changed the title DO NOT MERGE Add dynamic buffer functionality to rabbit_reader DO NOT MERGE Add dynamic socket buffer functionality to rabbit_reader Feb 18, 2025
The `buffer` socket option will be changed dynamically
based on how much data is received.

This is restricted to AMQP protocols (old and 1.0).

The algorithm is a little different than Cowboy 2.13.
The moving average is less reactive (div 8 instead of 2)
and floats are used so that using smaller lower buffer
values is possible (otherwise the rounding prevents
increasing buffer sizes). The lower buffer size was
set to 128 as a result.

Compared to the previous which was to set `buffer` to
`rcvbuf` effectively, often to 131072 on Linux for
example, the performance sees a slight improvement
in various scenarios for all message sizes using
AMQP-0.9.1 and a lower memory usage as well. But
the difference is small in the benchmarks we have
run (5% to 10%), whereas Cowboy saw a huge improvement
because its default was very small (1460).

For AMQP-1.0 this seems to be no worse but we didn't
detect a clear improvement. We saw scenarios where
small message sizes showed improvement, and large
message sizes showed a regression. But we are even
less confident with these results. David (AMQP-1.0
native developer) ran a few tests and didn't see a
regression.

The dynamic buffer code is currently identical for
old and 1.0 AMQP. But we might tweak them differently
in the future so they're left as duplicate for now.
This is because different protocols have different
behaviors and so the algorithm may need to be tweaked
differently for each protocol.
@lhoguin lhoguin force-pushed the loic-dynamic-buffer branch from f988562 to 5344410 Compare February 27, 2025 11:48
@lhoguin lhoguin changed the title DO NOT MERGE Add dynamic socket buffer functionality to rabbit_reader Add dynamic socket buffer functionality to rabbit_reader Feb 27, 2025
@lhoguin
Copy link
Contributor Author

lhoguin commented Feb 27, 2025

Applies to both old AMQP and AMQP 1.0.

@lhoguin lhoguin marked this pull request as ready for review February 27, 2025 14:46
@lhoguin lhoguin requested review from ansd and mkuratczyk February 27, 2025 14:46
@lhoguin lhoguin merged commit 6c3789e into main Feb 27, 2025
269 checks passed
@lhoguin lhoguin deleted the loic-dynamic-buffer branch February 27, 2025 16:30
@michaelklishin michaelklishin added this to the 4.1.0 milestone Feb 27, 2025
@michaelklishin michaelklishin changed the title Add dynamic socket buffer functionality to rabbit_reader AMQP 1.0, AMQP 0-9-1: dynamically adjust client connection socket buffer size Feb 27, 2025
lhoguin added a commit that referenced this pull request Feb 27, 2025
Add dynamic socket buffer functionality to rabbit_reader (backport #13363)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy