Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2-phase commit - looking for an implementation

I am looking for an implementation of the 2-phase commit protocol and yes i am new to distributed transactions :) A 2-phase commit will have to implemented between a php application and a remote 'application' (system).

Will i have to implement the 2-phase commit from scratch ? Are you aware of any modules implemented in any language that could give me a head start?

-- could not find much on this until now :)

appreciate any help.

like image 999
Andreas Avatar asked Mar 10 '12 20:03

Andreas


2 Answers

Maybe you could have a look at Atomikos, which is an open source implementation for distributed transactions in java. Furthermore you might want to read about the JTA to get some more pieces of information about distributed transactions.

Basically 2-phase-commit (2PC) is not very difficult to understand in theory:

  • all participating systems are asked if they are able to commit now
  • all of those systems have to answer yes/no whereas a yes means that from that moment on a commit must go through
  • when all systems gave their okay they will execute the commit and that's it
  • in case one system disagrees all systems have to roll back
  • the coordinating system should expect to reach an okay within a certain time frame otherwise it should treat it as disagree to commit
like image 173
Markus Avatar answered Sep 23 '22 23:09

Markus


Take a look to LIXA Transaction Manager (http://lixa.sourceforge.net/) it integrates PHP and MySQL starting with release 0.9.0

It provides Distributed Transaction Processing and two phase commit feature as well.

Regards

Ch. F.

like image 37
Christian Ferrari Avatar answered Sep 22 '22 23:09

Christian Ferrari