Search code examples
javacachingignite

Apache Ignite 2.7.0 a loy of time spent in GridFutureAdapter.get0()


I'm using Apache Ignite with the following setup: 2 servers form a cluster with several Ignite caches configured in REPLICATED mode. There are also 10 Java processes that connect to Apache Ignite cluster as clients and get data from those caches.

While profiling client JVMs with VisualVM I see that clients spend almost half of their time in blocked on the following line

java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:304)
    at org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:178)
    at org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:141)
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get0(GridCacheAdapter.java:4723)
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:4697)
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:1415)
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.get(IgniteCacheProxyImpl.java:928)
    at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.get(GatewayProtectedCacheProxy.java:640)

I understand that lock might be needed to correctly process get()/put() for the given key in a given cache. But in my application I first load all needed reference data into Ignite cache and after that client JVMs only get data from cache. Is such behavior (spending a lot of time in WAITING during cache.get()) expected? Is there any way to call cache.get() without lock since in my case there will be no updates in cache after initial load?


Solution

  • In general it's expected because you need to wait for a network to deliver cache values to your client node at least. REPLICATED cache mode means that every key is present on every server node but it still takes some time to pull it to a client node.