storeAsBinary keeps both the object and the byte[] - why?
by Mircea Markus
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)
10 years, 9 months
storeAsBinary + lookup
by Ales Justin
Anything obvious on why this lookup doesn't find its match?
Some background:
* I have .ear, with 2 .war sub-deployments
* each .war has own Key class in own gae.jar (in WEB-INF/lib)
I do set storeAsBinary on the cache, which is shared between both .wars.
This first key is the key for 2nd lookup.
Below are entries of previous puts.
As you can see, entry under [1] should match lookup key.
But DataContainer returns null -- no match.
-Ales
---
key = {org.infinispan.marshall.MarshalledValue@11787}"MarshalledValue{instance=Modules(1), serialized=false, cachedHashCode=0}@8d2e9d9"
instance = {com.google.appengine.api.datastore.Key@11063}"Modules(1)"
parentKey = null
kind = {java.lang.String@11855}"Modules"
appId = {java.lang.String@11856}"tckear"
id = 1
name = null
appIdNamespace = {com.google.appengine.api.datastore.AppIdNamespace@11857}"tckear"
checked = false
raw = null
serialisedSize = 128
cachedHashCode = 0
equalityPreferenceForInstance = true
marshaller = {org.infinispan.marshall.CacheMarshaller@11829}
entries = {org.infinispan.util.concurrent.BoundedConcurrentHashMap@11794} size = 3
[0] = {org.infinispan.util.concurrent.BoundedConcurrentHashMap$WriteThroughEntry@11833}"MarshalledValue{instance=__namespace__(1), serialized=false, cachedHashCode=112414304}@3131088" -> "MarshalledValue{instance=__namespace__(1), serialized=false, cachedHashCode=112414304}@3131088" -> "MarshalledValue{instance=
key: org.infinispan.marshall.MarshalledValue = {org.infinispan.marshall.MarshalledValue@11807}"MarshalledValue{instance=__namespace__(1), serialized=false, cachedHashCode=112414304}@3131088"
value: org.infinispan.container.entries.ImmortalCacheEntry = {org.infinispan.container.entries.ImmortalCacheEntry@11808}"MarshalledValue{instance=__namespace__(1), serialized=false, cachedHashCode=112414304}@3131088" -> "MarshalledValue{instance=\n, serialized=false, cachedHashCode=112414304}@7c2aef8c"
[1] = {org.infinispan.util.concurrent.BoundedConcurrentHashMap$WriteThroughEntry@11835}"MarshalledValue{instance=Modules(1), serialized=false, cachedHashCode=63491116}@3134f207" -> "MarshalledValue{instance=Modules(1), serialized=false, cachedHashCode=63491116}@3134f207" -> "MarshalledValue{instance=\n, serialized=fa...
key: org.infinispan.marshall.MarshalledValue = {org.infinispan.marshall.MarshalledValue@11811}"MarshalledValue{instance=Modules(1), serialized=false, cachedHashCode=63491116}@3134f207"
instance = {com.google.appengine.api.datastore.Key@11671}"Modules(1)"
parentKey = null
kind = {java.lang.String@11855}"Modules"
appId = {java.lang.String@11856}"tckear"
id = 1
name = null
appIdNamespace = {com.google.appengine.api.datastore.AppIdNamespace@11861}"tckear"
checked = true
raw = null
serialisedSize = 128
cachedHashCode = 63491116
equalityPreferenceForInstance = true
marshaller = {org.infinispan.marshall.CacheMarshaller@11829}
value: org.infinispan.container.entries.ImmortalCacheEntry = {org.infinispan.container.entries.ImmortalCacheEntry@11812}"MarshalledValue{instance=Modules(1), serialized=false, cachedHashCode=63491116}@3134f207" -> "MarshalledValue{instance=\n, serialized=false, cachedHashCode=63491116}@1f7425f2"
[2] = {org.infinispan.util.concurrent.BoundedConcurrentHashMap$WriteThroughEntry@11836}"MarshalledValue{instance=__kind__("Modules"), serialized=false, cachedHashCode=1413747955}@2ab5011f" -> "MarshalledValue{instance=__kind__("Modules"), serialized=false, cachedHashCode=1413747955}@2ab5011f" -> "MarshalledValue{instance=
key: org.infinispan.marshall.MarshalledValue = {org.infinispan.marshall.MarshalledValue@11815}"MarshalledValue{instance=__kind__("Modules"), serialized=false, cachedHashCode=1413747955}@2ab5011f"
value: org.infinispan.container.entries.ImmortalCacheEntry = {org.infinispan.container.entries.ImmortalCacheEntry@11816}"MarshalledValue{instance=__kind__("Modules"), serialized=false, cachedHashCode=1413747955}@2ab5011f" -> "MarshalledValue{instance=\n, serialized=false, cachedHashCode=1413747955}@1d6779db"
10 years, 9 months
Query regarding Infinispan Clustering Performance
by Faseela K
Hi,
I am doing some analysis and study to see how the performance of infinispan can be improved in distributed clustered mode.
This study is based on some performance test I ran, with 3 nodes, where replication performance seems better than distribution.
But, I think distribution performance can be tuned with some best practices.
Is there a way to divide the write requests coming on one node, equally among the cluster, so that transactions/second can be improved?
Thanks,
Faseela
10 years, 9 months