Question 5.
Why is a two-phase commit protocol better than a one-phase atomic commit protocol?
A one-phase atomic commit is where a transaction may consist of a number of individual transactions which carry out processes such as reading and writing to a database. When the transaction is completed all the individual transactions must have successfully carried out their tasks. A one-phase commit protocol involves a coordinator periodically communicating with the servers that are carrying out each individual transaction in order to inform them whether to commit the transaction or abort it.
A two-phase commit protocol is a protocol where a transaction contains a number of operations which require a number of servers to operate in conjunction with each other. The transaction ensures that if all the servers involved in the transaction are able to carry out their part then the transaction is carried out; if one or more servers are unable to carry out their part, then the transaction is aborted. Each server decides whether it can commit or not and reports back to the coordinator. If all servers vote to commit their transactions, then the coordinator advises all servers that they can commit. It only one server cannot commit then the coordinator will abort the transaction and sends a message to all servers to abort the transaction.
According to Ince (2004), a one-phase commit is inadequate because it prevents a server from making a decision unilaterally to abort a transaction.
References
Ince, D (2004). Developing Distributed and E -Commerce Applications (2nd ed.). Essex: Pearson Education Limited.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment