<?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'>Hyperloop: group-based NIC-offloading to accelerate replicated transactions in multi-tenant storage systems</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>01/01/2018</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10095501</idno>
					<idno type="doi">10.1145/3230543.3230572</idno>
					<title level='j'>Proceeding SIGCOMM '18 Proceedings of the 2018 Conference of the ACM Special Interest Group on Data Communication</title>
<idno></idno>
<biblScope unit="volume"></biblScope>
<biblScope unit="issue"></biblScope>					

					<author>Daehyeok Kim</author><author>Srinivasan Seshan</author><author>Amirsaman Memaripour</author><author>Anirudh Badam</author><author>Yibo Zhu</author><author>Hongqiang Harry Liu</author><author>Jitu Padhye</author><author>Shachar Raindel</author><author>Steven Swanson</author><author>Vyas Sekar</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Storage systems in data centers are an important component of large-scale online services. They typically perform replicated transactional operations for high data availability and integrity. Today, however, such operations suffer from high tail latency even with recent kernel bypass and storage optimizations, and thus affect the predictability of end-to-end performance of these services. We observe that the root cause of the problem is the involvement of the CPU, a precious commodity in multi-tenant settings, in the critical path of replicated transactions. In this paper, we present HyperLoop, a new framework that removes CPU from the critical path of replicated transactions in storage systems by offloading them to commodity RDMA NICs, with non-volatile memory as the storage medium. To achieve this, we develop new and general NIC offloading primitives that can perform memory operations on all nodes in a replication group while guaranteeing ACID properties without CPU involvement. We demonstrate that popular storage applications can be easily optimized using our primitives. Our evaluation results with microbenchmarks and application benchmarks show that HyperLoop can reduce 99 th percentile latency ≈ 800× with close to 0% CPU consumption on replicas.]]></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>Distributed storage systems are an important building block for modern online services. To guarantee data availability and integrity, these systems keep multiple replicas of each data object on different servers <ref type="bibr">[3,</ref><ref type="bibr">4,</ref><ref type="bibr">8,</ref><ref type="bibr">9,</ref><ref type="bibr">17,</ref><ref type="bibr">18]</ref> and rely on replicated transactional operations to ensure that updates are consistently and atomically performed on all replicas.</p><p>Such replicated transactions can incur large and unpredictable latencies, and thus impact the overall performance of storage-intensive applications <ref type="bibr">[52,</ref><ref type="bibr">57,</ref><ref type="bibr">58,</ref><ref type="bibr">75,</ref><ref type="bibr">86,</ref><ref type="bibr">92]</ref>. Recognizing this problem, both networking and storage communities have proposed a number of solutions to reduce average and tail latencies of such systems.</p><p>Networking proposals include kernel bypass techniques, such as RDMA (Remote Direct Memory Access) <ref type="bibr">[64]</ref>, and userspace networking technologies <ref type="bibr">[26,</ref><ref type="bibr">90]</ref>. Similarly, there have been efforts to integrate non-volatile main memory (NVM) <ref type="bibr">[6,</ref><ref type="bibr">11]</ref>, and userspace solid state disks (SSDs) <ref type="bibr">[7,</ref><ref type="bibr">29,</ref><ref type="bibr">98]</ref> to bypass the OS storage stack to reduce latency.</p><p>While optimizations such as kernel bypass do improve the performance for standalone storage services and appliancelike systems where there is only a single service running in the entire cluster <ref type="bibr">[60,</ref><ref type="bibr">100,</ref><ref type="bibr">101]</ref>, they are unable to provide low and predictable latency for multi-tenant storage systems.</p><p>The problem is two fold. First, many of the proposed techniques for reducing average and tail latencies rely on using CPU for I/O polling <ref type="bibr">[7,</ref><ref type="bibr">26]</ref>. In a multi-tenant cloud setting, however, providers cannot afford to burn cores in this manner to be economically viable. Second, even without polling, the CPU is involved in too many steps in a replicated storage transaction. Take a write operation as an example: i) It needs CPU for logging, processing of log records, and truncation of the log to ensure that all the modifications listed in a transaction happen atomically; ii) CPU also runs a consistency protocol to ensure all the replicas reach identical states before sending an ACK to the client; iii) During transactions, CPU must be involved to lock all replicas for the isolation between different transactions for correctness; iv) Finally, CPU ensures that the data from the network stack reaches a durable storage medium before sending an ACK.</p><p>To guarantee these ACID properties, the whole transaction has to stop and wait for a CPU to finish its tasks at each of the four steps. Unfortunately, in multi-tenant storage systems, which co-locate 100s of database instances on a single server <ref type="bibr">[67,</ref><ref type="bibr">92]</ref> to improve utilization, the CPU is likely to incur frequent context switches and other scheduling issues.</p><p>Thus, we explore an alternative approach for predictable replicated transaction performance in a multi-tenant environment by completely removing the CPU from the critical path. In this paper, we present HyperLoop, a design that achieves this goal. Tasks that previously needed to run on CPU are entirely offloaded to commodity RDMA NICs, with Non-volatile Memory (NVM) as the storage medium, without the need for CPU polling. Thus, HyperLoop achieves predictable performance (up to 800&#215; reduction of 99 th percentile latency in microbenchmarks!) with nearly 0% CPU usage. Our insight is driven by the observation that replicated transactional operations are essentially a set of memory operations and thus are viable candidates for offloading to RDMA NICs, which can directly access or modify contents in NVM.</p><p>In designing HyperLoop, we introduce new and general group-based NIC offloading primitives for NVM access in contrast to conventional RDMA operations that only offload point-to-point communications via volatile memory. HyperLoop has a necessary mechanism for accelerating replicated transactions, which helps perform logically identical and semantically powerful memory operations on a group of servers' durable data without remote CPUs' involvement.</p><p>These group-based primitives are sufficient to offload operations that are conventionally performed by CPUs in stateof-the-art NVM and RDMA based replication systems. Such operations include consistent and atomic processing and truncating of log updates across all replicas, acquiring the same logical lock across all replicas, and durably flushing the volatile data across all replicas. HyperLoop can help offload these to the NIC. <ref type="foot">1</ref>Realizing these primitives, however, is not straightforward with existing systems. Our design entails two key technical innovations to this end. First, we repurpose a less-studied yet widely supported RDMA operation that lets a NIC wait for certain events before executing RDMA operations in a special queue. This enables us to pre-post RDMA operations which are triggered only when the transactional requirements are met. Second, we develop a remote RDMA operation posting scheme that allows a NIC to enqueue RDMA operations on other NICs in the network. This is realized by modifying the NIC driver and registering the driver metadata region itself to be RDMA-accessible (with safety checks) from other NICs. By combining these two techniques, an RDMA-capable NIC can precisely program a group of other NICs to perform replicated transactions.</p><p>Our approach is quite general as it only uses commodity RDMA NICs and as such applications can adopt our primitives with ease. For example, we modified RocksDB (an open source alternative to Google LevelDB) and MongoDB (an open source alternative to Azure CosmosDB and Amazon DynamoDB) to use HyperLoop with under 1000 lines of code. We evaluate the performance of these systems using microbenchmarks as well as the Yahoo Cloud Storage Benchmark (YCSB) workload. The results show that running MongoDB with HyperLoop decreases average latency of insert/update operations by 79% and reduces the gap between average and 99 th percentile by 81%, while CPU usage on backup nodes goes down from nearly 100% to almost 0%. Further, microbenchmarks show that HyperLoop-based group memory operations can be performed more than 50&#215; and 800&#215; faster than conventional RDMA-based operations in average and tail cases, respectively.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">BACKGROUND &amp; MOTIVATION</head><p>In this section, we briefly define the key operations of replicated storage systems. We also present benchmarks that highlight the high tail latency incurred by these systems in a multi-tenant setting, even with state-of-the-art optimizations such as kernel bypass.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.1">Storage Systems in Data Centers</head><p>Replicated storage systems maintain multiple copies of data to deal with failures. For instance, large-scale block stores <ref type="bibr">[20,</ref><ref type="bibr">22,</ref><ref type="bibr">36,</ref><ref type="bibr">53,</ref><ref type="bibr">63]</ref>, key-value stores <ref type="bibr">[23,</ref><ref type="bibr">43]</ref>, and databases <ref type="bibr">[19,</ref><ref type="bibr">21,</ref><ref type="bibr">24,</ref><ref type="bibr">41]</ref> replicate data to increase availability and avoid data loss in the presence of failures. Such systems use comprehensive protocols <ref type="bibr">[30,</ref><ref type="bibr">33,</ref><ref type="bibr">34]</ref> to ensure that every data update new set of RDMA primitives instead of end-to-end RDMAand NVM-based storage system <ref type="bibr">[59,</ref><ref type="bibr">71]</ref>.</p><p>These primitives should offload the operations most commonly required to ensure ACID properties. For example, many storage systems, such as MongoDB <ref type="bibr">[32]</ref>, perform the following steps for a transaction 1) replicate operation logs to all replicas and make sure every replica is ready to commit, 2) acquire a lock on every replica, 3) execute the transactions in operation logs, 4) flush all caches (if applicable) to make the transactions durable, and 5) release the lock.</p><p>To support this representative process, HyperLoop provides new primitives that handle the steps separately. In &#287;4.2, we will explain the design of these primitives. End-host only implementation based on commodity hardware: HyperLoop is designed to be widely adoptable by commodity data centers with little effort. Thus, HyperLoop should not rely on any additional special hardware or switch configurations. In addition, being implemented only on endhosts, HyperLoop can avoid putting state on switches, therefore is easy to manage and can scale well.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2">HyperLoop Architecture</head><p>HyperLoop offloads all the tasks on the replicas to their NICs. To achieve this, we must turn those tasks into a form that can be processed by just the NICs, without the help of CPUs. Our insight is that replication, log processing, and global locking are essentially a set of memory operations and network commands, and therefore are viable candidates for offload from CPUs to NICs that can access memory (e.g., RDMA). Since NVM offers the convenience of durable memory, it is a natural fit. However, as we show later, care must be taken when bridging between volatile caches of RNICs and the durable memory region.</p><p>Figure <ref type="figure">3</ref> illustrates the architecture of HyperLoop. A typical replication group in storage systems consists of multiple replicas with only the first one interfacing with clients. HyperLoop can support any number of replicas depending on the application's requirement. There are two software layers: HyperLoop network primitive library and storage applications (e.g., MongoDB) that adopt the primitive library. Note that HyperLoop itself is not a full end-to-end replicated storage system. Its main goal is to provide key building blocks to build replicated transaction systems or make existing systems more efficient.</p><p>The network primitive library implements four groupbased primitives, gFLUSH, gWRITE, gCAS, and gMEMCPY. They address the missing memory operations needed by general storage systems as explained in &#287;3.1. Application developers can leverage these primitives to implement or modify their replication and transaction processing modules. As described in &#287;5, we have adapted a few applications to use the HyperLoop library. Only small modifications were needed based on their original code.</p><p>HyperLoop works in a chain-based manner. When the storage application running on the client (also known as transaction coordinator) writes (i.e., add or update) data, it updates a write-ahead log and then performs the transaction on the group. This is done by calling corresponding primitive exposed by HyperLoop primitive library. RNICs on replicas receive the operation from the client or previous replica, execute the operation and forward the operation to the next replica in the chain. Note that there is no CPU involved in the critical path of executing this operation on replicas. The NIC on the last replica sends back an ACK to the head of the chain &#347; the client. To keep the design simple HyperLoop group failures are detected and repaired in an application specific manner much like traditional network connections in storage systems (see &#287;5).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">HYPERLOOP DESIGN</head><p>In this section, we describe the design of HyperLoop groupbased network primitives. We start by explaining the key techniques that make HyperLoop possible.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1">Key Ideas</head><p>The challenge is how to control NICs without CPUs: RDMA and NVM can turn storage operations into memory operations that bypass CPU. However, in traditional RDMA programming, when and what memory operations to be performed is controlled by CPU. This is because the basic RDMA operations by themselves are only designed for point-to-point communication. Therefore, CPUs on every end-host must be involved on the critical path.</p><p>We elaborate this using a simple example, where a storage system needs to replicate data from the client to two or more replica nodes using chain replication <ref type="bibr">[46,</ref><ref type="bibr">47,</ref><ref type="bibr">53,</ref><ref type="bibr">81,</ref><ref type="bibr">94]</ref>. Even though the client can write data to a memory region of the first (primary) replica without involving the replica's CPU using RDMA WRITE, the first replica still has to forward the data to the second replica.</p><p>Thus, on the first replica, a traditional RDMA implementation will let CPU pre-post a receive request and keep polling the completion queue (on the critical path). The client must use SEND or WRITE_WITH_IMM operations, which triggers the receive completion event on the first replica. Then the replica performs the operations in the request meant for it and posts a send request of the operations meant for the rest of the chain to the next replica, right after the receive completion event (on the critical path again). The CPU is needed not only for executing the memory operations in these requests but also for posting it to the next replica.</p><p>This means that the NIC on the replica does not know when and what it should forward to the next node until its CPU gets the receive completion event and generates a corresponding send request. This causes the high tail latency and the high CPU utilization problems shown in &#287;2.2.</p><p>The general approach of HyperLoop is to design a set of group-based memory operation primitives that completely remove replica's CPUs from the critical path. This means that NICs on replicas should detect the receive events by themselves, process them and automatically trigger sending them to the next replica. In addition, the forwarded SEND operation must be based on the memory address and length of data received from upstream. Leveraging WAIT for auto-triggering RDMA operations: We find that commodity RNICs support an operation which enables event-based work request triggering, called RDMA WAIT, between two communication channels (or queue pair (QP)) within a host. <ref type="foot">2</ref> In a nutshell, WAIT enables RNICs to wait for a completion of one or more work requests (WRs) posted on one WR queue, and trigger other WRs that are pre-posted on another WR queue, without CPU involvement. Although this feature has not been widely studied or used for general applications, we find it promising for determining when a remote NIC can proceed.</p><p>We leverage this feature to enable forwarding operations in HyperLoop. Figure <ref type="figure">4</ref> illustrates the data path for forwarding operations. The basic idea is that every replica pre-posts RECV WR on the WR queue of the QP connected to the previous node, and also WAIT and a two-sided operation (e.g., SEND or WRITE_WITH_IMM) WR to the WR queue of the QP connected to the next node in the group. Upon completion of a RECV WR (Step 1 and 2), the WAIT WR is triggered and it activates operation WR, which was posted right next to it (Step 3 and 4). Thus, NICs on replicas forward the memory operations received from the previous node to the next node in the group, without involving the CPU. Remote work request manipulation for replicating arbitrary data: While WAIT addresses the &#322;when&#382; problem, NICs also need to know what to do, whenever WAIT triggers. In common RDMA programs, when posting an RDMA WRITE or SEND work request, one must specify a memory descriptor that contains a local source address, size of data to be written, and a remote destination address (in case of WRITE). Since WAIT can only trigger work request posted in advance, NICs can only forward a fixed size buffer of data at a pre-defined memory location, which we call fixed replication. This is clearly insufficient for general storage systems that require flexibility in memory management.</p><p>To address this limitation, we propose a solution called remote work request manipulation, which enables the client to manipulate the work requests pre-posted on the replicas' work queues. Our key insight is that we can register replicas' work queues as RDMA-writable memory regions and allow the client to modify memory descriptors (stored in a work queue entry (WQE) data structure) of pre-posted work requests on replicas. Along with the operation forwarding feature described above, the client can perform arbitrary memory operations targeted to RDMA-registered memory on a group of replicas without involving replicas' CPUs.</p><p>Figure <ref type="figure">5</ref> illustrates the workflow. Since the work requests are at a known memory location on replicas' memory region, NICs on replicas can post RECV requests that point the received metadata to update the memory descriptor in existing work requests. The metadata contains memory descriptors for every replica and is pre-calculated by the client and replicated to all replicas using fixed replication. Metadata can also contain additional information depending on different types of memory operation. Note that separate metadata memory regions are allocated for each primitive and each region takes &#10216;size of memory descriptor&#10217; &#215; &#10216;group size&#10217; &#215; &#10216;number of metadata entries&#10217;. The sizes of memory descriptor are different by primitives and in our implementation, the maximum size is 32 bytes, which is the case for gCAS.</p><p>The client first builds metadata for each group memory operation. Then the client posts a WRITE and a SEND work request, which are used to replicate data to the replicas' memory region and send the metadata, respectively. Since the SEND request is a two-sided operation, it consumes a RECV work request posted by the replica. The RECV request will trigger the WAIT request and updates metadata region, the memory descriptors of WRITE and SEND work request, and activate them (i.e., grant the ownership to the NIC). The activated WRITE and SEND work request will do the same procedure for the next node. While this mechanism uses additional work requests for sending metadata of operations and waiting a completion of a RECV work request, it does not incur much network overhead since the size of metadata is small (at most 32 bytes &#215; &#10216;group size&#10217;), and a WAIT does not produce any network traffic.</p><p>Note that with current RDMA NIC driver implementations, when an application posts a work request, a NIC will immediately get the ownership of that request and because of this, the memory descriptor cannot be modified later. However, in HyperLoop, the client should be able to manipulate the memory descriptor of pre-posted work requests. To enable this, we modify the userspace NIC driver library (e.g., libmlx4 for Mellanox NICs) to make it not yield ownership to the NIC when the work request is posted. Instead, with our modified driver, the client will grant the ownership of the work request to NICs after it updates the memory descriptor of pre-posted work requests with our primitive. Integration with other RDMA operations to support ACID: To support the demanding features by storage systems, like durable WRITE, transaction execution and group locking, we further build on the two ideas above.</p><p>Specifically, we further leverage the WAIT mechanism to let the last replica to send an ACK to the client as a group operation ACK. We use a 0-byte READ immediately following each WRITE to flush the data in NIC cache into memory or NVM, so that each ACK means the operation finishes and becomes durable. For two-phase transaction execution, after logs are replicated, we let RNICs perform &#322;local RDMA&#382; to move data from the log region to the actual data region. For locking, we leverage the RDMA compare-and-swap (CAS) atomic operation.</p><p>In traditional systems, all these tasks can only be done on a single host with the help of CPU. However, in HyperLoop, we turn all these into group-based primitives and removes replicas' CPUs from the critical path. Whenever the client of a replication group performs memory operations (e.g., replication, transaction execution, or locking) in its own memory region, RNICs (not CPUs!) on replicas also perform the same operations against their memory regions. The result is significantly better tail latency and lower CPU consumption than traditional RDMA implementations.</p><p>Based on these techniques, we develop four group-based primitives summarized in Table <ref type="table">1</ref>. We describe each of them in detail next.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Detailed Primitives Design</head><p>Group write (gWRITE): In a replicated storage, when the client updates the transaction log, it needs to replicate the updated log to all replicas in a replication group. We abstract this process into the group memory write (gWRITE) primitive, which enables remote NICs to write any data to the specified memory location of their host memory region. gWRITE allows the caller (e.g., client) to write a data to memory regions of a group of remote nodes without involving their CPUs. The primitive takes a group ID, a memory offset of data which will be written to remote nodes' memory regions, and a size of data as input arguments. For the given offset and size, it builds metadata and initializes the command and follows the data path shown in Figure <ref type="figure">5</ref>. gWRITE is used to implement replicated transaction log management described in Section 5. Group compare-and-swap (gCAS): To ensure data integrity during concurrent read-write, replicated storage systems often use some locking mechanism, which also involves the replicas' CPUs. We provide the group compare-and-swap (gCAS) primitive to offload such lock management schemes. This enables remote NICs to perform compare-and-swap against a specified memory location on their host memory region and update the value of the location based on the result of comparison. The client can acquire a logical group lock via this primitive without involving the replicas' CPUs.</p><p>gCAS extends the original RDMA single host compareand-swap (CAS) operation to a group of nodes. It takes a group ID, an offset of memory location whose value to be compared, an old and new value, an execute map, and a result map as input arguments. The execute and result map are additional parameters different from the original CAS. It has a field for each node in the group. The client can specify whether each remote node has to execute the CAS operation on the execute bitmap (i.e., marking the corresponding field). This capability of selective execution is necessary especially for a client which needs to undo a gCAS operation when the operation failed to be executed on some remote nodes due to mismatch between the expected and actual value of the target memory location. To undo the operation, the client issues another gCAS operation by marking a set of execute fields corresponding to the nodes on which the previous CAS operation was successfully executed and swapping the old and new values. Each replica updates the result of locally performed CAS to the result map and the client will receive the final result map as an ACK of performing gCAS.</p><p>Figure <ref type="figure">6</ref> shows how gCAS works. On each replica, HyperLoop creates an additional QP for performing CAS operation locally. When a RECV work request is consumed by the SEND work request initiated by the previous node, it updates the memory descriptor of CAS and SEND work requests.</p><p>It is important to note that depending on a value in the execute map, each replica has to determine whether it performs CAS without involving its CPU. We found that when granting an ownership of work request to the NIC, we can change the type of pre-posted work request. Using this observation, the On each node, if the corresponding bit in the execute map is set, (1) compare the value of data at offset with old_value.</p><p>(2) if they are the same, replace the value with new_value.</p><p>(3) update the corresponding result field with the original value of offset.</p><p>gMEMCPY(gid, src_offset, dest_offset, size)</p><p>Copying the data size of size from src_offset to dest_offset for all nodes. caller makes the CAS be NOP operation if the corresponding remote node is chosen not to perform the CAS operation.</p><p>If the replica performs CAS, it will update the corresponding field in the result map. The completion of CAS work request triggers the WAIT and SEND requests for the next node. If the replica is the last one in a group, it will forward the result map to the client as an ACK using WRITE_WITH_IMM. gCAS is used to implement a group locking scheme in storage systems, as described in &#287;5. Group memory copy (gMEMCPY): In many replicated storage systems, replica CPUs execute (commit) a transaction by copying the data corresponding to the transaction from a log region to a persistent data region. We abstract this process into the remote memory copy (gMEMCPY) primitive, which lets remote NICs perform a memory copy on their host memory for given parameters, i.e., data source address, destination address, and size.</p><p>When the client executes transactions via this primitive, on all replicas, the NICs will copy the data from the log region to the persistent data region without involving the CPUs. gMEMCPY takes a group ID, a memory offset of source region and destination region, and a size of data being copied. When this primitive is called, the NICs on replicas perform memory copy for given source and destination offset against their host memory without involving their CPUs.</p><p>Figure <ref type="figure">7</ref> shows how gMEMCPY works. Similar to the datapath of gCAS primitive, HyperLoop creates an additional QP for performing memory copy operation locally on each replica. Upon receiving the command from the previous node, the receive work request updates the memory descriptors of write and send work requests and triggers the wait request. Then the NIC performs local memory copy with the write work request. When the local memory copy is successfully completed, the NIC will trigger the wait and forwards the operation to the next node using SEND. If the next node is the client, it will send an ACK using WRITE_WITH_IMM. gMEMCPY is used to implement remote log processing described in &#287;5. Group RDMA flush (gFLUSH): To support the durability of transactions, data written with RDMA writes should be durable even in the case of system failure (e.g., power outage). However, the current RDMA protocol implemented on NICs does not guarantee the durability. The destination NIC sends an ACK in response to RDMA WRITE as soon as the data is stored in the NIC's volatile cache. This means that the data can be lost on power outage before the data is flushed into NVM. Thus, we need a new RDMA FLUSH primitive that supports the durability at the &#322;NIC-level&#382;.</p><p>To address this, we design Non-volatile RDMA FLUSH (gFLUSH) primitive which enables durable RDMA WRITE based on the existing RDMA operations. We leverage a feature supported by the NIC firmware that flushes a memory region in the cache when it becomes dirty. In our implementation, when an RDMA FLUSH is issued, the NIC immediately (without for waiting for an ACK) issues a 0byte RDMA READ to the same address. Then the destination's NIC flushes the cache for the READ and the source's NIC gives the application ACK after the 0-byte READ is acknowledged. This will ensure that each RDMA FLUSH will flush volatile caches to host memory hierarchy which is non-volatile with battery support <ref type="bibr">[73]</ref>. Similar to gWRITE, gFLUSH operations are also propagated down the chain for durability across the replicas.</p><p>There is an important distinction between gFLUSH and other primitives. gFLUSH can either be issued by itself or as an interleaved operation with gWRITE, gCAS or gMEMCPY. For instance, an interleaved gWRITE and gFLUSH on a replica would first flush the cache and only then forward the operations down the chain. This helps ensure that durable updates are propagated in the order needed by the chain or between the primary and backups in other protocols.</p><p>To the best of our knowledge, HyperLoop is the first system to describe the design and implementation of an RDMA NIC that can guarantee durability with NVM. Existing systems <ref type="bibr">[59,</ref><ref type="bibr">72]</ref> assume this ability but do not provide details of the design and implementation. Summary: We implement the primitives with 3,417 lines of C library. We also modify 58 lines of code in libmlx4 and libibverbs<ref type="foot">foot_2</ref> to implement gFLUSH and remote work request manipulation described in &#287;3. In the next section, we will describe a couple of case study storage systems whose performance can be improved by using HyperLoop.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">HYPERLOOP CASE STUDIES</head><p>HyperLoop helps NVM-and RDMA-based replicated databases to offload transactions to NICs. Based on HyperLoop primitives, different consistency models required by applications can be implemented as we will show in this section and discuss in &#287;7. To demonstrate the benefits of HyperLoop, we modify and optimize two widely used databases to an NVM-and RDMA-based chain replication using state-ofthe-art CPU-polled kernel bypass approach. We then offload the work done by the CPUs to the RDMA NICs by using HyperLoop. We choose RocksDB (open source alternative to Google's LevelDB), and MongoDB (open source alternative to Azure DocumentDB and AWS DynamoDB) because these databases have in-memory (RAMCloud <ref type="bibr">[85]</ref> like) implementations for volatile DRAM. Such implementations makes it easier to adapt them to NVM.</p><p>For such systems, requirements for maintaining a database typically translate to initializing NVM to contain a database and a write-ahead log, appending transactions to the log, processing the log and applying the transactions to the database, and obtaining locks to facilitate concurrent accesses to the database. Database Initialization: The Initialize function uses values specified in a configuration object to set up HyperLoop and create required connections between the replica and it's upstream and downstream replicas in the chain. Additionally, it creates/opens a handle to the NVM for the replica. This NVM area contains space enough to hold a write-ahead log as well as the database as defined in the configuration object. Log Replication: Each log record is a redo-log and structured as a list of modifications to the database <ref type="bibr">[83]</ref>. Each entry in the list contains a 3-tuple of (data, len, offset) representing that data of length len is to be copied at offset in the database. Every log record sent by a client is appended to the replicas' write-ahead logs in the chain by calling Append(log record), which is implemented using gWRITE and gFLUSH operations.</p><p>A client in our case study is a single multi-threaded process that waits for requests from applications and issues them into the chain concurrently. Multiple clients can be supported in the future using shared receive queues on the first replica in the chain. Log Processing: The remote log processing interface enables the client to copy data from the write-ahead log of replicas to their database regions without involving replica CPUs. For each log record and starting from the head of the write-ahead log, ExecuteAndAdvance processes its entries one by one. To process each entry, it issues a gMEMCPY to copy len bytes of data from data to offset on all replicas followed by a gFLUSH to ensure durability. Once all operations for a log record are processed, ExecuteAndAdvance updates the head of the write-ahead log using a gWRITE and gFLUSH.</p><p>Locking and Isolation: ExecuteAndAdvance allows updating the application data on replicas without involving replica CPUs. However, if clients are allowed to read from all replica nodes, they might observe inconsistent updates since ExecuteAndAdvance does not offer isolation. To address this issue, we offer group locking which is a single writer multiple reader locking mechanism. The client calls wrLock and wrUnlock to acquire and release exclusive write locks so that other transactions working on the same data are blocked.</p><p>HyperLoop allows lock-free one-sided reads from exactly one replica (head or tail of the chain) similar to existing systems that use integrity checks to detect incorrect or inconsistent values. However, we also implement read locks for systems that need them and note that HyperLoop design does not hinder systems from performing lock-free one-sided reads when it is possible to detect inconsistent reads and reject their values (e.g., FaRM <ref type="bibr">[60]</ref>). However, such systems can have low read throughput since only replica can serve the reads. In HyperLoop, we additionally provide read locks that work concurrently with the write locks to help all replicas simultaneously serve consistent reads for higher read throughput. Unlike write locks, read locks are not group based and only the replica being read from needs to participate in the read lock.</p><p>We use these APIs to modify two existing popular transactional storage systems (RocksDB <ref type="bibr">[39]</ref> and MongoDB <ref type="bibr">[32]</ref>) to show the efficacy of HyperLoop.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1">RocksDB</head><p>In this case study, we show how all the critical path operations in a write transaction can be offloaded to the NICs of replicas. This helps the system require the CPU only for coarse-grained off-the-critical path operations. Note that even these operations can be offloaded to the NIC, which we show in the next section.</p><p>RocksDB is an persistent key-value store library that can be integrated into application logic. It serves all requests using an in-memory data structure and uses a durable writeahead log to provide persistence. It periodically dumps the in-memory data to persistent storage and truncates the writeahead log. We replace the persistent storage in RocksDB with NVM. Further, we modify the interface between RocksDB's write-ahead log and NVM to use HyperLoop APIs instead of native NVM APIs. We modify/add only 120 lines of code.</p><p>Our version of RocksDB uses Append to replicate log records to replicas' NVM instead of using the native unreplicated append implementation. Replicas need to wake up periodically off the critical path to bring the in-memory snapshot in sync with NVM. Only one replica in the chain updates its in-memory copy of the data structure in the critical path. Therefore, reads from other replicas in our RocksDB implementation are eventually consistent <ref type="bibr">[94]</ref>. Thus, HyperLoop helps us convert an unreplicated system into a replicated one with accelerated transactions with only a few modifications. Section 6.2 shows the performance of our replicated RocksDB. RocksDB Recovery: Our recovery protocol for RocksDB is fairly straightforward. A new member in the chain copies the log and the database from either downstream or an upstream node; writes are paused for a short duration of catch-up phase. Only then does it formally join the chain. While this reduces write availability, we note that the focus of this paper is not to optimize the control path but rather to facilitate developers to build faster data paths. Complementary efforts in chain replication research have outlined various ways to speed up recovery.</p><p>Our primitives are low-level enough not to interfere with the recovery protocols that deal with temporary and permanent replica failures. Such a design is crucial for ensuring that the control path of replication protocols remains unchanged while only the data path is accelerated with the new primitives. Therefore, in the absence of failures, HyperLoop accelerates the transactions and as soon as a failure is detected, the recovery protocol takes over to bring back a stable data path as soon as possible. A configurable number of consecutive missing heartbeats is considered a data path failure <ref type="bibr">[45]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2">MongoDB</head><p>MongoDB is a NoSQL database server (i.e., document store), which offers both in-memory and persistent storage. It also provides replication by copying operation logs to replicas and asynchronously executing them against the replica version of the application data <ref type="bibr">[38]</ref>. Here, we use MongoDB's memory storage engine, which accesses persistent data through issuing loads/stores against memory-mapped files <ref type="bibr">[31]</ref> &#347; a model conducive for NVM and RDMA. We split the MongoDB code base into a front end and a back end. The front end is integrated with the client while the backend is HyperLoop-based replicas with NVM.</p><p>We achieve this with modifying only 866 lines of code. We use Append to replicate MongoDB's write-ahead log (i.e., journal) entries to replicas. Then, we execute transactions on replicas using ExecuteAndAdvance and the replicated writeahead log data. Additionally, to allow clients to read from replicas, we surround each ExecuteAndAdvance on the primary with wrLock and wrUnlock. Additional replicas only wake up to serve read requests when the chain is overloaded, when they must acquire and release a shared lock using rdLock and rdUnlock. Such an implementation completely offloads both critical and off-the-critical path operations for write transactions to the NIC while providing strong consistency across the replicas. We note that there are techniques (e.g., FaRM <ref type="bibr">[60]</ref>) to perform lock free one-sided reads that can be performed in HyperLoop as well if reads are restricted only to one replica. The advantage of HyperLoop is that it reduces the cost of keeping replicas strongly consistent and therefore, reads can be served from more than one replica to meet demand. MongoDB Recovery: The goal of our recovery protocol here was to bring the chain to a state where vanilla Mon-goDB recovery can take over. To achieve this, whenever the membership changes (heartbeat is lost), the entire chain flushes the log of all valid entries, rejects invalid entries, block reads temporarily and hand-off control to MongoDB recovery protocol which helps the new empty replica catch up and join a newly established HyperLoop data path. Rather than focusing on control path optimizations that are out of the scope of this paper, we focus on correctness and feasibility of adopting the accelerated data path of HyperLoop.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6">EVALUATION</head><p>In this section, we evaluate HyperLoop by answering the following questions: 1. How do HyperLoop primitives help improve the performance of group memory access (&#287;6.1)? 2. How does HyperLoop help improve the performance of real-world storage systems (&#287;6.2)?</p><p>Testbed setup: Our experimental testbed consists of 20 machines each equipped with two 8-core Xeon E5-2650v2 CPUs, 64 GB DRAM, and a Mellanox ConnectX-3 56 Gbps RDMA-capable NIC. The operating system running on the machines is Ubuntu Linux 14.04 with kernel version 3.13.0-137-generic. In our evaluation, we assume storage nodes are equipped with battery-backed DRAM <ref type="bibr">[60]</ref> which is a form of NVM available today. We emulate battery-backed DRAM by mounting a tmpfs file system to DRAM and run applications on it. We expect to observe similar benefits, i.e., no CPU overhead on replicas while exhausting the bandwidth of the network and/or NVM, when replacing battery-backed DRAM with emerging technologies such as 3D XPoint <ref type="bibr">[6]</ref>.</p><p>Baseline RDMA implementation: To evaluate the performance benefit of offloading the primitives to the NIC, we develop a na&#239;ve version of primitives using RDMA operations as a comparison point for HyperLoop. It can perform the same set of operations (i.e., gWRITE, gMEMCPY, gCAS) as HyperLoop and provides the same APIs, but involves backup CPUs to handle receiving, parsing, and forwarding RDMA messages in contrast to HyperLoop. In the rest of this section, we call this implementation Na&#239;ve-RDMA.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.1">Microbenchmark</head><p>We evaluate the performance of HyperLoop primitives in terms of latency, throughput and CPU consumption compared to Na&#239;ve-RDMA. We also evaluate the scalability of HyperLoop under different replication group sizes. Benchmark tools: We build custom latency and throughput measurement tools for the microbenchmark. Our latency benchmark generates 10,000 operations for each primitive with customized message sizes and measures the completion time of each operation. The throughput benchmark for gWRITE writes 1GB of data in total with customized message sizes to backup nodes and we measure the total transmission time to calculate the throughput. Also, we emulate background workloads by introducing CPU-intensive tasks using stress-ng <ref type="bibr">[42]</ref> in the testbed for HyperLoop and observe the impacts on latency and throughput. The Na&#239;ve-RDMA however uses a pinned core for best case performance. HyperLoop significantly reduces both average and tail latency compared to Na&#239;ve-RDMA: Figure <ref type="figure">8</ref> shows the average and tail latency of gWRITE and gMEMCPY primitives with different message sizes, fixing replication group size (number of member nodes) to 3. For both of gWRITE and gMEMCPY, Na&#239;ve-RDMA shows much higher 99 th percentile latency than HyperLoop. Particularly, for gWRITE, we can see that with HyperLoop, 99 th percentile latency can be reduced by up to 801.8&#215; with HyperLoop. gMEMCPY shows a similar result; HyperLoop reduces the 99 th percentile latency by up to 848&#215; compared to Na&#239;ve-RDMA. Table 2 shows the latency statistics of gCAS, in which HyperLoop shortens the average latency by 53.9&#215; and 95 th and 99 th latencies by 302.2&#215; and 849&#215;, respectively. HyperLoop achieves high throughput with almost zero CPU usage: Figure <ref type="figure">9</ref> presents the operation throughput and CPU utilization under different message sizes, fixing replication group size to 3. While HyperLoop provides a similar throughput compared to Na&#239;ve-RDMA, almost no CPUs are   consumed in the critical path of operations in contrast to Na&#239;ve-RDMA which utilizes a whole CPU core. This is because CPUs are involved in polling NICs, receiving, parsing and forwarding messages in Na&#239;ve-RDMA while HyperLoop offloads all these processes to the NICs.</p><p>HyperLoop is scalable with increasing group size: We evaluate the latency with different replication group sizes. The latency is measured from a client that sends a ping into the chain. Figure <ref type="figure">10</ref> illustrates the 99 th percentile latency of gWRITE when group size is 3, 5, and 7. As shown previously, Na&#239;ve-RDMA incurs much higher tail latency in all group sizes. With HyperLoop, there is no significant performance degradation as the group size increases (Fig. <ref type="figure">10(a</ref>)), while with Na&#239;ve-RDMA, 99 th percentile latency increases by up to 2.97&#215; (Fig. <ref type="figure">10(b)</ref>). We also observed that HyperLoop shows a smaller variance of average latency between the group sizes compared to Na&#239;ve-RDMA. This means that by offloading operations to NICs, HyperLoop can significantly reduce the latency and make it predictable regardless of the group size.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.2">Performance in Real Applications</head><p>We measure the latency and CPU utilization of two real applications (RocksDB and MongoDB), with YCSB <ref type="bibr">[56]</ref>, an industry standard storage benchmark. In these experiments, we use the 3 physical machines and set the replication group size to 3. Table <ref type="table">3</ref> shows properties of each workload within YCSB. For MongoDB and RocksDB experiments, we initialize  We use traces from YCSB (workload A) to compare the three versions in average and tail latencies of update operations. As shown in Figure <ref type="figure">11</ref>, HyperLoop offers significantly lower tail latency in contrast to Na&#239;ve-Event (5.7&#215; lower) and Na&#239;ve-Polling (24.2&#215; lower). Furthermore, HyperLoop reduces the CPU overhead on backup nodes since it does not involve backup CPUs in the critical path of replication. In contrast, Na&#239;ve-Polling version burns two cores on backup nodes to poll incoming messages. Interestingly, however, Na&#239;ve-Event has lower average and tail latency compared to Na&#239;ve-Polling as multiple tenants polling simultaneously increases the contention enough that context switches start increasing the average and tail latencies. MongoDB: We compare two versions of MongoDB with polling-based and HyperLoop-enabled replication. We run YCSB workloads against a chain with three replicas. We co-locate multiple instances (10:1 processes to cores ratio) to emulate multi-tenant behavior from multi-tenant data centers and then measure the latency. Figure <ref type="figure">12</ref>  performance comparison of the two versions. HyperLoop reduces replication latency by up to 79% by reducing the reliance on overburdened CPUs, and the remainder of the latency is mostly due to the high overhead inherent to Mon-goDB's software stack in the client that requires query parsing and other checks and translations before a query is executed. For MongoDB, HyperLoop also reduces the gap between average and 99 th percentile latency by up to 81%. Furthermore, HyperLoop completely obviates involvement of backup CPUs in the process of replication by offloading transaction replication and execution to the RDMA NIC. In contrast, MongoDB's native replicas saturate the cores while running YCSB workloads.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="7">DISCUSSION</head><p>Supporting other storage systems: In designing our primitives and APIs, we were motivated by state-of-the-art transactional programming frameworks for NVM <ref type="bibr">[12,</ref><ref type="bibr">13]</ref>, and the messages in the data path of replicated transactional systems <ref type="bibr">[60]</ref>. Such a design allows us not only to move applications modified with existing APIs [14&#347;16] easily to HyperLoop but also give higher confidence to developers to use these APIs for faster adoption of NVM-aware systems.</p><p>HyperLoop is also useful for non-ACID systems and/or weaker consistency systems. In designing low-level primitives for fully-ACID and strongly consistent systems, we enable other weaker models as well. For instance, by ignoring the durability primitive, systems can get acceleration for RAMCloud <ref type="bibr">[85]</ref> like semantics. By not using the log processing primitive inside the transaction critical path, systems can get eventually consistent reads at higher throughput. Further, by not using the log processing and durability in the critical path, systems can get replicated Memcache <ref type="bibr">[27]</ref> or Redis <ref type="bibr">[37]</ref> like semantics. Supporting other replication protocols: We explored chain replication for its simplicity, popularity and inherent load-balancing of network resources. It is well known that the scalability of the RDMA NICs decreases with the number of active write-QPs <ref type="bibr">[71]</ref>. Chain replication has a good load balancing property where there is at most one active write-QP per active partition as opposed to several per partition such as in fan-out protocols.</p><p>While HyperLoop is optimized for chain replication protocol, HyperLoop's primitives can be used for any general replication protocol. For example, if a storage application has to rely on a fan-out replication (a single primary coordinates with multiple backups) such as in FaRM <ref type="bibr">[60]</ref>, HyperLoop can be used to help the client offload the coordination between the primary and backups from the primary's CPU to the primary's NIC.</p><p>For instance, in FaRM, the primaries poll for lock requests which it forwards to the backups that are also polling for meeting those requests. Similarly, primaries and backups poll for log record processing, making them durable, and log truncation. Techniques described in &#287;4.1 can be used so that the client can offload these operations to the primary's NIC and manage the locks and logs in backups via the primary's NIC without the need for polling in the primary and the backups, and ensuring the required ordering of operations between between them. Security analysis of HyperLoop: In designing HyperLoop, we assume that servers running storage front and backends are protected from attackers who can compromise the servers. We did not consider a comprehensive threat model since attackers can easily control the entire storage cluster once gaining access to a single server and even without exploiting a replication channel through HyperLoop. On the other hand, in HyperLoop, applications have access to RDMA queues on remote NICs. To ensure security and privacy, we use the same set of best practices when managing local queues to manage remote queues. The queues are registered to have access to only a restricted set of registered memory regions that belong to the same tenant, each remotely accessible queue is separately registered with a token known only to the tenant, and finally, managed languages are used to encapsulate the QPs from the application code with stricter safety checking (e.g., type check) in the client. In the future, as RDMA virtualization improves, we wish to leverage even more hardware virtualization techniques to secure the remote queues.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="8">RELATED WORK</head><p>Optimized storage and networking stacks: As storage and networking hardware technology have evolved, traditional OS storage and networking stacks became a performance bottleneck in applications, especially in distributed storage systems as shown in previous works <ref type="bibr">[54,</ref><ref type="bibr">68,</ref><ref type="bibr">88]</ref>. MegaPipe <ref type="bibr">[65]</ref>, Affinity-Accept <ref type="bibr">[87]</ref>, TCP port reuse <ref type="bibr">[2]</ref> and Fastsocket <ref type="bibr">[77]</ref> optimize the Linux kernel TCP stack to support better scalability for multi-core systems and highspeed NICs. Likewise file system and other storage optimizations <ref type="bibr">[51,</ref><ref type="bibr">66,</ref><ref type="bibr">76,</ref><ref type="bibr">99]</ref> propose making existing OSes friendly to SSDs. However, even with the optimizations, there are still remaining overheads including kernel-user space context switching, data copying, bounds and access control checks can cause high and unpredictable latency in storage systems. New storage and network hardware: To avoid the OS overheads, storage and networking techniques for kernel bypass have been proposed <ref type="bibr">[7,</ref><ref type="bibr">26,</ref><ref type="bibr">80,</ref><ref type="bibr">90]</ref> to poll for I/O completions from NIC or storage medium (e.g., SSD). Additionally, based on those techniques, user-space networking stacks <ref type="bibr">[28,</ref><ref type="bibr">40,</ref><ref type="bibr">49,</ref><ref type="bibr">69,</ref><ref type="bibr">79]</ref> and storage stacks <ref type="bibr">[29,</ref><ref type="bibr">54,</ref><ref type="bibr">61,</ref><ref type="bibr">84,</ref><ref type="bibr">97,</ref><ref type="bibr">98]</ref> have been developed. While these techniques help reduce the latency of standalone storage services and appliances <ref type="bibr">[60,</ref><ref type="bibr">71,</ref><ref type="bibr">72,</ref><ref type="bibr">78,</ref><ref type="bibr">82,</ref><ref type="bibr">91,</ref><ref type="bibr">100]</ref>, they do not work effectively in multi-tenant environments where polling is expensive and CPU still needs to coordinate between network and storage stacks. In contrast, since HyperLoop does not rely on polling and offloads the datapath of replicated NVM transactions to RDMA NICs, it does not require CPU usage.</p><p>Existing remote SSD access systems offer only point to point read/writes and often use CPU based polling for I/O completions <ref type="bibr">[55,</ref><ref type="bibr">74,</ref><ref type="bibr">84]</ref>. In contrast, HyperLoop provides group-based primitives for replicated transactions with predictable performance without polling. Multicast support in data centers: Reliable multicast <ref type="bibr">[50]</ref> is a seemingly effective network primitive for replicationbased distributed systems. Traditionally, since IP multicast is unreliable <ref type="bibr">[5,</ref><ref type="bibr">96]</ref>, it has not been widely adopted. Recent developments in NIC technologies promote a revisiting of reliable multicast at the network level. Derecho <ref type="bibr">[70]</ref> proposes an RDMA-based multicast protocol, which involves CPUs in the critical path of operations and relies on polling. Thus, it possibly incurs high tail latency especially in multi-tenant settings.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="9">CONCLUSIONS</head><p>Predictable low latency for both average and tail cases is critically lacking in modern replicated storage systems. Based on the observation that CPU involvement is the root cause of this behavior in multi-tenant deployments, we designed HyperLoop, a new framework that completely eliminates CPUs from the critical path of replicated transactions in multi-tenant storage systems. HyperLoop entirely offloads replicated transactions to commodity RDMA NICs, with NVM as a storage medium. We realize this by designing new group-based networking primitives that support ACID transactions and demonstrate that existing storage systems can be easily extended and optimized using HyperLoop. Our evaluation with two popular storage systems shows that HyperLoop can produce substantial reductions in both average and tail latency and CPU consumption on replicas. Looking forward, even though our specific focus in this paper was on storage systems, we believe that the design and insights underlying HyperLoop can be more broadly applicable to other data center workloads.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0"><p>The idea of HyperLoop, i.e., offloading replicated transactions to NICs in addition to point-to-point read/write operations, can be extended to other hardware combinations as long as the NIC can directly access the storage medium, such as FPGA based-Ethernet NICs that can access SSDs<ref type="bibr">[55]</ref>.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_1"><p>Different manufacturers have different terms for the method, e.g., &#322;CORE-Direct&#382;<ref type="bibr">[25]</ref> byMellanox.   </p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_2"><p>libibverbs and libmlx4 are userspace libraries/drivers that allow userspace processes to use InfiniBand/RDMA Verbs on Mellanox hardware.</p></note>
		</body>
		</text>
</TEI>
