简体   繁体   English

为什么并发执行事务是可取的?

[英]Why concurrent execution of transactions is desirable?

Can somebody please explain me why concurrent execution of transactions is desirable?有人可以解释一下为什么并发执行事务是可取的吗? I couldn't find a clear answer even though searched for hours.即使搜索了几个小时,我也找不到明确的答案。 Thank you.谢谢。

why concurrent execution of transactions is desirable为什么并发执行事务是可取的

Without concurrent execution of transactions, your application throughput is limited to inverse of your transaction duration.如果没有并发执行事务,您的应用程序吞吐量将受限于您的事务持续时间的倒数。

Eg if each transaction takes 50ms, your throughput limited to 20 transactions per second.例如,如果每个事务需要 50 毫秒,则您的吞吐量限制为每秒 20 个事务。 Which means you can't perform a lot of transactions or support a large number of users.这意味着您无法执行大量交易或支持大量用户。

Concurrency does not help in the case of a single-core/single-node case.并发在单核/单节点情况下没有帮助。 (Except in the case when reading from disk takes a lot more time that can be used for processing something else) (除非从磁盘读取需要更多时间用于处理其他内容)

Because at any time, you can only run one transaction.因为在任何时候,您只能运行一个事务。 So you can run all the transactions one after the other without any interleaving of operations between different transactions and get the same performance.因此,您可以一个接一个地运行所有事务,而无需在不同事务之间进行任何操作交错并获得相同的性能。

In case of multi-core/multi-node case, you can make use of parallel processing and run multiple transactions parallelly.在多核/多节点情况下,您可以利用并行处理并并行运行多个事务。

If you run the transactions one by one, you can't make use of the multiple cores/nodes.如果您一个一个地运行事务,则无法使用多个核心/节点。 So we need to run transactions in parallel on the multiple cores/nodes and make sure the concurrency control protocols are in place to keep the database consistent when multiple transactions running concurrently (simultaneously at the same time).因此,我们需要在多个内核/节点上并行运行事务,并确保并发控制协议到位以在多个事务并发(同时同时)运行时保持数据库一致。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM