Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Two-Phase Commit Protocol

Pragya Keshap answered on March 1, 2023 Popularity 8/10 Helpfulness 1/10

Contents


More Related Answers

  • What is two-phase commit pattern(2PC)
  • failed two-phase commit
  • Successful two phase commit
  • What is the problem of two-phase commit protocol?
  • Why is the two-phase commit algorithm used in distributed transactions?
  • Which component executes two-phase commit protocol in a distributed database?
  • Two-phase commit pattern

  • Two-Phase Commit Protocol

    0

    Two-phase commit protocol (or 2PC) is a mechanism for implementing a transaction across different software components (multiple databases, message queues etc.)

    3.1. The Architecture of 2PC

    One of the important participants in a distributed transaction is the transaction coordinator. The distributed transaction consists of two steps:

    Prepare phase — during this phase, all participants of the transaction prepare for commit and notify the coordinator that they are ready to complete the transaction

    Commit or Rollback phase — during this phase, either a commit or a rollback command is issued by the transaction coordinator to all participants

    The problem with 2PC is that it is quite slow compared to the time for operation of a single microservice.

    Coordinating the transaction between microservices, even if they are on the same network, can really slow the system down, so this approach isn't usually used in a high load scenario.

    3.2. XA Standard

    The XA standard is a specification for conducting the 2PC distributed transactions across the supporting resources. Any JTA-compliant application server (JBoss, GlassFish etc.) supports it out-of-the-box.

    The resources participating in a distributed transactions could be, for example, two databases of two different microservices. 

    Popularity 8/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Mar 01 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.