A Distributed and Hierarchical Architecture for Deferred Validation of Transactions in Key-Value Stores (Extended Abstract of the Msc Dissertation)

A Distributed and Hierarchical Architecture for Deferred Validation of Transactions in Key-Value Stores (Extended Abstract of the Msc Dissertation)

A Distributed and Hierarchical Architecture for Deferred Validation of Transactions in Key-Value Stores (extended abstract of the MSc dissertation) Joao˜ Bernardo Sena Amaro Departamento de Engenharia Informatica´ Instituto Superior Tecnico´ Advisor: Prof. Lu´ıs Eduardo Teixeira Rodrigues Abstract—Key-value stores are today a fundamental com- currency control, any concurrency control algorithm must ponent for building large-scale distributed systems. Early key- be able to totally order transactions that access the same value stores did not offer any support for running transactions objects. The need for totally ordering transactions represents but, with time, it became obvious that such support could simplify the application design and development. The key a fundamental impairment for the scalability. challenge in this context is to support transactional seman- Therefore, in this work we look for techniques that can tics while preserving the scalability properties of key-value mitigate the bottlenecks that may result from the need for stores. In this work we propose an architecture to perform totally ordering transactions. In particular, we are inspired transaction validation in a distributed and scalable manner. by the work of [4], that uses an hierarchical network of The architecture is based on a tree of transaction validators, where the leaf nodes are responsible for single partitions, transaction validators, to validate transactions that access offering higher throughput and lower latency, while non-leaf disjoint sets of objects in parallel. Concretely, the goal of this nodes are responsible for several partitions. We have performed work is to combine the hierarchical communication pattern an experimental validation of the proposed architecture that used in [4] with message batching techniques to build a highlights its advantages and limitations. The evaluation shows novel transactional system that is able to support a larger that, in some scenarios, the proposed architecture can offer improvements up to 23% when compared to other validation number of clients and higher throughput. and commit strategies, such as distributed two-phase commit. II. RELATED WORK A. Transactions I. INTRODUCTION A transaction is a sequence of read and write operations Key-value storage systems have today a crucial role in that are executed as if they were just a single operation large scale distributed systems due to their scalability and executed atomically. The transaction either succeeds (com- ability of supporting high access rates. An example of a mits) or not (aborts, rolls back). If it aborts, the transaction system of this kind is Cassandra [1], which is able to can be safely retried, since no intermediate results from the store terabytes of information while supporting hundreds of aborted run took effect. This abstraction simplifies error han- thousands of accesses per second. Unfortunately, in order dling, because the application does not have to worry about to achieve good performance, these systems do not have partial failures. Also, transactions shield the programmers support for running transactions, which makes the devel- from dealing explicitly with concurrency control, given that opment of applications that use key-values stores harder the final outcome is guaranteed to be the same as if the and prone to errors [2]. As such, there has been a growing transaction was executed in serial order with regard to other interest in developing mechanisms that allow the execution transactions. of transaction in these systems without strongly penalising Formally the concept of a transaction was first described their performance. by a set o properties known as the ACID properties [3]. It A transaction is an abstraction that allows to execute a stands for Atomicity, Consistency, Isolation and Durability. sequence of operations as if it was an indivisible single In this work our focus is in the atomicity and isolation operation that is executed atomically. This intuitive notion properties, and these can defined as follows: can be described more precisely by a set o properties known • Atomicity: states that a transaction is indivisible, and as the ACID properties [3], namely Atomicity, Consistency, therefore, it is not possible to observe partial results. Isolation and Durability. In other words, either all operation that execute a Key to the implementation of transactions is a concur- transaction take effect (if the transaction commits) or rency control mechanism, whose purpose is to ensure that none of the operations take effect (if the transaction the interleaving of the operations executed by concurrent aborts). transactions produces a result that is consistent. Although • Isolation: means that two concurrent transactions are there are many different techniques to implement con- isolated from each other. The classic notion of isolation 1 was formalised as serialisability [5], which states that Note that if a transaction involves a single node, the two the outcome of running multiple transactions concur- phases above can be collapsed. In fact, the (single) partici- rently is guaranteed to be the same as if these transac- pant has all the information required to decide the outcome tions had run serially. of the transaction at the end of the prepare phase, and can immediately proceed to commit or abort the transaction B. Guaranteeing Atomicity accordingly. The challenge of guaranteeing atomicity is to ensure There are two crucial points in this protocol that make that in the presence of partial failures, all outcomes of a sure it guarantees atomicity. The first is when data nodes transaction either persist or none do. Partial failures are respond to a prepare message, if they reply with a ”yes”, failures that happen midway through the execution of a they are making a promise that no matter what they will transaction and leave the state incomplete. Guaranteeing commit the transaction. The second crucial point is also an all or nothing result in these cases requires a recovery around promises, and is when the coordinator calculates the algorithm, like the AIRES [6] algorithm, that is capable of final prepare result, if it decides to commit or abort the recovering a partially executed transaction to a clean state. transaction, it can not go back on that decision. In order Guaranteeing atomicity in distributed scenarios is even for these nodes to keep their promises they have to durably harder, because transactions can fail in some nodes but store them in some way, such that, if an error, crash, or fault succeed on others. In order to guarantee atomicity all nodes occurs, they can recover their past decisions back and not must agree on the outcome of the transaction, it either break the promise. commits or aborts. This problem is related to the consensus The network costs of this protocol can be described in problem and can be solved with the help of a consensus algo- number of communication steps (latency) and total number rithm, like Paxos [7]. However, many commercial database of messages exchanged (bandwidth) as follows: systems use a simpler Two-Phase Commit Protocol [8], that N = number of data nodes involved can be implemented more efficiently than a fault-tolerant (1) consensus protocol, but may block in some faulty scenarios. in the transaction Two-Phase Commit (2PC) is a protocol used to atomically 2 N = 1 commit transactions across several nodes, i.e. to make sure communication steps = (2) that either all nodes commit or all nodes abort. The pro- 4 N > 1 tocol works in two phases (hence the name): prepare and 2 N = 1 commit/abort. total messages = (3) 4 × N N > 1 1) Prepare Phase: is the first phase of the protocol. Once a transaction has finished executing and is ready to If one data node is involved in the transaction the protocol commit, the coordinator (which is the process respon- requires 1 prepare message from the client to the data node sible for coordinating the distributed procedure) starts and 1 prepare result message from the data node to the client, the prepare phase by sending a prepare request to to commit a transaction, thus it takes 2 communication all the data nodes involved in the transaction asking steps and uses 2 network messages in total. On the other them if if they are able to commit. Then each data hand, if the transaction involves more than one data node, node verifies if it can or not commit the transaction the protocol require 4 communication steps in total that and communicates that information to the coordinator, correspond to the 4 messages exchange between the client in the form of a prepare response. The coordinator and the data nodes involved (1 prepare, 1 prepare result, 1 keeps track of the responses it receives from the nodes commit/abort, 1 commit/abort result), and requires a total o and compiles them into a final prepare result. The 4 messages per data node. outcome of the prepare phase is a decision to commit the transaction if all the nodes replied with a ”yes” C. Guaranteeing Isolation (i.e., if they can commit the transaction), or a decision When it comes to the problem of guaranteeing isolation to abort the transaction otherwise. among concurrent transactions, the first question to ask is 2) Commit/Abort Phase: starts right after the coordi- which isolation level do we want to guarantee. As described nator computes the outcome of the transaction. If in Section II-A the classic notion of isolation was formalised the outcome is a decision to commit, it means that as serialisability [5], which means that the execution of all data nodes agreed to commit the transaction, so transactions can occur concurrently but the outcome is the coordinator starts the second phase by sending a equivalent to a serial execution. Unfortunately, in practice, commit message to all the data nodes. If the outcome is using serialisability as an isolation level may be expensive a decision to abort, at least one of the data nodes could and may lead to poor performance.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us