MSDTC 是一个很大的资源消耗吗?
那么,MSDTC 是否会消耗系统(服务器和应用程序)的大量资源?
过去,我编写过几个依赖 MSDTC 进行数据库事务的大型 Web 应用程序。我从来没有调查过这会对服务器造成多大的消耗。
目前,我正在使用 CSLA 框架,并且 CSLA 不依赖 MSDTC 进行事务。它基本上重用相同的连接对象并执行 TransactionScope 对象中的所有数据库命令。
我想我正在寻找一些关于是否使用 MSDTC 的论据。
So, Is MSDTC a big resource drain on a system (server & application)?
In the past, I have written several large scale web applications that rely on MSDTC for database transactions. I have never investigated how much of a drain that would be on the server.
Currently, I am working with CSLA framework and CSLA doesn't rely on MSDTC for transactions. It basically reuses the same connection object and executes all database commands within a TransactionScope object.
I guess I am looking for some arguments either way as to using MSDTC or not.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MSTDC 用于分布式事务。为简化起见,如果需要分布式事务,即:如果 TransactionScope 包含一段隐含多个资源的代码,则使用
TransactionScope
可以隐式使用 MSDTC。这称为升级,大多数情况下会自动发生。所以,是的,它需要一些资源,但如果您确实需要跨多个系统的 ACID 事务(“资源管理器”,例如 Windows 操作系统上的 SQL Server、Oracle 或 MSMQ),您没有太多选择,只能使用 MSDTC。
配置 MSDTC 时可以完成的有关性能的一件事是确保分布式资源池只有一个协调器,从而避免 MSDTC 之间的通信。配置通常是您在使用 MSDTC 时面临的最大问题。示例如下: http://yrushka.com/index.php /security/configure-msdtc-for-distributed-transactions/
MSTDC is used for distributed transaction. To simplify, using a
TransactionScope
can implicitely use MSDTC if the transaction needs to be distributed, ie: if the TransactionScope surrounds a piece of code that implies more than one resource. This is called escalation, and most of the time happens automatically.So, yes it takes somes resources, but if you do need ACID transaction across multiple systems ("resource managers", like SQL Server, Oracle, or MSMQ for example) on a Windows OS, you don't have much choice but use MSDTC.
One thing about performance that can be done when configuration MSDTC, is ensure there is only one Coordinator for a pool of distributed resources, avoiding MSDTC to MSDTC communication. Configuration is usually the biggest problem you'll face with MSDTC. Example here: http://yrushka.com/index.php/security/configure-msdtc-for-distributed-transactions/
与您的应用程序相比可能不是。我在当前的项目中使用它,但我从未注意到它会影响 CPU 资源。你必须要注意的是延迟,如果你的事务涉及多个服务器,那么这将是一个比 CPU 更大的问题。
另一种看待方式是,它不会受 CPU 限制,执行将基于 IO。当然,这假设您在交易中没有进行大量计算,但这不是 DTC 的错,不是吗?
Compared to you application probably not. I use it on my current project and I have never noticed it affecting the CPU resources. What you do have to be careful about is latency, if there are multiple servers involved in your transaction that will be a much bigger problem than CPU.
Another way to look at is, its not going to be CPU bound, execution will be based on IO. Of course this assumes you don't do a lot of computation in your transaction, but that's not DTC's fault now is it?
我已将 MSDTC 用于注册多个合作伙伴(一台或多台数据库服务器以及一台或多台使用 MSMQ 的服务器)的事务。与使用一般事务相比,使用 MSDTC 在性能方面的消耗并不是什么大问题。我们通过 MSMQ 处理超过 4000 万条消息和数据,并且每条消息都有一个数据库操作(尽管有些只是缓存读取,但数量不多)。
最大的问题是,当您跨区域(例如 DMZ 到内联网)时,MSDTC 会带来巨大的痛苦。让位于不同区域的人员进行注册是可能的,但需要进行调整。如果您有兴趣,DTC 还有大量配置选项。
I have used MSDTC for transactions enrolling multiple partners (one or more DB servers and one or more servers using MSMQ). The drain of using MSDTC in terms of performance vs. using transactions in general isn't a big deal. We were processing more than 40 million messages a data through MSMQ and every single one had a db action as well (though some were just cached reads, not many though).
The biggest problem is MSDTC is a huge pain in the but when you are crossing zones (e.g. DMZ to intranet). Getting stuff to enroll when they are in different zones is possible but takes tweaking. DTC also has a large number of configuration options if you are interested.