开发者

What are the disadvantages of implementing transactions away from the database?

开发者 https://www.devze.com 2023-01-18 14:03 出处:网络
We know that there are some scenario开发者_如何学Cs that require us to implement transactions in code, such as SqlTransaction/TransactionScope in .Net framework. The questions are:

We know that there are some scenario开发者_如何学Cs that require us to implement transactions in code, such as SqlTransaction/TransactionScope in .Net framework. The questions are:

  1. What are the overheads (besides speed)?
  2. Does it gets worse if we add more layers between the transaction and the DB? If yes, then what are the overheads and what cause these overheads?


We want to keep transactions short, to begin them as late as possible and to end them as early as possible. Otherwise concurrency hurts, and we are getting more lock waiting and deadlocks.


Long running transaction can also cause transaction log to fill.

Adding more layers between transaction and DB itself doesn't add overhead on the transaction but it will increase the probability of something going wrong and leaving transaction uncommitted and long running transaction.

0

精彩评论

暂无评论...
验证码 换一张
取 消