<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Strong and Efficient Consistency with Consistency-Aware Durability</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>04/01/2020</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10175825</idno>
					<idno type="doi"></idno>
					<title level='j'>USENIX FAST</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>A Ganesan</author><author>R. Alagappan</author><author>A. Arpaci-Dusseau</author><author>R. Arpaci-Dusseau</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We introduce consistency-aware durability or CAD, a new approach to durability in distributed storage that enables strong consistency while delivering high performance. We demonstrate the efficacy of this approach by designing cross-client monotonic reads, a novel and strong consistency property that provides monotonic reads across failures and sessions in leader-based systems. We build ORCA, a modified version of ZooKeeper that implements CAD and cross-client mono- tonic reads. We experimentally show that ORCA provides strong consistency while closely matching the performance of weakly consistent ZooKeeper. Compared to strongly consistent ZooKeeper, ORCA provides significantly higher through- put (1.8 – 3.3x), and notably reduces latency, sometimes by an order of magnitude in geo-distributed settings.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>A major focus of distributed storage research and practice has been the consistency model a system provides. Many models, from linearizability <ref type="bibr">[20]</ref> to eventual consistency <ref type="bibr">[16]</ref>, with several points in-between <ref type="bibr">[27,</ref><ref type="bibr">29,</ref><ref type="bibr">30,</ref><ref type="bibr">[48]</ref><ref type="bibr">[49]</ref><ref type="bibr">[50]</ref> have been proposed, studied, and are fairly well understood.</p><p>Despite many years of research, scant attention has been paid to a distributed system's underlying durability model, which has strong implications on both consistency and performance. At one extreme, synchronous durability requires writes to be replicated and persisted on many nodes before acknowledgment. This model is often employed to achieve strong consistency. For example, to prevent stale reads, a linearizable system (such as LogCabin <ref type="bibr">[28]</ref>) synchronously makes writes durable; otherwise, an acknowledged update can be lost, exposing stale values upon subsequent reads. Synchronous durability avoids such cases, but at a high cost: poor performance. Forcing writes to be replicated and persisted, even with performance enhancements such as batching, reduces throughput and increases latency dramatically.</p><p>At the other extreme is asynchronous durability: each write is only lazily replicated and persisted, perhaps after buffering it in just one node's memory. Asynchronous durability is utilized in systems with weaker consistency models (such as Redis <ref type="bibr">[42]</ref>); by acknowledging writes quickly, high performance is realized, but this model leads to weak semantics, exposing stale and out-of-order data to applications.</p><p>In this paper, we ask the following question: is it possible for a durability layer to enable strong consistency, yet also deliver high performance? We show this is possible if the dura-bility layer is carefully designed, specifically by taking the consistency model the system intends to realize into account. We call this approach consistency-aware durability or CAD. We show how cross-client monotonic reads, a new and strong consistency property, can be realized with high performance by making the durability layer aware of this model. Crossclient monotonicity cannot be realized efficiently without a consistency-aware layer: synchronous durability can enable it but is slow; it simply cannot be realized upon asynchronous durability. In this paper, we implement CAD and cross-client monotonic reads in leader-based replicated systems.</p><p>Cross-client monotonic reads guarantees that a read from a client will return a state that is at least as up-to-date as the state returned to a previous read from any client, irrespective of failures and across sessions. To realize this property efficiently, CAD shifts the point of durability from writes to reads: data is replicated and persisted before it is read. By delaying durability of writes, CAD achieves high performance; however, by making data durable before it is read, CAD enables monotonic reads across failures. CAD does not incur overheads on every read; for many workloads, data can be made durable in the background before applications read it. While enabling strong consistency, CAD does not guarantee complete freedom from data loss; a few recently written items that have not been read yet may be lost if failures arise. However, given that many widely used systems adopt asynchronous durability and thus settle for weaker consistency <ref type="bibr">[32,</ref><ref type="bibr">43,</ref><ref type="bibr">44]</ref>, CAD offers a path for these systems to realize stronger consistency without compromising on performance.</p><p>Existing linearizable systems do provide cross-client monotonic reads. However, to do so, in addition to using synchronous durability, most systems restrict reads to the leader <ref type="bibr">[23,</ref><ref type="bibr">34,</ref><ref type="bibr">38]</ref>. Such restriction limits read throughput and prevents clients from reading from nearby replicas, increasing latency. In contrast, we show how a storage system can realize this property while allowing reads at many replicas. Such a system can achieve low-latency reads from nearby replicas, making it particularly well-suited for geo-distributed settings. Further, such a system can be beneficial in edge-computing use cases, where a client may connect to different servers over the application lifetime (e.g., due to mobility <ref type="bibr">[41]</ref>), but still can receive monotonic reads across these sessions.</p><p>We implement CAD and cross-client monotonic reads in a system called ORCA by modifying ZooKeeper <ref type="bibr">[3]</ref>. ORCA applies many novel techniques to achieve high performance and strong guarantees. For example, a durability-check mechanism efficiently separates requests that read non-durable items majority of nodes (S 1 , S 2 , and S 3 ) have committed an item b, buffering it in memory; two nodes (S 4 and S 5 ) are operating slowly and so have not seen b. When a node in the majority (S 3 ) crashes and recovers, it loses b. S 3 then forms a majority with nodes that have not seen b yet and gets elected the leader &#8224; . The system has thus silently lost the committed item b and so a client that previously read a state containing items a and b may now notice an older state containing only a, exposing non-monotonic reads. The intact copies on S 1 and S 2 are also replaced by the new leader. Similar cases arise with fully asynchronous systems too as shown in Figure <ref type="figure">1</ref>(ii).</p><p>In essence, systems built upon asynchronous durability cannot realize strong consistency properties in the presence of failures. Such systems can serve a newer state before the failure but an older one after recovery, exposing non-monotonic reads. Only models weaker than linearizability such as causal consistency can be built atop asynchronous durability; such models offer monotonic reads only in the absence of failures and within a single client session. If the server to which the client is connected crashes and recovers, the client has to establish a new session in which it may see a state older than what it saw in its previous session <ref type="bibr">[30]</ref>.</p><p>Weakly consistent systems can expose non-monotonic states also because they usually allow reads at many nodes <ref type="bibr">[14]</ref>. For example, a client can reconnect to a different server after a disconnection, and may read an older state in the new session if a few updates have not been replicated to this server yet. For the same reason, two sessions to two different servers from a single application may receive non-monotonic states. While the above cases do not violate causal consistency by definition (because it is a different session), they lead to poor semantics for applications.</p><p>To summarize our discussion thus far, synchronous durability enables strong consistency but is prohibitively expensive. Asynchronous durability offers high performance, but only weak consistency can be built upon it. We next discuss how the seemingly conflicting goals of strong consistency and high performance can be realized together in a storage system by carefully designing its durability layer.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Strong, Efficient Consistency with CAD</head><p>Our goal in this paper is to design a durability primitive that enables strong consistency while delivering high performance.</p><p>To this end, we first observe that asynchronous durability can lose data arbitrarily upon failures, and so prevents the realization of both non-stale and monotonic reads together. While preventing staleness requires expensive synchronous durability upon every write, we note that monotonic reads across failures can be useful in many scenarios and can be realized efficiently. We design consistency-aware durability &#8224; While a node that has lost its data can be precluded from joining the cluster (like in Viewstamped Replication <ref type="bibr">[26]</ref>), such solutions affect availability and practical systems do not employ such a strategy.</p><p>or CAD, a new durability primitive that enables this strong property with high performance.</p><p>The main idea underlying CAD is to allow writes to be completed asynchronously but enforce durability upon reads: data is replicated and persisted before it is read by clients. By delaying the durability of writes, CAD achieves high performance. However, by ensuring that the data is durable before it is read, CAD enables monotonic reads even across failures. CAD does not always incur overheads when data is read. First, for many workloads, CAD can make the data durable in the background well before applications read it. Further, only the first read to non-durable data triggers synchronous replication and persistence; subsequent reads are fast. Thus, if clients do not read data immediately after writing (which is natural for many workloads), CAD can realize the high performance of asynchronous durability but enable stronger consistency. In the case where clients do read data immediately after writing, CAD incurs overheads but ensures strong consistency.</p><p>Upon CAD, we realize cross-client monotonic reads, a strong consistency property. This property guarantees that a read from a client will always return a state that is at least as up-to-date as the state returned to a previous read from any client, irrespective of server and client failures, and across sessions. Linearizability provides this property but not with high performance. Weaker consistency models built atop asynchronous durability cannot provide this property. Note that cross-client monotonicity is a stronger guarantee than the traditional monotonic reads that ensures monotonicity only within a session and in the absence of failures <ref type="bibr">[10,</ref><ref type="bibr">30,</ref><ref type="bibr">49]</ref>.</p><p>Cross-client monotonic reads can be useful in many scenarios. As a simple example, consider the view count of a video hosted by a service; such a counter should only increase monotonically. However, in a system that can lose data that has been read, clients can notice counter values that may seem to go backward. As another example, in a location-sharing service, it might be possible for a user to incorrectly notice that another user went backwards on the route, while in reality, the discrepancy is caused by the underlying storage system that served the updated location, lost it, and thus later reverted to an older one. A system that offers cross-client monotonic reads avoids such cases, providing better semantics.</p><p>To ensure cross-client monotonic reads, most existing linearizable systems restrict reads to the leader, affecting scalability and increasing latency. In contrast, a system that provides this property while allowing reads at multiple replicas offers attractive performance and consistency characteristics in many use cases. First, it distributes the load across replicas and enables clients to read from nearby replicas, offering low-latency reads in geo-distributed settings. Second, similar to linearizable systems, it provides monotonic reads, irrespective of failures, and across clients and sessions which can be useful for applications at the edge <ref type="bibr">[36]</ref>. Clients at the edge may often get disconnected and connect to different servers, but still can get monotonic reads across these sessions. guarantees that all updates at least up to b 2 are made durable before serving b. CAD makes the entire state durable instead of just the item because it aims to preserve the update order established by the leader (as done by the base system).</p><p>CAD considers the state to be durable when it can recover the data after any failures including cases where all replicas crash and recover and in all successive views of the cluster. Majority-based systems require at least a majority of nodes to form a new view (i.e., elect a leader) and provide service to clients. Thus, if CAD safely persists data on at least a majority of nodes, then at least one node in any majority even after failures will have all the data that has been made durable (i.e., that was read by the clients) and thus will survive into the new view. Therefore, CAD considers data to be durable when it is persisted on the disks of at least a majority of nodes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.3">Handling Reads: Durability Check</head><p>When a read request for an item i arrives at a node, the node can immediately serve i from its memory if all updates to i are already durable (e.g., Figure <ref type="figure">2</ref>, read of item a); otherwise, the node must take additional steps to make the data durable. As a result, the node first needs to be able to determine if all updates to i have been made durable or not.</p><p>A naive way to perform this check would be to maintain for each item how many nodes have persisted the item; if at least a majority of nodes have persisted an item, then the system can serve it. A shortcoming of this approach is that the followers must inform the leader the set of items they have persisted in each response, and the leader must update the counts for all items in the set on every acknowledgment.</p><p>CAD simplifies this procedure by exploiting the ordering of updates established by the leader. Such ordering is an attribute common to many majority-based systems; for example, the ZooKeeper leader stamps each update with a monotonically increasing epoch-counter pair before appending it to the log <ref type="bibr">[5]</ref>. In CAD, with every response, the followers send the leader only a single index called the persisted-index which is the epoch-counter of the last update they have written to disk. The leader also maintains only a single index called the durable-index which is the index up to which at least a majority of nodes have persisted; the leader calculates the durable-index by finding the highest persisted-index among at least a majority (including self).</p><p>When a read for an item i arrives at the leader, it compares the update-index of i (the epoch-counter of the latest update that modifies i) against the system's durable-index. If the durable-index is greater &#8225; than the update-index, then all updates to i are already durable and so the leader serves i immediately; otherwise, the leader takes additional steps (described next) to make the data durable. If the read arrives at a follower, it performs the same check (using the durable-index sent by the leader in the heartbeats). If the check passes, it &#8225;  serves the read; otherwise, it redirects the request to the leader which then makes the data durable.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.4">Making the Data Durable</head><p>If the durability check fails, CAD needs to make the state (up to the latest update to the item being read) synchronously durable before serving the read. The leader treats the read for which the check fails specially. First, the leader synchronously replicates all updates upto the update-index of the item being read if these updates have not yet been replicated. The leader also informs the followers that they must flush their logs to disk before responding to this request.</p><p>When the followers receive such a request, they synchronously append the updates and flush the log to disk and respond. During such a flush, all previous writes buffered are also written to disk, ensuring that the entire state up to the latest update to the item being read is durable. Fortunately, the periodic background flushes reduce the amount of data that needs to be written during such foreground flushes. The persisted-index reported by a node as a response to this request is at least as high as the update-index of the item. When the flush finishes on a majority, the durable-index will be updated, and thus the data item can be served. The fourth column of Figure <ref type="figure">2</ref> shows how this procedure works. As shown, the durability check fails when item b is read; the nodes thus flush all updates upto index 2 and so the durability-index advances; the item is then served.</p><p>As an optimization, ORCA also persists writes that are after the last update to the item being read. Consider the log [a, b, c] in Figure <ref type="figure">2</ref>; when a client reads b, the durability check fails. Now, although it is enough to persist entries up to b, CAD also flushes update c, obviating future synchronous flushes when c is read as shown in the last column of the figure.</p><p>To summarize, CAD makes data durable upon reads and so guarantees that state that has been read will never be lost even if servers crash and recover. We next discuss how upon this durability primitive we build cross-client monotonic reads.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.4">Cross-Client Monotonic Reads</head><p>If reads are restricted only to the leader, a design that many linearizable systems adopt, then cross-client monotonic reads is readily provided by CAD; no additional mechanisms are needed. Given that updates go only through the leader, the leader will have the latest data, which it will serve on reads (if necessary, making it durable before serving). Further, if the current leader fails, the new view will contain the state that was read. Thus, monotonic reads are ensured across failures.</p><p>However, restricting reads only to the leader limits read scalability and prevents clients from reading at nearby replicas. Most practical systems (e.g., MongoDB, Redis), for this reason, allow reads at many nodes <ref type="bibr">[31,</ref><ref type="bibr">33,</ref><ref type="bibr">45]</ref>. However, when allowing reads at the followers, CAD alone cannot ensure cross-client monotonic reads. Consider the scenario in Figure <ref type="figure">3</ref>. The leader S 1 has served versions a 1 and a 2 after</p><p>The size of the active set presents a tradeoff between scalability and latency. If many nodes are in the active set, reads can be served from them all, improving scalability; however, reads that access recently written non-durable data can incur more latency because data has to be replicated and persisted on many nodes. In contrast, if the active set contains a bare majority, then data can be made durable quickly, but reads can be served only by a majority. Deposed leaders. A subtle case that needs to be handled is when a leader is deposed by a new one, but the old leader does not know about it yet. The old leader may serve some old data that was updated and served by the other partition, causing clients to see non-monotonic states. ORCA solves this problem with the same lease-based mechanism described above. When followers do not hear from the current leader, they elect a new leader but do so after waiting for a certain timeout. By this time, the old leader realizes that it is not the leader anymore, steps down, and stops serving reads.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.5">Correctness</head><p>ORCA never returns non-monotonic states, i.e., a read from a client always returns at least the latest state that was previously read by any client. We now provide a proof sketch for how ORCA ensures correctness under all scenarios.</p><p>First, when the current leader is functional, if a non-durable item (whose update-index is L) is read, ORCA ensures that the state at least up to L is persisted on all the nodes in the active set before serving the read. Thus, reads performed at any node in the active set will return at least the latest state that was previously read (i.e., up to L). Followers not present in the active set may be lagging but reads are not allowed on them, preventing them from serving an older state. When a follower is added to the active set, ORCA ensures that the follower contains state at least up to L; thus any subsequent reads on the added follower will return at least the latest state that was previously read, ensuring correctness. When the leader removes a follower, ORCA ensures that the follower marks itself out before the leader returns any data by committing it on the new reduced set, which prevents the follower from returning any older state.</p><p>When the current leader fails, ORCA must ensure that latest state that was read by clients survives into the new view. We argue that this is ensured by how elections work in ORCA (and in many majority-based systems). Let us suppose that the latest read has seen state up to index L. When the leader fails and subsequently a new view is formed, the system must recover all entries at least up to L for correctness; if not, an older state may be returned in the new view. The followers, on a leader failure, become candidates and compete to become the next leader. A candidate must get votes from at least a majority (may include self) to become the leader. When requesting votes, a candidate specifies the index of the last entry in its log. A responding node compares the incoming index (P) against the index of the last entry in its own log (Q). If the node has more up-to-date data in its log than the candidate (i.e., Q &gt; P), then the node does not give its vote to the candidate. This is a property ensured by many majoritybased systems <ref type="bibr">[2,</ref><ref type="bibr">6,</ref><ref type="bibr">39]</ref> which ORCA preserves.</p><p>Because ORCA persists the data on all the nodes in the active set and given that the active set contains at least a majority of nodes, at least one node in any majority will contain state up to L on its disk. Thus, only a candidate that has state at least up to L can get votes from a majority and become the leader. In the new view, the nodes follow the new leader's state. Given that the leader is guaranteed to have state at least up to L, all data that have been served so far will survive into the new view, ensuring correctness.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.6">Implementation</head><p>We have built ORCA by modifying ZooKeeper (v3.4.12). We have two baselines. First, ZooKeeper with synchronous replication but asynchronous persistence (i.e., ZooKeeper with forceSync disabled). Second, ZooKeeper with asynchronous replication; we modified ZooKeeper to obtain this baseline.</p><p>In ZooKeeper, write operations either create new key-value pairs or update existing ones. As we discussed, ORCA follows the same code path of the baseline for these operations. In addition, ORCA replicates and persists updates constantly in the background. Read operations return the value for a given key. On a read, ORCA performs the durability check (by comparing the key's update-index against the system's durable-index) and enforces durability if required.</p><p>ORCA incurs little metadata overheads compared to unmodified ZooKeeper to perform the durability check. Specifically, ZooKeeper already maintains the last-updated index for every item (as part of the item itself <ref type="bibr">[9]</ref>) which ORCA reuses. Thus, ORCA needs to additionally maintain only the durable-index, which is 8 bytes in size. However, some systems may not maintain the update indexes; in such cases, CAD needs eight additional bytes for every item compared to the unmodified system, a small price to pay for the performance benefits.</p><p>Performing the durability check is simple in ZooKeeper because what item a request will read is explicitly specified in the request. However, doing this check in a system that supports range queries or queries such as "get all users at a particular location" may require a small additional step. The system would need to first tentatively execute the query and determine what all items will be returned; then, it would enforce durability if one or more items are not durable yet.</p><p>We modified the replication requests and responses as follows. The followers include the persisted-index in their response and the leader sends the followers the durable-index in the requests or heartbeats. These messages are also used to maintain the active-set lease. We set the durable-index as the maximum index that has been persisted and applied by all nodes in the active set. We set the follower mark-out timeout to the same value as the heartbeat interval (100 ms in our implementation). We set the removal timeout to 500 ms. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Evaluation</head><p>In our evaluation, we ask the following questions:</p><p>&#8226; How does CAD perform compared to synchronous and asynchronous durability? &#8226; How does ORCA perform compared to weakly consistent ZooKeeper and strongly consistent ZooKeeper? &#8226; Does ORCA ensure cross-client monotonic reads in the presence of failures? &#8226; Does ORCA provide better guarantees for applications?</p><p>We conduct a set of experiments to answer these questions. We run our performance experiments with five replicas. Each replica is a 20-core Intel Xeon CPU E5-2660 machine with 256 GB memory running Linux 4.4 and uses a 480-GB SSD to store data. The replicas are connected via a 10-Gbps network. We use six YCSB workloads <ref type="bibr">[15]</ref> that have different readwrite ratios and access patterns: W (write-only), A (w:50%, r:50%), B (w:5%, r:95%), C (read-only), D (read latest, w:5%, r:95%), F (read-modify-write:50%, r:50%). We do not run YCSB-E because ZooKeeper does not support range queries. Numbers reported are the average over five runs.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1">CAD Performance</head><p>We first evaluate the performance of the durability layer in isolation; we compare CAD against synchronous and asynchronous durability. With asynchronous durability and CAD, the system performs both replication and persistence asynchronously. With synchronous durability, the system replicates and persists writes (using fsync) on a majority in the critical path; it employs batching to improve performance.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1.1">Write-only Micro-benchmark</head><p>We first compare the performance for a write-only workload. Intuitively, CAD should outperform synchronous durability and match the performance of asynchronous durability for such a workload. Figure <ref type="figure">5</ref> shows the result: we plot the average latency seen by clients against the throughput obtained when varying the number of closed-loop clients from 1 to 100. We show two variants of synchronous durability: one with batching and the other without. We show the no-batch variant only to illustrate that it is too slow and we do not use this variant for comparison; throughout our evaluation, we compare only against the optimized synchronous-durability  variant that employs batching. We make the following three observations from the figure. First, synchronous durability with batching offers better throughput than the no-batch variant; however, even with aggressive batching across 100 clients, it cannot achieve the high throughput levels of CAD. Second, writes incur significantly lower latencies in CAD compared to synchronous durability; for instance, at about 25 Kops/s (the maximum throughput achieved by synchronous durability), CAD's latency is 7&#215; lower. Finally, CAD's throughput and latency characteristics are very similar to that of asynchronous durability.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1.2">YCSB Macro-benchmarks</head><p>We now compare the performance across four YCSB workloads that have a mix of reads and writes. A, B, and F have a zipfian access pattern (most operations access popular items); D has a latest access pattern (most reads are to recently modified data). We run this experiment with 10 clients. We restrict the reads only to the leader for all three systems as we are evaluating only the durability layers. Table <ref type="table">2</ref> shows the result.</p><p>Compared to synchronous durability with batching, CAD's performance is significantly better. CAD is about 1.6&#215; and 3&#215; faster than synchronous durability for read-heavy workloads (B and D) and write-heavy workloads (A and F), respectively.</p><p>CAD must ideally match the performance of asynchronous durability. First, performance of writes in CAD should be identical to asynchronous durability; making data durable on reads should not affect writes. Figure <ref type="figure">6</ref>(a) shows this aspect for YCSB-A; results are similar for other workloads too.</p><p>Second, most read operations in CAD must experience latencies similar to reads in asynchronous durability. However, reads that access non-durable items may trigger synchronous replication and persistence, causing a reduction in performance. This effect can be seen in the read latency distributions shown in Figure <ref type="figure">6</ref>(b) and 6(c). As shown, a fraction of reads (depending upon the workload) trigger synchronous durability and thus incur higher latencies. However, as shown in Table <ref type="table">2</ref>, for the variety of workloads in YCSB, this fraction is small. Therefore, the drop in performance for CAD compared to asynchronous durability is little (2% -8%).</p><p>A bad workload for CAD is one that predominantly reads recently written items. Even for such a workload, the percentage of reads that actually trigger synchronous durability is small due to prior reads that make state durable and periodic background flushes in CAD. For example, with YCSB-D,   although 90% of reads access recently written items, only 4.32% of these requests trigger synchronous replication and persistence; thus, CAD's overhead compared to asynchronous durability is little (only 8%). CAD performance summary. CAD is significantly faster than synchronous durability (that is optimized with batching) while matching the performance of asynchronous durability for many workloads. Even for workloads that mostly read recently modified items, CAD's overheads are small.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2">ORCA System Performance</head><p>We now evaluate the performance of ORCA against two versions of ZooKeeper: strong-ZK and weak-ZK. Strong-ZK is ZooKeeper with synchronous durability (with batching), and with reads restricted to the leader; strong-ZK provides linearizability and thus cross-client monotonic reads. Weak-ZK replicates and persists writes asynchronously, and allows reads at all replicas; weak-ZK does not ensure cross-client monotonic reads. ORCA uses the CAD durability layer and reads can be served by all replicas in the active set; we configure the active set to contain four replicas in our experiments.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2.1">Read-only Micro-benchmark</head><p>We first demonstrate the benefit of allowing reads at many replicas using a read-only benchmark. Figure <ref type="figure">7</ref>(a) plots the average latency against the read throughput for the three systems when varying the number of clients from 1 to 100. Strong-ZK restricts reads to the leader to provide strong guarantees, and so its throughput saturates after a point; with many concurrent clients, reads incur high latencies. Weak-ZK allows reads at many replicas and so can support many concurrent clients, leading to high throughput and low latency; however, the cost is weaker guarantees as we show soon ( &#167;5.3). In contrast, ORCA provides strong guarantees while allowing reads at many replicas and thus achieving high throughput and low latency. The throughput of weak-ZK and ORCA could scale beyond 100 clients, but we do not show that in the graph.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2.2">YCSB Macro-benchmarks</head><p>We now compare the performance of ORCA against weak-ZK and strong-ZK across different YCSB workloads with 10 clients. Figure <ref type="figure">7</ref>(b) shows the results. In Figure <ref type="figure">7</ref>(b)(i), weak-ZK and ORCA carry out both replication and persistence lazily; whereas, in 7(b)(ii), weak-ZK and ORCA replicate synchronously but persist to storage lazily, i.e., they issue fsync-s in the background. As shown in Figure <ref type="figure">7</ref>(b)(i), ORCA is notably faster than strong-ZK (3.04 -3.28&#215; for write-heavy workloads, and 1.75 -1.97&#215; for readheavy workloads). ORCA performs well due to two reasons. First, it avoids the cost of synchronous replication and persistence during writes. Second, it allows reads at many replicas, enabling better read throughput. ORCA also closely approximates the performance of weak-ZK: ORCA is only about 11% slower on an average. This reduction arises because reads that access non-durable items must persist data on all the nodes in the active set (in contrast to only a majority as done in CAD); further, reads at the followers that access non-durable data incur an additional round trip because they are redirected to the leader. Similar results and trends can be seen for the asynchronous-persistence baseline in Figure <ref type="figure">7</ref>  any previous read. Using the framework, we generated 500 random sequences similar to the one in Figure <ref type="figure">9</ref>. We subject weak-ZK, strong-ZK, and ORCA to the generated sequences. Table <ref type="table">3</ref>(a) shows results when weak-ZK and ORCA synchronously replicate but asynchronously persist. With weak-ZK, non-monotonic reads arise in 83% of sequences due to two reasons. First, read data is lost in many cases due to crash failures, exposing non-monotonic reads. Second, delayed followers obliviously serve old data after other nodes have served newer state. Strong-ZK, by using synchronous durability and restricting reads to the leader, avoids non-monotonic reads in all cases. Note that while synchronous durability can avoid non-monotonic reads caused due to data loss, it is not sufficient to guarantee cross-client monotonic reads. Specifically, as shown in the table, sync-ZK-all, a configuration that uses synchronous durability but allows reads at all nodes, does not prevent lagging followers from serving older data, exposing non-monotonic states. In contrast to weak-ZK, ORCA does not return non-monotonic states. In most cases, a read performed on the non-delayed nodes persists the data on the delayed follower too, returning up-to-date data from the delayed follower. In a few cases (about 13%), the leader removed the follower from the active set (because the follower is experiencing delays). In such cases, the delayed follower rejects the read (because it is not in the active set); however, retrying after a while returns the latest data because the leader adds the follower back to the active set. Similar results can be seen in Table <ref type="table">3</ref>(b) when weak-ZK and ORCA asynchronously replicate and persist writes.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.4">Application Case Studies</head><p>We now show how the guarantees provided by ORCA can be useful in two application scenarios. The first one is a locationsharing application in which an user updates their location (e.g., a &#8594; b &#8594; c) and another user tracks the location. To provide meaningful semantics, the storage system must ensure monotonic states for the reader; otherwise, the reader might incorrectly see that the user went backwards. While systems that provide session-level guarantees can ensure this property within a session, they cannot do so across sessions (e.g., when the reader closes the application and re-opens, or when the reader disconnects and reconnects). Cross-client monotonic reads, on the other hand, provides this guarantee irrespective of sessions and failures. We test this scenario by building a simple location-tracking application. A set of users update their locations on the storage system, while another set of users reads those locations. Clients may connect to different servers over the lifetime of the application. Table <ref type="table">4</ref> shows result. As shown, weak-ZK exposes inconsistent (non-monotonic) locations in 13% of reads and consistent but old (stale) locations in 39% of reads. In contrast to weak-ZK, ORCA prevents non-monotonic locations, providing better semantics. Further, it also reduces staleness because of prior reads that make state durable. As expected, strong-ZK never exposes non-monotonic or old locations.</p><p>The second application is similar to Retwis, an open-source Twitter clone <ref type="bibr">[46]</ref>. Users can either post tweets or read their timeline (i.e., read tweets from users they follow). If the timeline is not monotonic, then users may see some posts that may disappear later from the timeline, providing confusing semantics <ref type="bibr">[14]</ref>. Cross-client monotonic reads avoids this problem, providing stronger semantics for this application.</p><p>The workload in this application is read-dominated: most requests retrieve the timeline, while a few requests post new content. We thus use the following workload mix: 70% gettimeline and 30% posts, leading to a total of 95% reads and 5% writes for the storage system. Results are similar to the previous case study. Weak-ZK returns non-monotonic and stale timelines in 8% and 20% of get-timeline operations, respectively. ORCA completely avoids non-monotonic timelines and reduces staleness, providing better semantics for clients.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">Discussion</head><p>In this section, we discuss how CAD can be beneficial for many current systems and deployments, and how it can be implemented in other classes of systems (e.g., leaderless ones). Application usage. As we discussed, most widely used systems lean towards performance and thus adopt asynchronous durability. CAD's primary goal is to improve the guarantees of such systems. By using CAD, these systems and applications atop them can realize stronger semantics without forgoing the performance benefits of asynchrony. Further, little or no modifications in application code are needed to reap the benefits that CAD offers.</p><p>A few applications such as configuration stores <ref type="bibr">[19]</ref> cannot tolerate any data loss and so require immediate synchronous durability upon every write. While CAD may not be suitable for this use case, a storage system that implements CAD can support such applications. For example, in ORCA, applications can optionally request immediate durability by specifying a flag in the write request (of course, at the cost of performance). CAD for other classes of systems. While we apply CAD to leader-based systems in this paper, the idea also applies to other systems that establish no or only a causal order of updates. However, a few changes compared to our implementation for leader-based systems may be required. First, given that there is no single update order, the system may need to maintain metadata for each item denoting whether it is durable or not (instead of a single durable-index). Further, when a non-durable item x is read, instead of making the entire state durable, the system may make only updates to x or ones causally related to x durable. We leave such extension as an avenue for future work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="7">Related Work</head><p>Consistency models. Prior work has proposed an array of consistency models and studied their guarantees, availability, and performance <ref type="bibr">[10,</ref><ref type="bibr">19,</ref><ref type="bibr">27,</ref><ref type="bibr">29,</ref><ref type="bibr">30,</ref><ref type="bibr">[48]</ref><ref type="bibr">[49]</ref><ref type="bibr">[50]</ref>. Our work, in contrast, focuses on how consistency is affected by the underlying durability model. Lee et al., identify and describe the durability requirements to realize linearizability <ref type="bibr">[25]</ref>. In contrast, we explore how to design a durability primitive that enables strong consistency with high performance. Durability semantics. CAD's durability semantic has a similar flavor to that of a few local file systems. Xsyncfs <ref type="bibr">[37]</ref> delays writes to disk until the written data is externalized, realizing high performance while providing strong guarantees. Similarly, file-system developers have proposed the O_RSYNC flag <ref type="bibr">[22]</ref> that provides similar guarantees to CAD. Although not implemented by many kernels <ref type="bibr">[22]</ref>, when specified in open, this flag blocks read calls until the data being read has been persisted to the disk. BarrierFS' fbarrier <ref type="bibr">[52]</ref> and OptFS' osync <ref type="bibr">[13]</ref> provide delayed durability semantics similar to CAD; however, unlike CAD, these file systems do not guarantee that data read by applications will remain durable after crashes. Most of the prior work resolves the tension between durability and performance in a much simpler singlenode setting and within the file system. To the best of our knowledge, our work is the first to do so in replicated systems and in the presence of complex failures (e.g., partitions). Improving distributed system performance. Several approaches to improving the performance of replicated systems using speculation <ref type="bibr">[19,</ref><ref type="bibr">51]</ref>, exploiting commutativity <ref type="bibr">[35]</ref>, and network ordering <ref type="bibr">[40]</ref> have been proposed. However, these prior approaches do not focus on addressing the overheads of durability, an important concern in storage systems. ORCA avoids durability overheads by separating consistency from freshness: reads can be stale but never out-of-order. Lazy-Base <ref type="bibr">[14]</ref> applies a similar idea to analytical processing systems in which reads access only older versions that have been fully ingested and indexed. However, such an approach often returns staler results than a weakly consistent system. In con-trast, ORCA never returns staler data than a weakly consistent system; further, ORCA reduces staleness compared to weak systems by persisting data on many nodes upon reads (as shown by our experiments). SAUCR reduces durability overheads in the common case but compromises on availability for strong durability in rare situations (e.g., in the presence of many simultaneous failures) <ref type="bibr">[1]</ref>. ORCA makes the opposite tradeoff: it provides better availability but could lose a few recent updates upon failures. Cross-client monotonic reads. To the best of our knowledge, cross-client monotonic reads is provided only by linearizability <ref type="bibr">[25,</ref><ref type="bibr">38]</ref>. However, linearizable systems require synchronous durability and most prevent reads at the followers. ORCA offers this property without synchronous durability while allowing reads at many nodes. Gaios <ref type="bibr">[11]</ref> offers strong consistency while allowing reads from many replicas. Although Gaios distributes reads across replicas, requests are still bounced through the leader and thus incur an additional delay to reach the leader. The leader also requires one additional round trip to check if it is indeed the leader, increasing latency further. In contrast, ORCA allows clients to directly read from the nearest replica, enabling both load distribution and low latency. ORCA avoids the extra round trip (to verify leadership) by using leases. ORCA's use of leases to provide strong consistency is not new; for example, early work on cache consistency in distributed file systems has done so <ref type="bibr">[18]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="8">Conclusion</head><p>In this paper, we show how the underlying durability model of a distributed system has strong implications for its consistency and performance. We present consistency-aware durability (CAD), a new approach to durability that enables both strong consistency and high performance. We show how crossclient monotonic reads, a strong consistency guarantee can be realized efficiently upon CAD. While enabling stronger consistency, CAD may not be suitable for a few applications that cannot tolerate any data loss. However, it offers a new, useful middle ground for many systems that currently use asynchronous durability to realize stronger semantics without compromising on performance.</p></div></body>
		</text>
</TEI>
