To understand the three phase commit better, it is highly recommended to read first the two phase commit article.
In addition to the 2 phase commit the 3 phase commit is a non-blocking operation, which scales better on high load distributed environments. In addition to the simpler two phase commit the 3pc has some more additions to ensure to avoid blocks on resources.
How exactly does the 3pc work?
- ask the resource first if the commit can be done
on asking it uses a timeout
- do a prepare commit
also adds a timeout here
- do the commit
also uses a timeout
In all three phases of the commit the major goal was always to avoid a lock on the resource.