如果ON HEAP和OFF HEAP内存已满,则逐出到磁盘上APACHE IGNITE

时间:2019-05-09 12:55:25

标签: c# apache caching configuration ignite

我正在使用Apache Ignite ver2.7,通过Config.xml设置启动Ignite服务器。

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

config.xml包含

<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>

现在点燃开始给予

 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)

并与在dotnet应用程序中使用以下c#代码创建的客户端连接

 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*/
    }
 }

和 创建多个缓存后创建多个缓存... 客户端崩溃。

错误显示服务器端

[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

我在互联网上搜索并获得了Ignite official website

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

通过此设置点燃服务器无法启动

我申请了

var cacheCfg = new CacheConfiguration
{
   EnableSwap = true
};

此代码为我的C#代码,但EnableSwap属性不存在

我想要的是-

如果堆上和堆外内存已满,则条目将逐出到磁盘,而堆上和堆外内存将在此处管理新条目的空间。

1 个答案:

答案 0 :(得分:1)

如果启用了持久性,则Ignite将自动将数据从内存中逐出到磁盘,您无需配置pageEvictionMode属性。

关于您所拥有的异常,我认为从异常消息中可以很清楚地了解到

  

未配置请求的DataRegion:defaultRegion

就像在CacheConfiguration中,您选择了错误的区域名称(因为您更改了默认区域的名称)。如果仅使用一个默认区域,则只需删除该区域的名称,而根本不为缓存配置区域名称。