2-phase commit - finding implementation

I am looking for an implementation of a two phase commit protocol and yes, I am new to distributed transactions :) Two phase commit must be implemented between a php application and a remote "application" (system).

Do I need to do a two-phase commit from scratch? Do you know of any modules implemented in any language that could give me a start?

- I still haven't found a lot :)

appreciate any help.


source to share

3 answers

Take a look at the LIXA Transaction Manager ( http://lixa.sourceforge.net/ ), it integrates PHP and MySQL since 0.9.0

It provides distributed transaction processing and two-phase commit functionality.


Ch. F.



Perhaps you could take a look at Atomikos , which is an open source implementation for distributed transactions in java. Alternatively, you can read about JTA for a few more pieces of information on distributed transactions.

In principle, 2-phase commit (2PC) is theoretically not very clear:

  • all participating systems are asked if they can now
  • all of these systems must answer yes / no, whereas yes means that from now on the commit must go through
  • when all systems have given them everything is fine, they will do the commit and that it
  • in case one system does not agree that all systems should roll back.
  • the coordinating system must expect to reach an acceptable level within a certain time interval, otherwise it must consider it as inconsistent to commit


Check Enduro / X middleware . It also performs two-phase commit. Using the basic XA framework and from above, they provide XATMI calls, tpopen (), tpbegin (), tpcommit (), tpend (). Some concept diagram is at enduro.org . Sources of transaction management are here . Note that it uses the XATMI framework to coordinate with another transaction manager - these are exposed as services. See XA Decision Machine .

See Enduro / X PHP Client , maybe you can use something. Probably the XATMI support service could be coded for PHP as well.



All Articles