首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在失效模式下的Infinispan集群- get(key)返回NULL,尽管某些节点具有此值。

在失效模式下的Infinispan集群- get(key)返回NULL,尽管某些节点具有此值。
EN

Stack Overflow用户
提问于 2015-01-08 12:23:16
回答 1查看 1.9K关注 0票数 1

我有以下拓扑: Infinispan集群处于失效模式,puts在一个节点上执行,gets在另一个节点上执行。当集群仅由两个节点组成时,一切都运行良好:当键/值被插入到一个节点时,另一个节点(当第一次被请求时)查询该节点并从中获取值。如果键被更新/删除,则发送无效消息。

当集群中有两个以上的节点时,问题就开始了:在将键插入到一个节点之后,当另一个节点被请求获取该键及其值时,它会多次返回值,有时返回NULL。

从某些角度来看,这是有意义的,因为节点查询它的邻居,其中一些具有这个值,而另一些则没有。不管是哪个答复,都将定义响应是NULL还是真实值。

虽然有道理,但这种行为使这种操作模式变得毫无用处,这使我认为我可能遗漏了什么。这是我的配置:

代码语言:javascript
复制
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd"  xmlns="urn:infinispan:config:7.0">
    <jgroups>
        <stack-file name="tcp" path="jgroups-tcp.xml" />
    </jgroups>
   <cache-container name="SampleCacheManager" statistics="true" default-cache="invalidatedWithClusterCacheLoaderCache" shutdown-hook="DEFAULT">
     <transport stack="tcp" cluster="clustered" node-name="NodeA"/>
     <serialization marshaller="org.infinispan.marshall.core.VersionAwareMarshaller"            version="1.0">
     </serialization>
     <jmx domain="org.infinispan" />    
     <invalidation-cache name="invalidatedWithClusterCacheLoaderCache" mode="SYNC" remote-timeout="20000" >
        <persistence>
                <cluster-loader remote-timeout="20000" preload="false" ></cluster-loader>
        </persistence> 
     </invalidation-cache>
   </cache-container>
</infinispan>

Jgroup-tcp.xml:

代码语言:javascript
复制
<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.4.xsd">
    <TCP bind_port="7800" port_range="10"
         recv_buf_size="20000000"
         send_buf_size="640000"
         loopback="false"
         max_bundle_size="64k"
         bundler_type="sender-sends-with-timer"
         enable_diagnostics="true"
         thread_naming_pattern="cl"

         timer_type="new"
         timer.min_threads="4"
         timer.max_threads="10"
         timer.keep_alive_time="3000"
         timer.queue_max_size="1000"
         timer.wheel_size="200"
         timer.tick_time="50"

         thread_pool.enabled="true"
         thread_pool.min_threads="2"
         thread_pool.max_threads="8"
         thread_pool.keep_alive_time="5000"
         thread_pool.queue_enabled="true"
         thread_pool.queue_max_size="100000"
         thread_pool.rejection_policy="discard"

         oob_thread_pool.enabled="true"
         oob_thread_pool.min_threads="1"
         oob_thread_pool.max_threads="8"
         oob_thread_pool.keep_alive_time="5000"
         oob_thread_pool.queue_enabled="false"
         oob_thread_pool.queue_max_size="100"
         oob_thread_pool.rejection_policy="discard"/>

   <MPING bind_addr="${jgroups.bind_addr:127.0.0.1}" break_on_coord_rsp="true"
          mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
          mcast_port="${jgroups.mping.mcast_port:43366}"
          ip_ttl="${jgroups.udp.ip_ttl:2}"
          num_initial_members="2" timeout="2000"/>

    <MERGE3/>

    <FD_SOCK/>
    <FD_ALL interval="2000" timeout="5000" />
    <VERIFY_SUSPECT timeout="500"  />
    <BARRIER />
    <pbcast.NAKACK use_mcast_xmit="false"
                   retransmit_timeout="100,300,600,1200"
                   discard_delivered_msgs="true" />
    <UNICAST3 conn_expiry_timeout="0"/>

    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
                   max_bytes="10m"/>
    <pbcast.GMS print_local_addr="true" join_timeout="5000"
                max_bundling_time="30"
                view_bundling="true"/>
    <MFC max_credits="2M"
         min_threshold="0.4"/>
    <FRAG2 frag_size="60000"  />
    <pbcast.STATE_TRANSFER  />
</config>

总结一下我的问题:它是应该这样工作还是在我的情况下配置错了?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-01-08 18:33:08

失效缓存不检索远程值。这里描述了1.它只在内存中本地检索值。

远程查找是由您在持久性配置中配置的集群加载器完成的。这将向集群中的所有其他节点请求值。我调整了一个现有的Infinispan测试,使其有两个以上的缓存,正如您所经历的,远程查找中有一个遗漏。如果没有值的节点返回具有值的节点(它接受第一个响应),则缓存加载程序将返回null。

我登录了2个来调查这个。

1 2

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27840070

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档