Hands-On Cloud-Native Microservices with Jakarta EE by Luigi Fugaro

Hands-On Cloud-Native Microservices with Jakarta EE by Luigi Fugaro

Author:Luigi Fugaro
Language: eng
Format: epub
Tags: COM051280 - COMPUTERS / Programming Languages / Java, COM060180 - COMPUTERS / Web / Web Services and APIs, COM091000 - COMPUTERS / Cloud Computing
Publisher: Packt Publishing
Published: 2019-01-31T17:31:07+00:00


The 2PC consensus protocol has the ability to manage node failures through the transaction log. Usually, a periodic recovery thread processes all of the unfinished transactions.

One of the main disadvantages of the 2PC protocol is that it is a lock-based protocol. If the coordinator fails after the first phase has completed, all of the participants will be blocked waiting for the coordinator's decision, and will not be able to progress until it recovers.

3PC protocol

The 3PC protocol is an extension of the 2PC protocol, and its goal is to overcome its limits, which are related to its blocking nature.

One of the main features of this consensus protocol is that it is non-blocking; this doesn't mean that the participants are not blocked during processing, but it means that the protocol can proceed in spite of failures.

It consists of three phases; the prepare phase and the commit (or abort) phase are the same as those of the 2PC protocol.

However, it introduces a new phase, which we can define as a prepared state, where all of the participants of the transaction will define their statuses. The status can be either waiting or pre-commit. This means that the final phase can only have one, final state—aborted, if the previous phase was waiting, or commit, if the previous phase was pre-commit.

3PC mitigates the blocking nature of 2PC. The problem is that it obtains it with a more complicated protocol, and with a need to send another message before deciding to commit or abort the transaction. Furthermore, it does not solve the issue with network partitions.

3PC is not widely used in production environments.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.