-
Notifications
You must be signed in to change notification settings - Fork 621
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
Increase publish performance of small message ~500% #463
base: master
Are you sure you want to change the base?
Conversation
By writing all 3 frames required for a publish in one go, and only locking and flushing the output buffer once we increase the performance about 3 times. Messages that spans over multiple body frames are still written one at a time, when messages are that large (>128KB) the locking and flushing is not the bottleneck, and it allows us to not allocate a dynamic array for each publish and allows us to use a fixed size array instead.
…sage By disabling TCP no delay (enable Nagle's algorithm) many small messages can be sent in a single TCP packet, we increase the publish rate about 100% when messages are small. This will not increase latency in any normal circumstances, but theoretically could if for instance one channel is publishing a message, and another channel is declaring a queue and then waiting for the CreateOK response, then due to a delayed ack from the server a 40ms delay could be added to the wait of the Queue CreateOK.
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.
This lumps together two unrelated changes. The second part of this PR is highly controversial. There are few things around networking that spark endless debates that the Nagle's algorithm and other settings related to TCP acks. Combining the two together honestly makes this pull request DOA because the risk of pissing off a large group of users is too high to accept it.
I'm curious if @streadway has an opinion on what the default should be.
RabbitMQ Java client sets So I am not convinced this client should adopt a different default. It can make it easy for the user to control the value. That would be something pretty unrelated to how framesets are written to the socket. |
Hey folks, I'm posting this on behalf of the core team. As you have noticed, this client hasn't seen a lot of activity recently. Because this client has a long tradition of "no breaking public API changes", certain We would like to thank @streadway Team RabbitMQ has adopted a "hard fork" of this client What do we mean by "hard fork" and what does it mean for you? The entire history of the project What does change is that this new fork will accept reasonable breaking API changes according If your PR hasn't been accepted or reviewed, you are welcome to re-submit it for Note that it is a high season for holidays in some parts of the world, so we may be slower Thank you for using RabbitMQ and contributing to this client. On behalf of the RabbitMQ core team, |
By writing all 3 frames required for a publish in one go, and only
locking and flushing the output buffer once we increase the performance
about 3 times.
Messages that spans over multiple body frames are still written one at a
time, when messages are that large (>128KB) the locking and flushing is
not the bottleneck, and it allows us to not allocate a dynamic array for
each publish and allows us to use a fixed size array instead.
By disabling TCP no delay (enable Nagle's algorithm) many small messages
can be sent in a single TCP packet, we increase the publish rate about
100% when messages are small.
This will not increase latency in any normal circumstances, but
theoretically could if for instance one channel is publishing a message,
and another channel is declaring a queue and then waiting for the CreateOK
response, then due to a delayed ack from the server a 40ms delay could
be added to the wait of the Queue CreateOK.