Search code examples
c#cachingconfigurationignite

Evict entries to the disk if ON HEAP and OFF HEAP Memory full APACHE IGNITE


I am using Apache Ignite ver2.7 , starting Ignite server with Config.xml setting.

./ignite.sh $IGNITE_HOME/config/config.xml -J-Xms15g -J-Xmx17g

config.xml contains

<property name="dataStorageConfiguration">
        <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
            <property name="defaultDataRegionConfiguration">
                <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                    <property name="persistenceEnabled" value="true"/>
                    <property name="name" value="Default_Region"/>
                    <property name="maxSize" value="#{15L * 1024 * 1024 * 1024}"/>

                    <property name="initialSize" value="#{10L * 1024 * 1024 * 1024}"/>
                   <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
                </bean>
            </property>
        </bean>
    </property>

now ignite get started giving

 OS: Linux 3.10.0-957.10.1.el7.x86_64 amd64
[17:37:06] VM information: Java(TM) SE Runtime Environment 1.8.0_211-b12 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.211-b12
[17:37:06] Please set system property '-Djava.net.preferIPv4Stack=true' to avoid possible problems in mixed environments.
[17:37:06] Configured plugins:
[17:37:06]   ^-- None
[17:37:06]
[17:37:06] Configured failure handler: [hnd=StopNodeOrHaltFailureHandler [tryStop=false, timeout=0, super=AbstractFailureHandler [ignoredFailureTypes=[SYSTEM_WORKER_BLOCKED]]]]
[17:37:07] Message queue limit is set to 0 which may lead to potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to message queues growth on sender and receiver sides.
[17:37:07] Security status [authentication=off, tls/ssl=off]
[17:37:07] Automatically adjusted max WAL archive size to 20.0 GiB (to override, use DataStorageConfiguration.setMaxWalArhiveSize)
[17:37:09] Nodes started on local machine require more than 80% of physical RAM what can lead to significant slowdown due to swapping (please decrease JVM heap size, data region size or checkpoint buffer size) [required=36054MB, available=31929MB]

 [17:37:10] Automatically adjusted max WAL archive size to 20.0 GiB (to override, use DataStorageConfiguration.setMaxWalArhiveSize)
 [17:37:10]   ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options)
[17:37:10]   ^-- Speed up flushing of dirty pages by OS (alter vm.dirty_expire_centisecs parameter by setting to 500)
[17:37:10] Refer to this page for more performance suggestions: https://apacheignite.readme.io/docs/jvm-and-system-tuning
[17:37:10]
[17:37:10] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
[17:37:10] Data Regions Configured:
[17:37:10]   ^-- Default_Region [initSize=10.0 GiB, maxSize=15.0 GiB, persistence=true]
[17:37:10]
[17:37:10] Ignite node started OK (id=b1fdc603)
[17:37:10] Topology snapshot [ver=1, locNode=b1fdc603, servers=1, clients=0, state=INACTIVE, CPUs=4, offheap=15.0GB, heap=15.0GB]
[17:37:10]   ^-- Baseline [id=0, size=1, online=1, offline=0]
[17:37:10]   ^-- All baseline nodes are online, will start auto-activation

[17:37:10] Performance suggestions for grid  (fix if possible)
[17:37:10] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
[17:37:10]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM options)
[17:37:10]   ^-- Set max direct memory size if getting 'OOME: Direct buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options)
[17:37:10]   ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options)
[17:37:10]   ^-- Speed up flushing of dirty pages by OS (alter vm.dirty_expire_centisecs parameter by setting to 500)

and connected with client which is created in dotnet application with following c# codes

 if (igniteClient == null)
  {
   var client = new IgniteClientConfiguration
    {
      Host = IP
    };
    igniteClient = Ignition.StartClient(client);
    for(int i=0;i<n;i++)
    {
      igniteClient.GetOrCreateCache<int, HISTORICALDATAWithOHLC>(CacheConf);
/*HISTORICALDATAWithOHLC is a structure of OHLC*/
    }
 }

