I have the following scenario. We use infinispan cache and mysql database to store our data.We use atomikos transaction manager to manage JTA Xa transatcions. When i do profiling i see teh following scenario for my usecase.
I have a business use ucase in which i have multiple cache reads and a single database and cache write.
So in teh prepare phase how will teh transactiosn give intruction to participating resources.
1 .I see that each of the cache , irrespective of read or write is registerd as participant . Is this expected ? (we use repetable_read as isolation level)
So there are multiple prepare calls for each cache read.
2. Also i observe that when i do teh second operation (within the same call trace) , atomikos doesnt regiter this as a participant. So there is only one prepare call (if i do teh same operation twice)
3. So does it mean a prepare call will be sent once per combination fo cache and cache key ? [That is if i do 5 operation, 3 operation on teh cache c1 but different keys , and two operation on cache c2 and same key, totally there will be 4 prepare calls and 4 commit calls as aprt of xa]
Since i am aware that most of the operations i perform are cache reads with few databse writes is there any optimization i can do to avoid these calls ? [Also are these calls nececessary because i am using REPEATABLE:_READS]
1. yes, it is. If you only read just run the read out of the scope of a transaction. Even if you run in the scope of a transaction, the prepare call is very cheap.
2. that's correct as well
3. a prepare is sent once per cache/transaction. In your example there should be 2 prepare calls: one for c1 and one for c2.
|Retrieving data ...|