PHP: Implementation of distributed transactions and two-phase commit Solutions

Source: Internet
Author: User

Due to language features and applicable scenarios, PHP's Distributed Transaction implementation is not as mature as Java.

If you want to implement distributed transactions using PHP,

1. Refer to the atomikos project atomikos,

The solution instructions can be downloaded and read from the following resources:

Http://download.csdn.net/detail/iefreer/5148135

This is an open-source Java implementation of distributed transactions.

In addition, you need to read relevant XA/JTA content to learn more about distributed transactions.

Basically, two-phase commit 2-phase-commit (2 PC) is not hard to understand theoretically:

  • All participating systems will be asked if they can be submitted
  • All these systems must answer this question, yes or no, Which means that from that moment on, the submission can pass
  • Execute the commit when all systems are okay. That's all.
  • In case of a system problem, all systems must be synchronized and rolled back.
  • The coordination system requires that a response be returned within a specific period of time. Otherwise, the response is considered as a negative answer.

2, you can also look at the LIXA Transaction Manager (http://sourceforge.net/projects/lixa)

Starting from 0.9.0, it integrates PHP and MySQL.

It provides distributed transaction processing, including the implementation of the two-phase commit function.

By iefreer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.