XA数据源的性能开销

XA数据源的性能开销

本文介绍了XA数据源的性能开销 - 最佳实践的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解XA数据源对性能的影响。

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).

性能的折衷是否足以配置两个数据源(XA和非XA各一个)?同样,答案是,这取决于场景,但我正在寻找最佳实践。

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".

推荐答案

值得仅在需要时使用XA事务。与非XA情况相比,XA提交代码路径的成本是3-4倍。大部分成本是由额外的沟通造成的。事务越短,成本越高。

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.

有一些XA功能试图降低成本:如1阶段提交优化和只读优化。如果底层数据库和驱动程序支持它,也可以提升XA。

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.

这篇关于XA数据源的性能开销 - 最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 20:01