[ https://issues.apache.org/jira/browse/IGNITE-7219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574957#comment-16574957
]
Stepan Ilchenko commented on IGNITE-7219:
-----------------------------------------
Hi, it's not only about memory allocation. We see quite big contention on frequent calls of getValue,
because getReadMethod is called each time and this method of PropertyDescriptor is synchronized.
{noformat}
java.lang.Thread.State: RUNNABLE
at java.util.Arrays.copyOfRange(Arrays.java:3664)
at java.lang.String.<init>(String.java:207)
at java.lang.String.substring(String.java:1969)
at sun.reflect.misc.ReflectUtil.isNonPublicProxyClass(ReflectUtil.java:288)
at sun.reflect.misc.ReflectUtil.checkPackageAccess(ReflectUtil.java:165)
at sun.reflect.misc.ReflectUtil.isPackageAccessible(ReflectUtil.java:195)
at java.beans.MethodRef.get(MethodRef.java:72)
at java.beans.PropertyDescriptor.getReadMethod(PropertyDescriptor.java:207)
- locked <0x00000006c0647cc8> (a java.beans.PropertyDescriptor)
at org.apache.ignite.cache.store.cassandra.persistence.PojoFieldAccessor.getValue(PojoFieldAccessor.java:123)
at org.apache.ignite.cache.store.cassandra.persistence.PojoField.getValueFromObject(PojoField.java:167)
at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.bindValues(PersistenceController.java:450)
at org.apache.ignite.cache.store.cassandra.persistence.PersistenceController.bindKeyValue(PersistenceController.java:203)
at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$4.bindStatement(CassandraCacheStore.java:368)
at org.apache.ignite.cache.store.cassandra.CassandraCacheStore$4.bindStatement(CassandraCacheStore.java:354)
at org.apache.ignite.cache.store.cassandra.session.CassandraSessionImpl.execute(CassandraSessionImpl.java:247)
at org.apache.ignite.cache.store.cassandra.CassandraCacheStore.writeAll(CassandraCacheStore.java:354)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.updateStore(GridCacheWriteBehindStore.java:815)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.applyBatch(GridCacheWriteBehindStore.java:725)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore.access$2400(GridCacheWriteBehindStore.java:75)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.flushCacheCoalescing(GridCacheWriteBehindStore.java:1119)
at org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$Flusher.body(GridCacheWriteBehindStore.java:1017)
at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
at java.lang.Thread.run(Thread.java:748)
{noformat}
Attached proposed fix with caching of thread safe Method classes for reads and writes. [^PojoFieldAccessor.java]
> Reduce memory allocation in cassandra.persistence.PojoFieldAccessor
> -------------------------------------------------------------------
>
> Key: IGNITE-7219
> URL: https://issues.apache.org/jira/browse/IGNITE-7219
> Project: Ignite
> Issue Type: Improvement
> Components: cassandra
> Affects Versions: 2.1, 2.2, 2.3
> Reporter: Dmitry Konstantinov
> Priority: Major
> Attachments: PojoFieldAccessor.java, ignitePojoFieldAccessorMemAlloc.png
>
>
> As a part of store logic of CassandraCacheStore if strategy="POJO" is used to store a
value entity - org.apache.ignite.cache.store.cassandra.persistence.PojoFieldAccessor is used
to work with POJO properties. Within the methods getValue/setValue getReadMethod()/getWriteMethod()
are invoked each time. As a part of the methods invocation sun.reflect.misc.ReflectUtil#isNonPublicProxyClass
is triggered which works with class names as strings and allocates a memory. It is a small
allocation by itself but it is triggered very frequently - for each field for each entity
per each DB operation - so in summary it create a significant pressure. See attach: [^ignitePojoFieldAccessorMemAlloc.png]
> Suggestion: we can cache and reuse getReadMethod()/getWriteMethod() results as a part
of constructor logic of PojoFieldAccessor
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
|