是否可以通过机器边界(通过 tcp-ip)进行交易?
理论上,可以定义一种协议,其中一台机器对另一台机器(或多台机器)进行一些远程调用,并且在该过程的任何部分中,如果任何机器(或操作)失败,或者通信中断,一切都会失败。已回滚? (就像数据库可以一样)
我问这个问题,因为在硬件级别上,人们总是说,如果没有原子处理器操作(测试和设置),就无法进行原子操作(事务的一个非常重要的组成部分)。
但由于现在我们谈论的是多台机器,所以这是行不通的。
举个例子,这将是多么棘手:假设我有一个协议可以在远程计算机上发出命令,并获得响应。可能是调用了该方法,但在响应传输期间,连接中断了。那么也很可能执行操作的机器认为一切正常,但接收机器从未得到答案。
添加 Ack 没有帮助,因为 ack 也可能在传输过程中丢失。
有兴趣阅读其他人的想法(并了解 27 年前的一些教授可能已经提出了一个坚如磐石的解决方案)。
右
Theoretically, can one define a protocol where one machine does some remote calls on another machine (or more than one), and where in any part of the process, if any of the machines (or operations) fails, or the communication drops, everything is rolled back? (just like databases can)
I ask this, since on the hardware level, one always says that one can not make atomic operations (a very important ingredient of transactions) without an atomic processor operation (test and set).
But since now we are talking about multiple machines, this doesn't fly.
As an example how this would be tricky: Say I have a protocol to issue a command on a remote machine, and get a response back. It could be that the method is called, but during the transit of the response, the connection dies. It could then also very well be that the machine which performed the operation thinks everything was ok, but the receiving machine has never gotten the answer.
Adding Ack's doesn't help since also the ack's might be lost in transit.
Interested to read others thoughts (and to learn that some professor 27 years ago already came up with a rock solid solution probably).
R
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,这个问题已经(或多或少)解决了:)
您正在寻找的是 两个-阶段提交协议。
Yes, this problem has been (more or less) solved already :)
What you're looking for is the Two-Phase Commit protocol.
听起来像是分配的标准问题。
阅读分布式计算:原理、算法和系统 并再次提出问题;)
Sounds like the standard problems of distribution.
Read Distributed Computing: Principles, Algorithms, and Systems and ask the question again ;)