1
votes

I am trying to evaluate Apache Ignite using the client server mode. I have some prior experiences in using Hazelcast and Infinispan, so I am coming from an IMDG background.

My initial experience on using Ignite in client-server mode is not very smooth. I might sound opinionated, but I felt that most of the advanced use cases are suitable from an embedded server mode perspective.

Question:

I do have many, but I am publishing the one which I am facing right now. I am using v2.1.0. I am trying to leverage the durable memory feature of Ignite. So I have turned on persistence in my server configuration, as described in documentation.

<property name="persistentStoreConfiguration">
    <bean class="org.apache.ignite.configuration.PersistentStoreConfiguration"/>
</property>

Now when I try to connect from a client, with the code

Ignition.setClientMode(true);

IgniteConfiguration cfg = new IgniteConfiguration();
//cfg.setPeerClassLoadingEnabled(true);

TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
commSpi.setSlowClientQueueLimit(1000);

TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipfinder = new TcpDiscoveryVmIpFinder();
ipfinder.setAddresses(Arrays.asList("localhost"));
discoverySpi.setIpFinder(ipfinder);

cfg.setCommunicationSpi(commSpi);
cfg.setDiscoverySpi(discoverySpi);
ignite = Ignition.start(cfg);
//ignite.active(true);

CacheConfiguration<String, Person> config = new CacheConfiguration<>("Person");
config.setCacheMode(CacheMode.PARTITIONED);
//config.setOnheapCacheEnabled(true);
//config.setEvictionPolicy(new LruEvictionPolicy<>(2));

ignite.getOrCreateCache(config);

I get the following exception:

class org.apache.ignite.IgniteException: Can not perform the operation because the cluster is inactive. Note, that the cluster is considered inactive by default if Ignite Persistent Store is used to let all the nodes join the cluster. To activate the cluster call Ignite.activate(true).
at org.apache.ignite.internal.IgniteKernal.checkClusterState(IgniteKernal.java:3712)
at org.apache.ignite.internal.IgniteKernal.getOrCreateCache0(IgniteKernal.java:2837)
at org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2824)

If I set ignite.activate(true), the code hangs (blocked? waiting?). Why does my client, which (I assume) do not participate as a data node, need to behave as one? Am I missing something here? Any help would be appreciated.

This is the exception I see on the server.

 [13:54:52] Topology snapshot [ver=5, servers=1, clients=0, CPUs=4, heap=0.13GB]
[14:02:19] Topology snapshot [ver=6, servers=1, clients=1, CPUs=4, heap=1.9GB]
[14:02:20] Default checkpoint page buffer size is too small, setting to an adjusted value: 1.6 GiB
[14:02:20,446][SEVERE][exchange-worker-#34%null%][GridDhtPartitionsExchangeFuture] Failed to reinitialize local partitions (preloading will be stopped
): GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=6, minorTopVer=1], nodeId=bccb36d2, evt=DISCOVERY_CUSTOM_EVT]
java.lang.OutOfMemoryError
        at sun.misc.Unsafe.allocateMemory(Native Method)
        at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
        at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
        at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
        at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
        at java.lang.Thread.run(Thread.java:745)
[14:02:20,478][SEVERE][exchange-worker-#34%null%][GridCachePartitionExchangeManager] Runtime error caught during grid runnable execution: GridWorker [
name=partition-exchanger, igniteInstanceName=null, finished=false, hashCode=1380507612, interrupted=false, runner=exchange-worker-#34%null%]
java.lang.OutOfMemoryError
        at sun.misc.Unsafe.allocateMemory(Native Method)
        at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
        at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
        at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
        at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
        at java.lang.Thread.run(Thread.java:745)
Exception in thread "exchange-worker-#34%null%" java.lang.OutOfMemoryError
        at sun.misc.Unsafe.allocateMemory(Native Method)
        at org.apache.ignite.internal.util.GridUnsafe.allocateMemory(GridUnsafe.java:1054)
        at org.apache.ignite.internal.mem.unsafe.UnsafeMemoryProvider.nextRegion(UnsafeMemoryProvider.java:80)
        at org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl.start(PageMemoryImpl.java:276)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.startMemoryPolicies(IgniteCacheDatabaseSharedManag
er.java:194)
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.onActivate(IgniteCacheDatabaseSharedManager.java:9
49)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.onActivate(GridCacheDatabaseSharedManager.java:459)
        at org.apache.ignite.internal.processors.cache.GridCacheSharedContext.activate(GridCacheSharedContext.java:244)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onClusterStateChangeRequest(GridDhtPa
rtitionsExchangeFuture.java:762)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.
java:574)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:19
01)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
        at java.lang.Thread.run(Thread.java:745)
[14:02:20,846][SEVERE][query-#174%null%][msg] Received message without registered handler (will ignore) [msg=GridCacheQueryRequest [id=3, cacheName=ig
nite-sys-cache, type=SCAN, fields=false, clause=null, clsName=null, keyValFilter=null, rdc=null, trans=null, pageSize=1024, incBackups=false, cancel=f
alse, incMeta=false, all=false, keepBinary=false, subjId=61cfa42e-40af-473d-a9f6-2fe249d66910, taskHash=0, part=-1, topVer=AffinityTopologyVersion [to
pVer=6, minorTopVer=1], super=GridCacheIdMessage [cacheId=-2100569601]], node=61cfa42e-40af-473d-a9f6-2fe249d66910, locTopVer=AffinityTopologyVersion
[topVer=-1, minorTopVer=0], msgTopVer=AffinityTopologyVersion [topVer=6, minorTopVer=1], desc=DynamicCacheDescriptor [deploymentId=4093bcfdd51-bae6026
e-62b0-4189-854b-9efa4b8bf23f, staticCfg=true, sql=false, cacheType=UTILITY, template=false, updatesAllowed=true, cacheId=-2100569601, rcvdFrom=bccb36
d2-2c8f-4642-b84d-63b5dd2ab93b, objCtx=null, rcvdOnDiscovery=false, startTopVer=AffinityTopologyVersion [topVer=6, minorTopVer=0], rcvdFromVer=Affinit
yTopologyVersion [topVer=1, minorTopVer=0], clientCacheStartVer=null, schema=QuerySchema [], grpDesc=CacheGroupDescriptor [grpId=-2100569601, grpName=
null, startTopVer=null, rcvdFrom=bccb36d2-2c8f-4642-b84d-63b5dd2ab93b, deploymentId=4093bcfdd51-bae6026e-62b0-4189-854b-9efa4b8bf23f, caches={ignite-s
ys-cache=-2100569601}, rcvdFromVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], cacheName=ignite-sys-cache], cacheName=ignite-sys-cache]]
Registered listeners:
1
Please share full logs and thread dumps from nodes - Evgenii Zhuravlev
@EvgeniiZhuravlev I have added the server log. I have a single server node. One more point, I had started the server with a min/max heap of 128m. - sutanu dalui

1 Answers

1
votes

Topology snapshot [ver=5, servers=1, clients=0, CPUs=4, heap=0.13GB]

You've started Ignite server node with too small heap memory(128mb), try to increase it(parameters -Xmx & -Xms).

Also, by default Ignite trying to allocate 0.8 of all physical memory on computer for it pageMemory. So, if you want to start more than one node on same machine, you need to configure MemoryPolicy for nodes.

Check this documentation for additional information and examples