vlingo / xoom-wire

The VLINGO XOOM platform SDK wire protocol messaging implementations, such as with full-duplex TCP and UDP multicast, and RSocket, using VLINGO XOOM ACTORS.
Mozilla Public License 2.0
13 stars 11 forks source link

Too much overhead from copying ByteBuffers #17

Closed buritos closed 4 years ago

buritos commented 4 years ago

My theory is that all the copying can be eliminated with some rearrangement of the code that performs the release. My gut feeling is that the code is structured in this way (eager to release) because of the limitations of the previous pool implementation (failure to meet demand). Given the scalable nature of the new implementation (we pay the price for it), it is ok to hold on to a buffer instance for longer, meaning that it is ok to release it at the final consumer, as long as the producers do not attempt to reuse it in any way (they should always acquire another buffer from the pool).

@alexguzun confirms (although a bit concerned about the rippling effects of changing the API for ManagedOutboundChannel::write). I believe we can work around that, preserving semantics of write(ByteBuffer) by overloading write to also accept ConusmerByteBuffer, then implement write(ByteBuffer) in terms of write(ConsumerByteBuffer), all of which are very local to wire.

Originally posted by @buritos in https://github.com/vlingo/vlingo-wire/pull/16#issuecomment-573054146

VaughnVernon commented 4 years ago

Addressed in #21