[jboss-jira] [JBoss JIRA] (JGRP-2185) (7.0.z) Headers.resize() called unnecessarily

Bartosz Spyrko-Śmietanko (JIRA) issues at jboss.org
Fri Jun 2 10:25:00 EDT 2017


Bartosz Spyrko-Śmietanko created JGRP-2185:
----------------------------------------------

             Summary: (7.0.z) Headers.resize() called unnecessarily
                 Key: JGRP-2185
                 URL: https://issues.jboss.org/browse/JGRP-2185
             Project: JGroups
          Issue Type: Bug
            Reporter: Bartosz Spyrko-Śmietanko
            Assignee: Bela Ban
            Priority: Minor
             Fix For: 3.6.12, 4.0


Each message has space for 4 headers. When a 5th header needs to be added, the array needs to be resized. This is something we want to avoid as much as possible.

However, the following scenario can lead to resizing:

* A bundler writes a message list with (say) 3 headers
* A message list always ignores the transport header, as it is only used to carry the cluster name, but that name is available in the batch header, too.
* Therefore, the size of the headers written is 2 and the transport header is not written
* On the receiver side, when reading the batch, we create and read 2 headers
** This is OK, as message batches are matched against the receiver's cluster name using the cluster name shipped in the batch itself and not in the message
** Message batches are therefore passed up without the individual messages carrying a transport header
* However, single messages need to carry a transport header as it will be used to do the cluster name matching
* Now, if a batch contains messages tagged as {{OOB|DONT_BUNDLE}}, they will be removed from the batch and sent up the stack as separate messages, each in a separate thread.
* To do this, each of these messages is added a transport header (created using the batch's cluster name).
* However, this necessitates a resizing as the headers array has a length of only 2, but we now need 3 headers

Note that we don't run into this in 4.0, as Infinispan 9 (which uses 4) doesn't use {{DONT_BUNDLE}} any longer. It is still an unnecessary memory allocation and needs to be optimized.

However, we should fix it in 3.6 as we still use {{DONT_BUNDLE}} in Infinispan 8.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the jboss-jira mailing list