java - 使用 infinispan 进行 http 会话集群和缓存时经常出现 TimeoutException
问题描述
我有两台服务器需要进行 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>
解决方案
这看起来像是一个非常古老的 Infinispan 版本。不能考虑升级吗?
推荐阅读
- python - 是否可以永久更改 QFileDialog 的“选择”按钮文本?
- python - 如果单元格开头有 -* 结尾有 *,则更改单元格中的值
- python - 枕头保存以缓冲 aws lambda 上的缓慢
- c++ - 尝试使用 Eclipse for C++ 查看变量内容时,gdb (9.2) 失败
- javascript - 如何使用 Flask 和 JavaScript 在不刷新页面的情况下处理 Excel 文件以供下载?
- c# - 一对多关系不会在实体框架中检索数据
- gtk - 将 GEGL 与 GTK 4 一起使用,以获得具有平移/缩放支持的简单图像查看器
- javascript - 改善眉毛和眼睛细节检测的方法
- c++ - 我的递归二进制搜索算法有什么问题?
- html - 如何在 CSS 网格中使用行跨度