[
https://issues.jboss.org/browse/JGRP-1989?page=com.atlassian.jira.plugin....
]
Bela Ban commented on JGRP-1989:
--------------------------------
You don't give up, do you? :-)
Even the most light-weight impl adds ~16 bytes to every message [1], and I'm not
willing to add that cost.
Looking at my previous comment, that may not even be necessary, because it seems we can
reuse buffers *for sure* for 75% of our use cases:
* Sending of message batches: OK
* Sending of single messages: OK
* Reception of message batches: OK
* Reception of single messages: MAYBE
The last 25% (reception of single messages) is (1) not a big use case as most messages are
received as batches anyway and (2) we could come up with requirements for how the
{{receive()}} callback needs to use the buffer in the message argument. For instance, we
could say that a buffer needs to be read and data in it needs to be de-serialized before
{{receive()}} returns, or a copy has to be made. I also need to look at how retransmission
is affected in {{NAKACK2}} and {{UNICAST3}}.
Actually, most callbacks do perform de-serialization right away, with some exceptions
(e.g. Async Invocation API), so they should be conformant.
[1]
https://github.com/belaban/workshop/blob/master/slides/status2015.adoc#si...
Bundlers: reuse send buffer when transport == sync.
---------------------------------------------------
Key: JGRP-1989
URL:
https://issues.jboss.org/browse/JGRP-1989
Project: JGroups
Issue Type: Enhancement
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 3.6.7
With the addition of {{TCP_NIO2}}, all bundlers now create new send buffers for every
message (or message list). This generates a lot of memory allocations, perhaps it is
better to revert this change for *synchronous transports* such as {{UDP}} and {{TCP}}, and
still create new buffers for *asynchronous transports* such as {{TCP_NIO2}}.
Synchronous transports guarantee a message has been put on the wire when {{TP.send()}}
returns, whereas asynchronous transports may only have completed a partial write (so we
cannot reuse the buffer).
The code in the bundler should check for this, and copy if async or not copy if sync.
Whether or not a transport is sync is determined by a new abstract method that needs to
be overridden by every transport.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)