[infinispan-dev] Double+ buffering during value marshalling

Sanne Grinovero sanne at infinispan.org
Sat Aug 11 16:00:28 EDT 2012


While debugging around the Infinispan/JBMar integration I noticed that
Infinispan defines in-memory buffers wrapped as byte streams, and uses
JBoss Marshaller to write to these.

JBoss Marshaller also buffers writes, and flushes when needed or on
demand; I did already know of both, but just realized that these two
levels of buffering are both applied when serializing instances in a
org.infinispan.marshall.MarshalledValue; I guess we could do better
avoiding buffering and have JBMAR write straight away? It would also
mean less array resizing, as we are often able to allocate the right
size in one shot.

I gave a look into RiverMarshaller, and this didn't look like a simple
task as _byte[] buffer_ is the main element around which most of the
code revolves (in it's superclass SimpleDataOutput).

I'm wondering if SimpleDataOutput wouldn't be simpler by just writing
to a org.jboss.marshalling.ByteOutput (and have an optional buffering
implementation), or if Infinispan should use River in a different way.

Regards,
Sanne


More information about the infinispan-dev mailing list