Skip to content

Conversation

@mdumandag
Copy link
Contributor

This is an optimization for the non-blocking usage where there are
multiple in-flight messages. We now coalesce them into a single buffer
and try to write it to the wire.

Before coming up with this solution, I tried a couple of different ones.
Here is the list of the main ones, and why they didn't work out:

  • Having a single, pre-allocated bytearray per connection, and copying
    message bytes into it. Even with the usage of memoryviews, slicing and
    copying were so expensive.

  • Implementing framed outbound client messages, and writing frame bytes
    into a write buffer in the reactor thread. That resulted in approx. %5
    throughput increase for balanced workloads.

This way of implementation results in approx. %10 throughput increase for
balanced workloads.

This is an optimization for the non-blocking usage where there are
multiple in-flight messages. We now coalesce them into a single buffer
and try to write it to the wire.

Before coming up with this solution, I tried a couple of different ones.
Here is the list of the main ones, and why they didn't work out:

- Having a single, pre-allocated bytearray per connection, and copying
message bytes into it. Even with the usage of `memoryview`s, slicing and
copying were so expensive.

- Implementing framed outbound client messages, and writing frame bytes
into a write buffer in the reactor thread. That resulted in approx. %5
throughput increase for balanced workloads.

This way of implementation results in approx. %10 throughput increase for
balanced workloads.
@puzpuzpuz puzpuzpuz self-requested a review December 15, 2020 11:14
@mdumandag
Copy link
Contributor Author

Thanks a lot for the review Andrey

@mdumandag mdumandag merged commit 47bbc12 into hazelcast:master Dec 15, 2020
@mdumandag mdumandag deleted the coalesced-writes branch December 15, 2020 11:25
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.

2 participants