English 中文(简体)
Is transactions over machine boundary (via tcp-ip) possible?
原标题:

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

最佳回答

Yes, this problem has been (more or less) solved already :)

What you re looking for is the Two-Phase Commit protocol.

In transaction processing, databases, and computer networking, the two-phase commit protocol (2PC) is a type of an atomic commitment protocol. It is a distributed algorithm that coordinates all the processes that participate in a distributed atomic transaction on whether to commit or abort (roll back) the transaction. The protocol achieves its goal even in many cases of system failure (involving either process, network node, communication, etc. failures), and is thus widely utilized.

问题回答

Sounds like the standard problems of distribution.

Read Distributed Computing: Principles, Algorithms, and Systems and ask the question again ;)





相关问题
C# Networking API s [closed]

Lately I ve been looking for a good networking API i could possibly use and/or reference some of the code within, but i have mere luck searching for some on Google/Bing. Hopefully somebody here has ...

Listen to a port that is in use [duplicate]

Possible Duplicate: Get connecting IP from specified ports that using by other program. If a port is used by a program, is there any way I can listen that port and get the connected IP on that ...

Twisted Spread suitable for multiplayer racing sim?

Do you think that Twisted Spread may be suitable (in terms of performance) for a multiplayer racing simulator? The rest of the application is based on Python-Ogre. Can Perspective Broker run upon (...

Optimizing a LAN server for a game

I m the network programmer on a school game project. We want to have up to 16 players at once on a LAN. I am using the Server-Client model and am creating a new thread per client that joins. ...

multicast ip address - blocked in call to recvfrom

i am writing a simple multicast application. i intend to run it on localhost. i have done the following: char *maddr; . . . sendfd = socket(...); struct sockaddr_in sasend; sasend.sin_family = ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

热门标签