问题
I am trying to understand the Impact of XA Datasources on Performance.
In many applications, it happens that not all the transactions need to participate in Distributed Transactions (meaning only a few transactions require to be distributed/participating with other resources).
Is the trade-off of the performance high enough to have two data sources configured (one each for XA and non-XA)? Again, the answer is, it depends on the scenario, but I am looking for "Best Practices".
回答1:
It is worth to use XA transactions only when required. The XA commit code path has a cost of 3-4 times compared to the non-XA case. Most of the cost is caused by the additional communication. The shorter the transaction the higher the cost.
There are some XA features that try to reduce the cost: like 1-Phase commit optimization and the read-only optimization. Also promotable XA can help if the underlying database and drivers support it.
来源:https://stackoverflow.com/questions/12305900/performance-overhead-of-xa-data-sources-best-practices