and creating Multiple caches... after creating n number of caches .. client crashes.

Error shows server side

[17:43:25,974][SEVERE][exchange-worker-#43][CacheAffinitySharedManager] Failed to initialize cache. Will try to rollback cache start routine. [cacheName=FOSECOINDOHLC]
class org.apache.ignite.IgniteCheckedException: Requested DataRegion is not configured: defaultRegion
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.dataRegion(IgniteCacheDatabaseSharedManager.java:688)
        at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.initForCache(FilePageStoreManager.java:514)
        at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.initializeForCache(FilePageStoreManager.java:310)
        at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:2115)
        at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processCacheStartRequests(CacheAffinitySharedManager.java:898)
        at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onCacheChangeRequest(CacheAffinitySharedManager.java:798)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onCacheChangeRequest(GridDhtPartitionsExchangeFuture.java:1231)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:738)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2667)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2539)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at java.lang.Thread.run(Thread.java:748)
[17:43:25,979][SEVERE][client-connector-#98][ClientListenerNioListener] Failed to process client request [req=o.a.i.i.processors.platform.client.cache.ClientCacheGetOrCreateWithConfigurationRequest@6c99a7f8]
javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Requested DataRegion is not configured: defaultRegion
        at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1337)
        at org.apache.ignite.internal.IgniteKernal.getOrCreateCache0(IgniteKernal.java:3023)
        at org.apache.ignite.internal.IgniteKernal.getOrCreateCache(IgniteKernal.java:2992)
        at org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetOrCreateWithConfigurationRequest.lambda$process$0(ClientCacheGetOrCreateWithConfigurationRequest.java:57)
        at org.apache.ignite.internal.processors.platform.client.ClientRequest.runWithSecurityExceptionHandler(ClientRequest.java:70)
        at org.apache.ignite.internal.processors.platform.client.cache.ClientCacheGetOrCreateWithConfigurationRequest.process(ClientCacheGetOrCreateWithConfigurationRequest.java:57)
        at org.apache.ignite.internal.processors.platform.client.ClientRequestHandler.handle(ClientRequestHandler.java:57)
        at org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:162)
        at org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:45)
        at org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
        at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
        at org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: class org.apache.ignite.IgniteCheckedException: Requested DataRegion is not configured: defaultRegion
        at org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager.dataRegion(IgniteCacheDatabaseSharedManager.java:688)
        at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.initForCache(FilePageStoreManager.java:514)
        at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.initializeForCache(FilePageStoreManager.java:310)
        at org.apache.ignite.internal.processors.cache.GridCacheProcessor.prepareCacheStart(GridCacheProcessor.java:2115)
        at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.processCacheStartRequests(CacheAffinitySharedManager.java:898)
        at org.apache.ignite.internal.processors.cache.CacheAffinitySharedManager.onCacheChangeRequest(CacheAffinitySharedManager.java:798)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.onCacheChangeRequest(GridDhtPartitionsExchangeFuture.java:1231)
        at org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:738)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2667)
        at org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2539)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        ... 1 more

i have searched in internet and got Ignite official website

<bean class="org.apache.ignite.configuration.CacheConfiguration">
...
<!-- Enable swap. -->
<property name="swapEnabled" value="true"/> 
...
</bean>

by this setting ignite server doesn't start

and i applied

var cacheCfg = new CacheConfiguration
{
   EnableSwap = true
};

this code to my c# code but EnableSwap Property doesn't exist

what i want is--

if on-heap and off-heap memory full then entries will evict to disk and on-heap and off-heap memory manage there space for new entries.


Solution

  • In case of enabled persistence, Ignite is going to evict data from memory to disk automatically, you don't need to configure pageEvictionMode property.

    As for the exception that you have, I think it's pretty clear from the exception message:

    Requested DataRegion is not configured: defaultRegion

    Looks like in the CacheConfiguration you've chosen the wrong region name(since you've changed the name for the default region). In case of using only one default region, you can just remove the name for this region and don't configure region name for caches at all.