[infinispan-dev] Adaptive marshaller buffer sizes - ISPN-1102

Bela Ban bban at redhat.com
Mon Jun 13 06:24:45 EDT 2011



On 6/10/11 12:20 PM, Manik Surtani wrote:
> I was referring to generating byte arrays (sending state), not generating objects (receiving state).  A buffer is maintained in the AbstractMarshaller and used.
>
> I did see a comment from Bela on this thread about seeing this on the receiver too though - Bela, care to clarify?


This was incorrect. On the receiver side, JGroups knows exactly how long 
the data buffer needs to be as the size is sent as the first element in 
the data. The incoming packet is always copied and passed up to Infinispan.


>  I presume on the receiver that JGroups calls RpcDispatcher.Marshaller2.objectFromByteBuffer() and passes in a byte array.  So perhaps you are referring to how you create these byte buffers in JGroups for reading off a network stream?


The problem - as Sanne mentioned - is the size of the generated buffer 
passed to JGroups. Infinispan uses a fixed buffer of 512 bytes and this 
buffer is increased on-demand (doubled by default, IIRC). Infinispan's 
marshaller then passes a ref to this buffer, plus an offset and length. 
However, because JGroups keeps the ref around, the entire data buffer 
will not get released until STABLE allows for purging of the message. 
This happens for sent messages only.


-- 
Bela Ban
Lead JGroups / Clustering Team
JBoss


More information about the infinispan-dev mailing list