1

我们在 EhCache 复制使用过程中遇到了 OOM 问题。内存转储向我们展示了顶部的 jgroup 相关对象:

Instance Counts for All Classes (excluding platform)
464012 instances of class org.jgroups.util.Headers
463718 instances of class org.jgroups.protocols.pbcast.NakAckHeader
463512 instances of class [Lorg.jgroups.Header;
462136 instances of class org.jgroups.Message
173509 instances of class org.jgroups.protocols.TpHeader
63301 instances of class com.mongodb.BasicDBObject

我们还在日志中看到以下警告:

2012-08-26 02:05:50,980 INFO  [org.jgroups.JChannel] (main) JGroups version: 
2.10.0.GA
2012-08-26 02:05:51,569 WARN  [org.jgroups.stack.Configurator] (main) TCPPING property down_thread was deprecated and is ignored
2012-08-26 02:05:51,569 WARN  [org.jgroups.stack.Configurator] (main) TCPPING property up_thread was deprecated and is ignored
2012-08-26 02:05:51,576 WARN  [org.jgroups.stack.Configurator] (main) VERIFY_SUSPECT property down_thread was deprecated and is ignored
2012-08-26 02:05:51,576 WARN  [org.jgroups.stack.Configurator] (main) VERIFY_SUSPECT property up_thread was deprecated and is ignored
2012-08-26 02:05:51,584 WARN  [org.jgroups.stack.Configurator] (main) NAKACK property down_thread was deprecated and is ignored
2012-08-26 02:05:51,584 WARN  [org.jgroups.stack.Configurator] (main) NAKACK property up_thread was deprecated and is ignored
2012-08-26 02:05:51,629 WARN  [org.jgroups.stack.Configurator] (main) GMS property join_retry_timeout was deprecated and is ignored
2012-08-26 02:05:51,629 WARN  [org.jgroups.stack.Configurator] (main) GMS property shun was deprecated and is ignored
2012-08-26 02:05:51,629 WARN  [org.jgroups.stack.Configurator] (main) GMS property down_thread was deprecated and is ignored
2012-08-26 02:05:51,629 WARN  [org.jgroups.stack.Configurator] (main) GMS property up_thread was deprecated and is ignored
2012-08-26 02:05:51,734 WARN  [org.jgroups.protocols.pbcast.NAKACK] (main) use_mcast_xmit should not be used because the transport (TCP) does not support IP multicasting; setting use_mcast_xmit to false
2012-08-26 02:05:58,539 WARN  [org.jgroups.protocols.pbcast.GMS] (main)
join(host_x-17490) sent to host_x-5955 timed out (after 5000 ms), retrying
2012-08-26 02:06:01,601 INFO
[net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProvider] (main) JGroups Replication started for 'EH_CACHE'. JChannel: local_addr=host_x-17490
cluster_name=EH_CACHE
my_view=[host_x-17490|0] [host_x-17490]

环境:

CentOS release 5.4 (Final)
JBboss-4.2.3 GA
Java: 1.6.0_21
RAM: 8 Gb
Hosts (machines): host_x, host_y

我们使用的 Lib 版本:

jgroups-2.10.0.GA.jar
ehcache-jgroupsreplication-1.5.jar
ehcache-core-2.5.0.jar

EhCache(ehcache.xml)的配置:

<ehcache>
    <cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
                properties="connect=TCP(bind_port=7800):
                    TCPPING(initial_hosts=host_x[7800],host_y[7800];port_range=5;timeout=3000;
                    num_initial_members=3;up_thread=true;down_thread=true):
                    VERIFY_SUSPECT(timeout=1500;down_thread=false;up_thread=false):
                    pbcast.NAKACK(down_thread=true;up_thread=true;gc_lag=100;retransmit_timeout=3000):
                    pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;
                    print_local_addr=false;down_thread=true;up_thread=true)"
                propertySeparator="::" />

    <cache name="RECORD_CACHE" maxElementsInMemory="25000" eternal="false"
           overflowToDisk="false" memoryStoreEvictionPolicy="LFU" timeToLiveSeconds="900" >
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
                properties="replicateAsynchronously=true, replicatePuts=false, replicateUpdates=false,
                    replicateUpdatesViaCopy=false, replicateRemovals=true" />
    </cache>
</ehcache>

我们检查了 host_x 上的 7800 端口可从 host_y 获得,反之亦然(通过 telnet)。

如果这里出现 OOM 问题,您能帮我们检测 root 吗?我们对不正确的复制配置有一些假设 - 但目前无法在这里定义错误在哪里。

感谢您的任何意见或建议!

4

1 回答 1

2

您的 JGroups 配置完全关闭!

首先,它可能是从一个非常旧的版本中复制而来的。其次,缺少 STABLE,这意味着消息永远不会被垃圾收集!我建议使用 2.10 版本的 JGroups(您正在使用)中的 tcp.xml 或 udp.xml。

于 2012-09-06T13:19:50.243 回答