[jboss-user] [JBossCache] - TreeCache data integrity across cluster
magicmac
do-not-reply at jboss.com
Thu Jul 20 18:13:37 EDT 2006
Hey,
These are my first steps with JBossCache, but it seems like I already face some basic problem
Simple example:
2-node cluster, each with instance of treeCache. Out of AS.
REPL_SYNC, locking PESSIMISTIC, state is replicated on startup.
run the following algorithm on to machines concurrently:
Machine A:
for i=0..100
counter = tree.get(fqn,counter_key,counter_value);
counter++;
tree.set(fqn,counter_key);
Machine B:
exactly the same code
The result: of course counter is <<200 since we lack synchronization of given get-put blocks.
As I already found out there is no cluster-wide lock. The locks I can explicitly acquire on node are not broadcasted.
It seems that I need transactions for that.
Machine A:
for i=0..100
beginDummyTransaction
counter = tree.get(fqn,counter_key,counter_value);
counter++;
tree.put(fqn,counter_key);
commitDummyTransaction
Machine B: same as A.
Unfortunatelly with such approach I get TimeoutExceptions as B for some reason cant aquire write-lock (or A).
The commit is a 2PC and from logs it really seems to work sync. The lock-aquiring-problem occurs when the other transaction tries to commit.
Is there any way of providing 100% integity of data when heavy updates occur in multiple cluster nodes? In my particular case, I need to buffer the stats of user buisness-logic operations of very-heavy accessed web portal. Such updates occur up to 100/sec per machine. Since there is no explicit cluster-wide locking how can I achieve it? Is there a way of aquiring write-lock at the begining of transaction (on read) and force other readers to wait till this lock is realesed on commit ? Or something like that/simulation of critical section.
I may not express myself clearly here so if you need any more info let me know.
Thanks for any light
M.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3959719#3959719
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3959719
More information about the jboss-user
mailing list