What's use1PcForAutoCommitTransactions all about?
Don't be scared the name, use1PcForAutoCommitTransactions is a new feature (5.1.CR1) that does quite a cool thing: increases your transactions's performance.
Let me explain.
Before Infinispan 5.1 you could access the cache both transactional and non-transactional. Naturally the non-transactional access is faster and offers less consistency guarantees.But we don't support mixed access in Infinispan 5.1, so what what's to be done when you need the speed of non-transactional access and you are ready to trade some consistency guarantees for it?
Well here is where use1PcForAutoCommitTransactions helps you. What is does is forces an induced (autoCommit=true) transaction to commit in a single phase. So only 1 RPC instead of 2RPCs as in the case of a full 2 Phase Commit (2PC).
At what cost?
You might end up with inconsistent data if multiple transactions modify the same key concurrently. But if you know that's not the case, or you can live with it then use1PcForAutoCommitTransactions will help your performance considerably.
An example
Let's say you do a simple put operation outside the scope of a transaction:
Now let's see how this would behave if the cache has several different transaction configurations:
Not using 1PC...
The put will happen in two RPCs/steps: a prepare message is sent around and then a commit.
Using 1PC...
The put happens in one RPC as the prepare and the commit are merged. Better performance.
Not using autoCommit
An exception is thrown, as this is a transactional cache and invocations must happen within the scope of a transaction.
Enjoy!
Mircea
No comments:
Post a Comment