How to control invalidation cache mode? is this a Jboss cach
hangzhouwestlake Jan 7, 2009 3:44 AMour Cluster has two physical servers, cache mode is set as invalidation and async
application is deployed on websphere 6.1 and windows XP and jboss cache 3
below is the Java code
method (){ System.out.println("Cluster members:"+cache.getMembers()); Object obj = cache.get(Fqn.fromString("/a"),"b"); if (obj == null) { cache.put(Fqn.fromString("/a"),"b", "testdata"); } }
Below are steps to reproduce my issue, it caused cache invalidated loop, how to control avoid the cache invalidated loop?
appreciate for your help!
Step 1
start server 1
and then start server 2 after 1 minutes
Step 2:
call method on server 1
below is the debug information in server 1 cache lisetner:
node /a created;
node /a modified;
step 3:
call method on server 2
Server Console print: Cluster members:[10.111.35.76:3918, 10.111.35.58:3525]
below is the debug information in server 2 cache lisetner:
node /a created;
node /a modified;
below is the debug information in server 1 cache lisetner:
node /a invalidated
Step 4:
call method on server 1
Server Console print: Cluster members:[10.111.35.76:3918, 10.111.35.58:3525]
below is the debug information in server 1 cache lisetner:
node /a created;
node /a modified;
below is the debug information in server 2 cache lisetner:
node /a invalidated
Step 5:
call method on server 2
Server Console print: Cluster members:[10.111.35.76:3918, 10.111.35.58:3525]
below is the debug information in server 2 cache lisetner:
node /a created;
node /a modified;
below is the debug information in server 1 cache lisetner:
node /a invalidated
......
This is cache configuration xml:
<?xml version="1.0" encoding="UTF-8"?> <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0"> <!-- Used to enable invocation batching and allow the use of Cache.startBatch()/endBatch() methods. --> <invocationBatching enabled="true"/> <!-- Used to register JMX statistics in any available MBean server --> <jmxStatistics enabled="false"/> <!-- Configure the TransactionManager --> <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup"/> <clustering mode="invalidation"> <!-- timeout: The max amount of time (in milliseconds) we wait until the state (i.e. the contents of the cache) are retrieved from existing members in a clustered environment --> <stateRetrieval timeout="20000"/> <!-- JGroups protocol stack properties. --> <jgroupsConfig> <UDP discard_incompatible_packets="true" enable_bundling="true" enable_diagnostics="false" ip_ttl="2" loopback="false" max_bundle_size="64000" max_bundle_timeout="30" mcast_addr="228.10.10.10" mcast_port="45588" mcast_recv_buf_size="100000000" mcast_send_buf_size="640000" oob_thread_pool.enabled="true" oob_thread_pool.keep_alive_time="10000" oob_thread_pool.max_threads="20" oob_thread_pool.min_threads="8" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="10" oob_thread_pool.rejection_policy="Run" thread_naming_pattern="pl" thread_pool.enabled="true" thread_pool.keep_alive_time="10000" thread_pool.max_threads="15" thread_pool.min_threads="8" thread_pool.queue_enabled="true" thread_pool.queue_max_size="100000" thread_pool.rejection_policy="Discard" tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" use_concurrent_stack="true" use_incoming_packet_handler="true"/> <PING num_initial_members="3" timeout="2000"/> <MERGE2 max_interval="30000" min_interval="10000"/> <FD_SOCK/> <FD max_tries="5" shun="true" timeout="10000"/> <VERIFY_SUSPECT timeout="1500"/> <pbcast.NAKACK discard_delivered_msgs="true" gc_lag="0" retransmit_timeout="300,600,1200,2400,4800" use_mcast_xmit="true"/> <UNICAST timeout="300,600,1200,2400,3600"/> <pbcast.STABLE desired_avg_gossip="50000" max_bytes="400000" stability_delay="1000"/> <pbcast.GMS join_timeout="5000" print_local_addr="true" shun="false" view_ack_collection_timeout="5000" view_bundling="true"/> <FC max_credits="500000" min_threshold="0.2"/> <FRAG2 frag_size="60000"/> <pbcast.STREAMING_STATE_TRANSFER/> <pbcast.FLUSH timeout="0"/> </jgroupsConfig> <async /> <!-- Alternatively, to use sync replication, comment out the element above and uncomment the element below. --> <!-- <sync /> --> </clustering>