4 Replies Latest reply on Aug 29, 2012 2:22 PM by fangyuchen

    Grouping Api and its Effect on JTA Transaction

    fangyuchen

      Hi, I use Weblogic 11g and Infinispan 5.1.5 on a two-node cluster. There are two caches on the cluster and each cache has only one copy of data. I want to put elements on that two caches transactionally so I use Weblogic built-in JTA transcation manager. In order to reduce transaction cost. I use Grouping api. So all the data that I want to put is in the same node. I hope that could reduce a two-phrase transaction into one-phrase. But Weblogic still tell me it uses two-phrase transaction. 

       

      Use Grouping API when doing JTA has any advantage?

       

      Is it possiblity for infinispan to reduce into a one-phrase transaction?

       

      Thanks.

        • 1. Re: Grouping Api and its Effect on JTA Transaction
          an1310

          Take a look at synchronizations (https://docs.jboss.org/author/display/ISPN/Infinispan+transactions)

           

          The grouping API does have benefits; I use it for my use case where I have to pessimisticly acquire locks on keys across several caches in the same transaction.  By knowing the group, I can execute it on the local data owner, which means all lock acquisition is local -- no RPC involved.  You'll probably see a similar benefit.

          • 2. Re: Grouping Api and its Effect on JTA Transaction
            fangyuchen

            I checked the synchronizations. But I do not think it can keep the consisitency between the two cache as two-phase transction does.

             

            Do you mean to use the lock operation to explictly acquire the lock on the cache?

             

            In my use case, it is possibile that the Node A process the transcation but the Node B own all the data. So the RPC can not be avoided.

             

            • 3. Re: Grouping Api and its Effect on JTA Transaction
              an1310

              Depending on what you mean about "consistency," you may also need to check out recovery.

               

              As for your use case, you may also want to check out the DistributedExecutor service.  That way you can serialize a task that executes on the main key owner.  You'll still incur a RPC marshalling the requisite data, but the transaction can be run in the task context.  This way, the transaction only runs on the main data owner and any backups -- say (B,C), rather than (A,B,C). 

              • 4. Re: Grouping Api and its Effect on JTA Transaction
                fangyuchen

                To achieve the ACI (not D, its in memory)  . The two-phase transaction has its problem. But it is much stronger than the synchronizations. 

                 

                Use  DistributedExecutor  is an option  need  invesigate because we hope to use client-server mode finally when hotrod fully support JTA. (Infinispan team guys, please don't make us wait too long. we keen to that)

                 

                Thank you for your advice.