Are you sure both representations are kept?

MarshalledValueInterceptor.visitGetKeyValueCommand() should call MarshalledValue.compact just before returning, which should keep only one representation.



On Thu, Jul 18, 2013 at 3:44 PM, Mircea Markus <mmarkus@redhat.com> wrote:
Hi,

We have the following behaviour when storeAsBinary is enabled:
- when an entry is added it is initially stored in binary format (byte[])
- when it is read from an *owning node*, it is unmarshalled and the object reference is cached in memory together with the byte representation
- the object reference is only cleaned up when cache.compact() is invoked explicitly

Assuming a key is read uniformly on all the nodes, after a while the system ends up with all the entries stored twice: the byte[] and the object in unserialized form. Of course this can be mitigated by asking the users to invoke Cache.compact - but that's quite confusing and not very user friendly as the user needs to be concerned with memory management.

Can anybody think of some reasons why the value is kept twice? I mean besides optimising for local gets, which I think is not a good enough reason given the potentially huge memory consumption and the complexity added.

Cheers,
--
Mircea Markus
Infinispan lead (www.infinispan.org)





_______________________________________________
infinispan-dev mailing list
infinispan-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev