Ignite报告IgniteOutOfMemoryException:数据区域中的内存不足

时间:2019-05-01 14:22:22

标签: ignite

我基于apache ignite core jar 2.7.0构建了一个缓存集群,服务器进程退出并出现OOM错误:

org.apache.ignite.logger.java.JavaLogger.error JVM will be halted immediately due to the failure: [failureCtx=FailureContext [type=CRITICAL_ERROR, err=class o.a.i.i.mem.IgniteOutOfMemoryException: Out of memory in data region [name=keywordRegion, initSize=256.0 MiB, maxSize=8.0 GiB, persistenceEnabled=false] Try the following:
  ^-- Increase maximum off-heap memory size (DataRegionConfiguration.maxSize)
  ^-- Enable Ignite persistence (DataRegionConfiguration.persistenceEnabled)
  ^-- Enable eviction or expiration policies]]

该区域配置为:

<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
    <property name="name" value="keywordRegion"/>
    <property name="maxSize" value="#{1024L * 1024 * 1024 * 8}"/>
    <property name="pageEvictionMode" value="RANDOM_2_LRU"/>
    <property name="persistenceEnabled" value="false"/>
</bean>

关于错误日志中给定的3条建议:

  1. 我想将缓存大小限制为8g;
  2. 我只想使用内存缓存;
  3. PageEvictionMode设置为RANDOM_2_LRU;

并且我测试了一些情况,当高速缓存值大小相同时,逐出效果很好,而当它们的大小随机时,则会导致OOM。 有什么事?配置错误吗?谢谢。

编辑: 这是我的测试,最大区域大小设置为120M,OOM发生在第200个循环附近,当mega声明的行移至for循环的前面时,点燃效果很好。

IgniteCache<String, Object> keywordCache = ignite.getOrCreateCache("keyword");
    for(int i=0;i<1000;i++){
        int mega = new Random().nextInt(3) + 1;
        keywordCache.put(UUID.randomUUID().toString(), new byte[mega * 1024 * 1024]);
        System.out.println("current:"+i);
    }

1 个答案:

答案 0 :(得分:0)

这些对象大于EvictionPolicy中emptyPagesPoolSize的默认属性,因此,可能导致这种现象。您可以将以下行添加到DataRegionConfiguration中:

<property name="emptyPagesPoolSize" value="5000"/>

我已经检查了您的复制器,并且在应用此属性后可以正常工作。

相关问题