【问题标题】:Often TimeoutException when using infinispan for http session clustering and caching使用 infinispan 进行 http 会话集群和缓存时经常出现 TimeoutException
【发布时间】:2020-03-12 10:24:41
【问题描述】:

我有两台服务器需要进行 http 会话集群和缓存。每台服务器都有多个节点需要共享会话。但是在组建集群的过程中,经常会出现每台服务器无法获取对方服务器正确节点名并显示一组随机字母和数字的情况。就像这样:

2019-11-13 00:28:32,973 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] ISPN000094:收到新的集群视图:[12dshost10-14444|11] (12) [12dshost10- 14444,12dhost10-27717,b5f9d81c-046d-bbc5-7de0-0fe99cce2e53,ce824896-df27-fef0-5872-857335dd9ce0,aeec4fab-e57d-2e99-3e06-834c998ee897,b857e4c0-abe4-E989-bc4c-2ab05b60dc12,ca6a9e84-c9ca- 3fad-lf20-787539477a2f, 12dshost11-28633, 12dshost10-24663, 12dshost10-3048, 12dshost10-14948, 12dshost10-47369]

本例中,“12dshost10”代表本地服务器,所有节点名都正确,“12dshost11”代表远程服务器,其他异常节点名其实来自12dshost11”。不知道为什么会变成这样。

在这种情况下,这个集群无法正常工作,在会话缓存的过程中,这些异常节点总是在等待15秒后抛出TimeoutException,似乎无法与这些异常节点通信。在这段时间内,我所有的请求也会被阻塞,直到抛出异常。看了infinispan的教程,没找到让会话缓存异步的方法,也没找到这些异常节点出现的原因。有人有这样的问题吗?

这是我对 infinispan 和缓存的配置。

<infinispan>
<global>
   <transport>
       <properties>
            <property name="configurationFile" value="cache-web-session-jgroups.xml"/>
            <property name="channelLookup" value="com.wjw.aos.cache.impl.infinispan.InfinispanJGroupsChannelLookup"/>
        </properties>
    </transport>
    <globalJmxStatistics
        allowDuplicateDomains="true"
        enabled="true"
        jmxDomain="org.infinispan"
        cacheManagerName="SampleCacheManager"/>
</global>
<default>
    <clustering mode="replication">
        <sync/>
    </clustering>
    <jmxStatistics enabled="true"/>
</default>
<namedCache name="transactional-type">
    <transactional
        transactionManagerLookupClass="org.infinispan.transaction.lookup.JBossStandaloneJTAManagerLookup"
        syncRollbackPhase="true"
        syncCommitPhase="true"
        cacheStopTimeout="30000"
        uselPcForAutoCommitTransactions="true"
        autoCommit="true"
        lockingMode="OPTIMISTIC"
        useEagerLocking="true"
        useSynchronization="true"
        transactionMode="TRANSACTIONAL"
        />
        <clustering mode="replication">
        <sync/>
        </clustering>
</namedCache>
</infinispan>

jgroups的配置如下。

<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance""
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.0.xsd">
    <TCP loopback="true"
        bind_addr="$(cache.websessions.jgroups.bind.ip)"
        bind_port="$(cache.websessions.jgroups.bind.port)"
        recv_buf_size="20M"
        send_buf_size"640k"
        discard_incompatible_packets="true"
        max_bundle_size="64K"
        max_bundle_timeout="2=300"
        timer_type="new"
        timer.min_threads="4"
        timer.max_threads="10"
        timer.keep_alive_time="3000"
        timer.queue_max_size="500"
        thread_pool.enabled="true"
        thread_pool.min_threads="2"
        thread_pool.max_threads="30"
        thread_pool.keep_alive_time="60000"
        thread_pool.queue_enabled="false"
        thread_pool.queue_max_size="100"
        thread_pool.rejection_policy="discard"
        oob_thread_pool.min_threads="2"
        oob_thread_pool.max_threads="30"
        oob_thread_pool.keep_alive_time="60000"
        oob_thread_pool.queue_enabled="false"
        oob_thread_pool.queue_max_size="100"
        oob_thread_pool.rejection_policy="discard"/>
    <TCPGOSSIP initial_hosts="$(cache.websession.jgroups.members)"/>
    <MERGE2 max_interval="30000" min_interval="10000"/>
    <FD_SOCK/>
    <FD timeout=3000" max_tries="3"/>
    <VERIFY_SUSPECT timeout="1500"/>
    <pbcast.NAKACK
        use_mcast_xmit="false"
        retransmit_timeout="300,600,1200,2400,4800"
        discard_delivered_msgs="false"/>
    <UNICAST2 timeout="300,600,1200"
              stable_interval="5000"
              max_bytes="1m"/>
    <pbcast.STABLE stability_delay="500" desired_avg_gossip="5000" max_bytes="1m"/>
    <pbcast.GMS print_local_addr="false" join_timeout="3000" view_bundling="true"/>
    <UFC max_credits="200k" min_threshold="0.20"/>
    <MFC max_credits="200k" min_threshold="0.20"/>
    <FRAG2 frag_size="60000"/>
    <RSVP timeout="60000" resend_interval="500" ack_on_delivery="false"/>
</config>

【问题讨论】:

    标签: java infinispan jgroups timeoutexception


    【解决方案1】:

    这看起来像是一个非常古老的 Infinispan 版本。不能考虑升级吗?

    【讨论】:

    • 是的,它是一个古老的版本 6.0.2。更绝望的是,我不能轻易地进行更新,因为我们的软件已经用于商业多年,而我们的客户几乎不会同意这个建议。他们可能同意做一些补丁。所以我必须尝试深入研究这个问题并在不更新的情况下修复它。只有当它是较新版本中已知已修复的问题时,我才建议进行更新
    • 问题是被污染的视图。我看到你正在使用 TCPGOSSIP。您是否可以使用其他发现协议,例如 TCP_PING ?
    • 从Infinispan的教程中,最好是TCP_PING在启动集群时设置所有节点。但是,它与我原来的集群模型不同。通常我有两台服务器。 Server A 看不到 Server B 上的节点。Server A 和 B 之间唯一的联系,就是 Server B 上的所有节点开始启动集群时,都从 Server A 上添加一个相同的节点。这样可以让 Server A 上的节点服务器 A 和服务器 B 组合成一个集群。所以我认为根据这种情况使用TCPGOSSIP是最合适的方式。
    • 正如你所说的问题是一个被污染的视图,那么你能告诉我它是怎么发生的吗?以及如何避免?谢谢。
    猜你喜欢
    • 2016-06-08
    • 2011-05-30
    • 2012-02-09
    • 2021-02-18
    • 2012-10-30
    • 2021-12-30
    • 2023-03-17
    • 2015-05-04
    • 1970-01-01
    相关资源
    最近更新 更多