[infinispan-dev] storeAsBinary keeps both the object and the byte[] - why?

Mircea Markus mmarkus at redhat.com
Thu Jul 18 08:44:47 EDT 2013


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)







More information about the infinispan-dev mailing list