2 Replies Latest reply on Jun 29, 2006 4:03 AM by Andrew Swan

    Deploying a db as both local and XA simultaneously

    Andrew Swan Newbie

      I have an app that 95% of the time only needs to use one database (call it "A"). The other 5% of the time, it needs to transactionally update both "A" and a second database "B".

      Obviously for the latter use case, I need to deploy both "A" and "B" using the <xa-datasource> tag. However I'm concerned that using global transactions will needlessly impact performance for the 95% of cases that only need local transactions.

      My questions are therefore:

      1. Does using XA instead of local transactions have any significant performance penalty?

      2. If yes, is there anything wrong with deploying database "A" twice to JBoss, once as a <local-tx-datasource> (for the 95% of cases) and once as an <xa-datasource> (for the 5% of cases)? I've tried this in a small test app and it seems to work.

        • 1. Re: Deploying a db as both local and XA simultaneously
          Weston M. Price Master

          1. Does using XA instead of local transactions have any significant performance penalty?

          Almost always this is the case. Reasons for this are varied, but at the very least, the 2PC protocol always adds overhead. This is one of those times where you have to ask yourself...'Do I really, really, really need XA?' Typical XA scenarios are JMS, or as you laid out mutliple DB access in a single transaction.

          2) is there anything wrong with deploying database "A" twice to JBoss, once as a <local-tx-datasource> (for the 95% of cases) and once as an <xa-datasource> (for the 5% of cases)?

          Not at all. While this is not a typical use case (it's usually either/or), there is nothing wrong with this and given your requirements, seems to make the most sense.

          • 2. Re: Deploying a db as both local and XA simultaneously
            Andrew Swan Newbie

            Thanks so much, Weston, for your quick, complete, and helpful reply!

            Andrew