[jboss-jira] [JBoss JIRA] (JGRP-1989) Bundlers: reuse send buffer when transport == sync.
Sanne Grinovero (JIRA)
issues at jboss.org
Wed Dec 23 06:20:00 EST 2015
[ https://issues.jboss.org/browse/JGRP-1989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143921#comment-13143921 ]
Sanne Grinovero commented on JGRP-1989:
---------------------------------------
{quote}I don't agree that most of the messages are large (or that the size is predictable at all). In Infinispan, we send a lot of small messages, e.g. a remote get command only contains a small key, or the response might be just a few bytes to indicate the operation is successful.
{quote}
In many practical use cases, even if I do many get operations the keys will be of some known type; let's even assume they are {{String}} instances, one might know that they are of some lengths in the ballpark 2 bytes to 15 bytes (for example, but I think that's a reasonable use case). In this scenario, one would make a large pool and split them in stripes of 15 bytes each.
That would "overallocate" frequently but being out of heap memory, it's a cheap but convenient trick.
I simply don't believe that applications are truly "schema-less": even if there's not an upfront declared schema, any app will have a soft schema at least which means there are patterns in data access. Of course it would not be very efficient to mix access to different types in the same cache, but that's not something we encourage either (especially considering a Cache is a generic with K,V to be defined as types).
bq. we send *a lot *of small messages
So this proposal would have *a lot *of benefits ;)
> 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)
More information about the jboss-jira
mailing list