scieee AI-readable full text Open interactive document viewer

RDMA mechanisms for columnar data in analytical environments

Silva, José Miguel Ribeiro da

Abstract

The amount of data in information systems is growing constantly and, as a consequence, the complexity of analytical processing is greater. There are several storage solutions to persist this information, with different architectures targeting different use cases. For analytical processing, storage solutions with a column-oriented format are particularly relevant due to the convenient placement of the data in persistent storage and the closer mapping to in-memory processing. The access to the database is typically remote and has overhead associated, mainly when it is necessary to obtain the same data multiple times. Thus, it is desirable to have a cache on the processing side and there are solutions for this. The problem with the existing so lutions is the overhead introduced by network latency and memory-copy between logical layers. Remote Direct Memory Access (RDMA) mechanisms have the potential to help min imize this overhead. Furthermore, this type of mechanism is indicated for large amounts of data because zero-copy has more impact as the data volume increases. One of the problems associated with RDMA mechanisms is the complexity of development. This complexity is induced by its different development paradigm when compared to other network commu nication protocols, for example, TCP. Aiming to improve the efficiency of analytical processing, this dissertation presents a dis tributed cache that takes advantage of RDMA mechanisms to improve analytical processing performance. The cache abstracts the intricacies of RDMA mechanisms and is developed as a middleware making it transparent to take advantage of this technology. Moreover, this technique could be used in other contexts where a distributed cache makes sense, such as a set of replicated web servers that access the same database.

Full text

Universidade do Minho Escola de Engenharia Departamento de Inform´ atica Jos´ e Miguel Ribeiro da Silva RDMA mechanisms for columnar data in analytical environments January 2021 Universidade do Minho Escola de Engenharia Departamento de Inform´ atica Jos´ e Miguel Ribeiro da Silva RDMA mechanisms for columnar data in analytical environments Master dissertation Intregrated Master’s in Informatics Engineering Dissertation supervised by Professor Doutor Jos´ e Orlando Roque Nascimento Pereira Doutor F´ abio Andr´ e Castanheira Lu´ıs Coelho January 2021 DIREITOS DE AUTOR E CONDIC¸ ˜ OES DE UTILIZAC¸ ˜ A O D O TRABALHO POR TERCEIROS Este ´ e um trabalho acad´ emico que pode ser utilizado por terceiros desde que respeitadas as regras e boas pr´ aticas internacionalmente aceites, no que concerne aos direitos de autor e direitos conexos. Assim, o presente trabalho pode ser utilizado nos termos previstos na licenc¸a abaixo indicada. Caso o utilizador necessite de permiss˜ ao para poder fazer um uso do trabalho em condic¸ ˜ oes n˜ ao previstas no licenciamento indicado, dever´ a contactar o autor, atrav´ es do Reposit´ oriUM da Universidade do Minho. Licenc¸a concedida aos utilizadores deste trabalho Atribuic¸˜ ao-SemDerivac¸ ˜ oes CC BY-ND https://creativecommons.org/licenses/by-nd/4.0/ i ACKNOWLEDGEMENTS First of all, I want to thank my parents for allowing me to get an academic degree, without them this dissertation would not be possible (Obrigado aos meus pais por me darem acesso ao percurso acad´ emico, sem eles esta dissertac¸˜ ao n˜ ao seria poss´ ıvel). I also want to thank my supervisors, Dr. Orlando Pereira and Dr. F´ abio Coelho, thank you for your dedication and patience. It was also essential for this dissertation the availability of Minho Advanced Computing Center (MACC) and Rui Gonc¸alves. It was vital for this dissertations’ success. All the support from my girlfriend, brother, and friends was very important for this accomplishment, and for that, I thank you all. ii STATEMENT OF INTEGRITY I hereby declare having conducted this academic work with integrity. I confirm that I have not used plagiarism or any form of undue use of information or falsification of results along the process leading to its elaboration. I further declare that I have fully acknowledged the Code of Ethical Conduct of the University of Minho. iii ABSTRACT The amount of data in information systems is growing constantly and, as a consequence, the complexity of analytical processing is greater. There are several storage solutions to persist this information, with different architectures targeting different use cases. For analytical processing, storage solutions with a column-oriented format are particularly relevant due to the convenient placement of the data in persistent storage and the closer mapping to in-memory processing. The access to the database is typically remote and has overhead associated, mainly when it is necessary to obtain the same data multiple times. Thus, it is desirable to have a cache on the processing side and there are solutions for this. The problem with the existing solutions is the overhead introduced by network latency and memory-copy between logical layers. Remote Direct Memory Access (RDMA) mechanisms have the potential to help minimize this overhead. Furthermore, this type of mechanism is indicated for large amounts of data because zero-copy has more impact as the data volume increases. One of the problems associated with RDMA mechanisms is the complexity of development. This complexity is induced by its different development paradigm when compared to other network communication protocols, for example, TCP. Aiming to improve the efficiency of analytical processing, this dissertation presents a distributed cache that takes advantage of RDMA mechanisms to improve analytical processing performance. The cache abstracts the intricacies of RDMA mechanisms and is developed as a middleware making it transparent to take advantage of this technology. Moreover, this technique could be used in other contexts where a distributed cache makes sense, such as a set of replicated web servers that access the same database. Keywords: RDMA, cache, analytical processing, columnar data, distributed systems iv RESUMO A quantidade de informac¸˜ ao nos sistemas inform´ aticos tem vindo a aumentar e consequentemente, a complexidade do processamento anal´ ıtico torna-se maior. Existem diversas soluc¸ ˜ oes para o armazenamento de dados com diferentes arquiteturas e indicadas para determinados casos de uso. Num contexto de processamento anal´ ıtico, uma soluc¸˜ ao com o modelo de dados colunar ´ e especialmente relevante devido ` a disposic¸˜ ao conveniente dos dados em disco e ` a sua proximidade com o mapeamento em mem´ oria desses mesmos dados. Muitas vezes, o acesso aos dados ´ e feito remotamente e isso traz algum overhead, principalmente quando ´ e necess´ ario aceder aos mesmos dados mais do que uma vez. Posto isto, ´ e vantajoso fazer caching dos dados e j´ a existem soluc¸ ˜ oes para esse efeito. O overhead introduzido pela latˆ encia da rede e c´ opia de buffers entre camadas l´ ogicas ´ e o principal problema das soluc¸ ˜ oes existentes. Os mecanismos de acesso direto a mem´ oria remota (RDMA - Remote Direct Memory Access) tˆ em o potencial de melhorar o desempenho neste cen´ ario. Para al´ em disso, este tipo de tecnologia faz sentido em sistemas com grandes quantidades de dados, nos quais o acesso direto pode ter um impacto ainda maior por ser zero-copy. Um dos problemas associados com mecanismos RDMA ´ e a complexidade de desenvolvimento. Esta complexidade ´ e causada pelo paradigma de desenvolvimento completamente diferente de outros protocolos de comunicac¸˜ ao, como por exemplo, TCP. Tendo em vista melhorar a eficiˆ encia do processamento anal´ ıtico, esta dissertac¸˜ ao prop˜ oe uma soluc¸˜ ao de cache distribu´ ıda que tira partido de mecanismos de acesso direto a mem´ oria remota (RDMA). A cache abstrai as particularidades dos mecanismos RDMA e ´ e disponibilizada como middleware, tornando a utilizac¸˜ ao desta tecnologia completamente transparente. Esta soluc¸˜ ao visa os sistemas de processamento anal´ ıtico, mas poder´ a ser utilizada noutros contextos em que uma cache distribu´ ıda fac¸a sentido, como por exemplo num conjunto de servidores web replicados que acedem ` a mesma base de dados. Palavras-Chave: RDMA, cache, processamento anal´ ıtico, dados colunares, sistemas distribu´ ıdos v CONTENTS 1 introduction 1 1.1The Problem 3 1.2Objectives and Contribution 3 1.3Thesis structure 4 2 background 5 2.1RDMA networking 5 2.2Distributed query processing engines 9 2.2.1Apache Spark 9 2.2.2Dremio 10 2.2.3Apache Flink 12 2.3Distributed caching middleware 13 2.3.1Alluxio 13 2.3.2Memcached 14 2.4RDMA in database engines 15 2.4.1Pilaf 16 2.4.2Herd 17 2.4.3Fast Remote Memory (FaRM) 18 2.5Discussion 19 3 use case and challenges 20 3.1Use-case 21 3.2Discussion 25 4 distributed cache 27 4.1System architecture 27 4.2Specification 30 4.2.1Assumptions 31 4.2.2Configuration 31 4.3Implementation 32 5 system analysis and results 36 5.1Experimental Setting 36 5.2Configuration 37 5.3Results 38 5.3.1Emulated and Virtualized environment 38 5.3.2Infiniband environment 44 vi Contents vii 5.4Discussion 47 6 conclusion 49 6.1Conclusion 49 6.2Future work 50 2 ing consistency guarantees with a transactional system. When this format is used, the use case should not require sequential accesses to specific columns of large sets of rows. A column-oriented format makes sense for aggregation problems as it avoids retrieving useless data from persistent storage. Accessing persistent storage is expensive and thus should be minimized. As the information grows, analytical processing gets more complex and requires sophisticated algorithms in order to get results within a reasonable time span. These algorithms are developed thinking in a variety of factors that become increasingly important when dealing with more information. When it is possible, the work is distributed across multiple machines. That way, the processing is done distributedly, becoming agile, and efficient. The analytical processing systems considered in this dissertation are systems similar to Apache Spark [9] or Apache Flink [6]. That is, systems composed of several distributed instances where processing is scattered among all nodes and storage requires remote data accesses in-between nodes. Getting data from a remote database adds overhead. When dealing with a large amount of information, this overhead becomes even more noticeable. Considering the rate of information growth, retrieving remote information must be done efficiently. For example, when data is being processed, it is common to need the same subset of information multiple times. It would be ideal to get this information as few times as possible. Mitigating this issue usually imposes the use of caching mechanisms. There are multiple strategies to cache data, but the underlying concept is the same: storing a subset of the information close to the client or on hot standby for later use if needed. To make the most of a cache, there must be temporal and spatial locality. Temporal locality means that the same item of data is accessed multiple times in a short time span. Spatial locality means that nearby items of data are accessed in a short time span. In analytical environments, many times, there is a need to have these caches distributed across the nodes, and when accessing them remotely, there is an additional overhead. The network implementations found in High-Performance Computing (HPC) clusters usually offer low latency and high throughput. Infiniband is a networking technology used for interconnecting servers and storage systems. It provides high-throughput, low latencies and facilitates data movement without Central Processing Unit (CPU) involvement, using Remote Direct Memory Access (RDMA).RDMA is the capability to access remote memory (read or write) without interrupting the remote processor. With higher CPU efficiency, lower latency and higher bandwidth, Infiniband and RDMA can help deliver better performance in distributed computing environments. 1.1. The Problem 3 1.1 the problem Nowadays, analytical processing is done by more than one machine or node, taking advantage of distributed processing capabilities or high-performance computing infrastructures. Even though each processing node could have its own individual cache, it is better if a distributed caching mechanism is used. This way, each node can access any value cached on any machine. This is especially relevant in distributed configurations, where processing a query requires data to be shuffled across instances, in order to compute a globally correct answer. There are already solutions for distributed caches. For example, Redis [25] or Memcached. Memcached [22] is an in-memory distributed key-value store, while Redis is very similar to Memcached and provides a variety of data structures including lists and sets. Solutions for distributed caches usually have two main overheads: the network latency and object serialization. These solutions rely on connections between nodes, usually via sockets (Transmission Control Protocol (TCP) or User Datagram Protocol (UDP)). Network latency arises from having a connection between the nodes and having data flowing between them. Object serialization is required, in order to format the data in a way that allows it to be transmitted over a network. Serialization introduces overhead as it requires objects to be processed during the marshal and unmarshall stages. Network latency and object serialization overhead are still better than accessing the source of the data but has a negative impact on performance. Distributed caching still has limitations. Ideally, network speed should be the only limitation, but that is not the case. The copy between memory buffers has a negative impact on the performance. Copies are made on mode switches between the kernel space and user space when receiving or sending network packets. The processing time takes a big hit with memory copies for every packet. These operations should be reduced to a minimum (zerocopy, if possible). As previously described, RDMA provides the capability to access remote memory without involving the remote processor. Thus, it makes sense to consider it when trying to mitigate this limitation because this mechanism is considered to be zero-copy. 1.2 objectives and contribution This dissertation proposes a solution for distributed caching with low latency accesses (remote and local), focused on RDMA technologies, reducing the network latency to a minimum, aiming at analytical environments. At the same time, the proposed distributed caching mechanism abstracts the development and integration complexity of using network interconnect systems as Infiniband with RDMA, by integration of a software package and make use of a simple Advanced Programming Interface (API). 1.3. Thesis structure 4 The main goal is to develop a distributed cache that relies on a mechanism suitable for sharing large amounts of data. The mechanism used should allow data to flow across the nodes in an analytical environment avoiding the conventional I/O circuit. This requirement encourages exploring Remote Direct Memory Access mechanisms. A study exploring to what extent this technology can assist in the development of a distributed cache is provided. Moreover, understanding the limitations can help to mitigate them during the development process. After studying the technologies, it is necessary to develop a distributed cache prototype that exploits them. This development has to be supplemented by test scenarios, to understand which factors impact performance the most. At an advanced stage of the prototype, it makes sense to compare its performance to distributed caches that do not take advantage of this type of technology. Then it will be possible to infer its viability based on the results. In order to achieve the proposed objectives, this dissertation will present a set of contributions. Designing an architecture for a distributed cache relying on RDMA will be the first step. The following contribution is a prototype of a distributed cache based on RDMA mechanisms, supporting the usual cache operations. Lastly, the results from the performed tests during the development will be analyzed. This is important as it will be the basis to conclude in what scenarios this prototype could be useful. It will also support a comparison between what latencies could be achieved, in theory, and the ones that were accomplished, in practice. 1.3 thesis structure This dissertation includes 6chapters, beginning with an introduction, presenting the problem, motivation and objectives. Chapter 2provides a solid background to understand the problem and the proposed solution. This chapter also details related work, distributed caching middleware systems, and distributed query processing engines. Chapter 3presents the use-case, describing the initial architecture, and introducing the problems we are facing during development based on initial tests. The core solutions’ architecture and specification are described in chapter 4, with every decision made based on some findings made in chapter 3and evaluations shown in chapter 5. The performance analysis is outlined in Chapter 5. It includes a comparison between two versions of the solution to support one of the main decisions of the implementation. There are also results comparing the solution to an existent cache to evaluate the performance difference with this solution. Chapter 6includes a retrospective of the results obtained and concludes the thesis. It also discusses learned lessons and future work. 2 BACKGROUND Direct access to remote memory is a concept that is motivated by the prospect of accessing remote memory without interrupting the remote CPU. Different protocols support RDMA and each one has different requirements in terms of hardware. Even though there are multiple protocols, the RDMA operations are available through the same verbs specification. In analytical processing environments, middleware systems reside between the data source and the process execution to provide better performance. Some of the performance gains are accomplished by caching information in the cluster, avoiding redundant data accesses. As such, we must analyze the existing caching mechanisms and confront them with RDMA-based solutions. This chapter consists of four main sections: RDMA Networking, Distributed query processing engines, Distributed caching middleware, and RDMA in database engines. The ”RDMA Networking” section details Remote Direct Memory Access and tools that aim at mitigating remote accesses’ overhead. The ”Distributed query processing engines” section details existing computing frameworks and their caching mechanisms. The ”Distributed caching middleware” section focuses on middleware designed to improve performance when computing data in a cluster environment using caching. Finally, the ”RDMA in database engines” section focuses on projects that have goals similar to this dissertation. These projects will be detailed to understand them in-depth and identify their strengths and weaknesses. 2.1 rdma networking RDMA introduces the capability to access remote memory (read or write) without interrupting the remote processor. This means that one machine can access another machine’s memory like if it is its own. For this to be possible, specific hardware is required and it varies depending on the protocol being used. Currently, there are three network protocols that support RDMA: InfiniBand [3], RDMA over Converged Ethernet (RoCE [1] and RoCEv2[2]) and Internet Wide Area RDMA Protocol 5 2.1. RDMA networking 6 (iWARP) [24]. All these protocols share the same API, desiganted as Verbs [16]. With this API it is possible to use RDMA from userspace. The functions present on the verbs API allow userspace programs to access the Network Interface Controller (NIC). The NIC must be ready for RDMA operations and because of that, usually is referred to as RDMA-Enabled Network Interface Controller (RNIC) in contexts like this. These operations are posted to queues present on the RNIC. There are two queues, usually referred to as a Queue Pair (QP). One send queue and one receive queue. Each QP has a Completion Queue (CQ) that is filled by the RNIC upon fulfillment of operations. There are two kinds of operations: One-sided - These operations are READ and WRITE. Using memory semantics to specify the remote memory address to write to or read from, they access remote memory directly. They are considered one-sided because the remote CPU is unaware of it. By not involving the remote CPU, these operations can achieve high throughput. Two-sided - These operations are: send (SEND) and receive (RECV). The SEND operation transmits a payload that is written to a previously specified buffer on the remote machine with a RECV operation. They are considered two-sided operations because the remote node needs to post a RECV for another machine to perform the SEND operation. RDMA messages can be transmitted in a connected or unconnected manner. Connected messages require a connection between two QP that only communicate to each other. There are two types of connection: Reliable Connection (RC) and Unreliable Connection (UC). The difference in UC is that there are no acknowledgments for package reception and, as a consequence, UC connections produce less network traffic. Unconnected QPs can communicate with an unlimited number of QPs. There is only one type of unconnected transmission: Unreliable Datagram (UD).RNICs need to sustain state for all the active QPs and for applications where there is a server, having a connection for all clients is unsustainable, as the cache for this information in the network card is limited. Unreliable Datagram makes sense for such applications, but one must consider the unreliability that comes with it. The operations supported on each connection varies. Table 1[19] shows the operations supported by each queue-pair connection type. Operation RC UC UD SEND/RECV YES YES YES WRITE YES YES NO READ YES NO NO Table 1: Supported RDMA operations by connection type. 2.1. RDMA networking 7 The RDMA technology has numerous advantages. Reading and writing directly to remote memory avoids copying data between multiple software layers, thus RDMA is considered a zero-copy mechanism. The data is sent and received in the same context without context switches, which means that the kernel is bypassed. This is one of the biggest advantages, as it allows circumventing the classic I/O circuit on each connection. Sending and receiving data uses dedicated hardware, decreasing the usage of the CPU, as it does not do any active work. A short message can be transferred with really low latency. In current hardware and on current servers, the latency for sending up to tens of bytes can be a couple of hundred nanoseconds [26]. Assuming that Infiniband is used, the bandwidth is very high (from 2.5Gbits/sec up to 120 Gbits/sec), in contrast to a standard Ethernet device, which is lower (10Mbits/sec or 40 Gbits/sec) [26]. Infiniband (IB) is a network communication standard introduced by the Infiniband Trade Association [3]. One of the key features is the fact that it supports RDMA natively. Infiniband includes specific hardware components for the network physical layer. InfiniBand features low latency and high-throughput data transfer which is ideal for high-performance computing and many other use cases. Using this protocol, in current hardware and on current servers, the bandwidth can be up to 56 Gbits/sec [26]. The RDMA over Converged Ethernet (RoCE) protocol was introduced by the Infiniband Trade Association [1]. It is a standard for RDMA over Ethernet, as it substitutes the physical InfiniBand layer with Ethernet. One of the main advantages of this protocol is the fact that it can be implemented on top of an existent Ethernet-based infrastructure without needing to replace the hardware completely as Infiniband requires. The Infiniband Trade Association also released a second version (RoCEv2) that runs on top of the UDP/IP protocol. This makes it not suitable for lossy networks. But, on the other hand, it is routable on IP networks and it does not add the overhead that a protocol as TCP/IP adds to achieve reliability. The bandwidth for these protocols depends on the Ethernet technology being used. Ethernet’s bandwidth can go from 10Mbit/sec to 40Gbits/sec. The iWARP protocol is an RDMA implementation that runs on top of the standard network and transport layers, which means it works on any Ethernet infrastructure. The TCP/IP protocol provides flow control and congestion management, meaning that a lossless network is not a requirement. The bandwidth for this protocol depends on the Ethernet technology being used. Although TCP/IP is used, it is not the host’s CPU that runs the protocol. An RNIC is used to handle traffic. The extensions to the TCP/IP added by iWARP were standardized by Internet Engineering Task Force (IETF) in 2007 and can be seen on Figure 1[17]. The Remote Direct Memory Access Protocol (RDMAP) [24] layer provides data transfer operations. The protocol specifies seven operations, but the main ones are: Send, Receive, 2.1. RDMA networking 8 Figure 1: The iWARP protocol. Read and Write. All other operations are overloads of the ones enumerated except for one: Terminate. The terminate operation sends a message to a remote peer reporting an error that occurred at the local peer. The Direct Data Placement over Reliable Transports (DDP) [28] layer handles all the process of writing to a data buffer. The protocol takes the payload and placement information and writes the data in the appropriate location. The Marker PDU Aligned Framing for TCP (MPA) [14] layer stands between the TCP and DDP layers to preserve the reliable, in-order delivery of TCP adding record boundaries that are required by the DDP protocol. Figure 2[17] shows an overview of the RDMA stack for the different protocols that were described on this section. Examining the Infiniband stack, it is possible to perceive that it requires a network infrastructure that is completely different from a commodity configuration. We perceive that because of the protocols being used. Infiniband provides high bandwidth but also implies a total replacement of the network infrastructure. The RoCE stack (v1and v2) is similar to Infiniband but uses the Ethernet protocol for the link layer. Changing the link layer solves the problem of the network infrastructure. But, there is the limitation of the Ethernet’s bandwidth. RoCEv2also uses the UDP/IP protocol, meaning it is routable. The iWARP stack changes almost completely in comparison to the others. It has its own protocol for RDMA on top of TCP/IP and uses the Ethernet link layer. Using TCP/IP makes it suitable even for lossy networks. 2.2. Distributed query processing engines 9 Figure 2: An RDMA stack overview. 2.2 distributed query processing engines Usually, analytical processing takes advantage of a computing cluster. Running an application inside a cluster involves many concerns, for example, task scheduling among the workers. Most of the time, a distributed computing framework is used to expedite the development because task scheduling is not an easy task and requires understanding complex concepts of distributed systems. As such, it is important to understand the caching mechanisms of some of the most used distributed computing frameworks to understand their limitations and how an RDMA solution could improve performance. 2.2.1Apache Spark Apache Spark [9] is a general-purpose distributed computing platform. It extends the MapReduce [11] programming model introduced by Google and popularized by Apache Hadoop [7]. The Spark project is composed of multiple integrated components, including Spark Core, Spark Streaming, Spark SQL, and others. Figure 3illustrates the Spark architecture and its core components. The core is responsible for scheduling, distributing and managing the tasks running inside the cluster. There are three main elements in the architecture: •Driver Program: the main application that manages the creation. •Cluster Manager: an optional element that is necessary only when Spark is executed in a distributed environment. It is responsible for managing the Worker nodes. •Workers: the nodes that execute the tasks sent by the Driver Program. 2.2. Distributed query processing engines 10 Figure 3: Apache Spark’s Architecture. The main abstraction in Spark Core is the Resilient Distributed Dataset (RDD) [29]. An RDD is a fault-tolerant collection of data objects which can be operated in parallel. It is a read-only collection of records that can only be created through deterministic operations (transformations) on data in stable storage or other RDDs. It is possible to control the persistence of a dataset specifying that a given RDD should be persisted in-memory or another storage type, for example, Hadoop Distributed File System (HDFS). The partitioning of an RDD is also configurable based on a key associated with each record. Usually, a Spark program is defined as a sequence of transformations applied to a collection of records. Apache Spark does not cache any of the results by default. But, it is possible to use some methods provided by the framework. These methods allow applications to cache/persist some intermediate values. The problem of these methods is the need to handle everything at the application level, that is, decide what is kept and what is discarded. 2.2.2Dremio Dremio [13] is a data lake engine, providing a platform that unifies storage layers with query interfaces. It unifies the storage and interface layers by creating a data-as-a-service platform, as depicted in Figure 4. With this layer between the storage and interface layers, there is no need to implement complex Extract Transform Loads (ETLs) which relaxes the need for a classical Data warehouse architecture. Data has become more complex with time and as a result, in most cases, the data is managed by multiple technologies. Many modern storage solutions include multiple data sources, relational, and non-relational. As such, accessing those data stores involves using multiple interfaces and a solution like Dremio simplifies querying the data, offering polyglot capability. 2.2. Distributed query processing engines 11 Figure 4: Data-as-a-service platform architecture. There are two main node types in Dremio, that are typical in distributed computing frameworks: •Coordinators: Responsible for coordinating the Executors, the ”map” and ”reduce” phases of queries and keeping metadata. •Executors: The workers. These nodes are responsible for executing the actual task. Similarly to Apache Spark, Dremio is independent of the used storage solution. The executors have a persistence layer implemented on top of Apache Arrow [5]. Apache Arrow is a development platform for in-memory data and uses a columnar memory format for efficient analytic operations. Reflections are a very important part of Dremio. Reflection is an optimized physical representation of the source data. The query optimizer can use Data Reflections to assist queries. These Reflections might be used for only a fraction of the query or all of it. There are three types of Reflections: •Raw: contain the raw data in the original data source but partitioned and ordered to improve query efficiency. •Aggregation: contain pre-aggregated data, useful to improve analytical query performance (group by followed by sum, min, max, etc). •External: stored outside the distributed storage of Dremio, mapped to another storage system. Reflections can be saved to multiple distributed storage solutions, for example, HDFS. The archives are stored in the Parquet format [8], a columnar storage format which is ideal when combined with Apache Arrow that is used in Executors as described above. 2.4. RDMA in database engines 18 Figure 9: Herd’s request region. in terms of the size supported for key-value pairs. In a distributed cache scenario Herd shows limitation as it is implemented using multiple server processes on one machine only. That is a limitation because to use it in a distributed manner, it would be required to add a logical layer to synchronize all the nodes. 2.4.3FaRM FaRM [12] is a main memory distributed computing platform that exploits RDMA. The platform creates a shared address space, exposing the main memory of all nodes. Farm nodes can also execute application threads. It was designed this way because it would be wasteful not to use the CPU’s power as it is not used for RDMA operations. The platform uses RDMA reads to access remote data directly and implements a message passing primitive using RDMA writes. This primitive is a substitute for the send/recv verbs. The implemented primitive is based on a circular buffer (Figure 10) to implement a unidirectional channel. There is one buffer on each receiver per sender/receiver pair. The receiver needs to detect new messages and for that purpose, unused portions of the buffer are zeroed. By polling the head position, it is possible to detect new messages because any non-zero value L symbolizes a new message with length L. The message buffer is zeroed and the head pointer advances after delivery to the application layer. The sender uses RDMA to write to the circular buffer of the receiver. A message is sent by writing to the buffer tail and advancing the tail pointer. A sender keeps a local copy of the receiver’s head pointer and never writes messages past that limit. The receiver makes processed space available to the sender by writing the current value of the head to the sender’s copy using RDMA. This write operation is not executed for every message 2.5. Discussion 19 Figure 10: FaRM’s circular buffer for messaging. processed because that would lead to performance overhead. The operation is executed after half the buffer is processed. FaRM’s communication primitives are slower than accessing the main memory and, because of that, it is possible to execute threads on the node that contains the data. The programming model provided by FaRM is event-based and the operations that require polling take a handler as an argument, that is invoked when the operation is complete. Examples of such operations are: read and write. FaRM also provides operations for handling transactions to ensure consistency. The advantage of Farm is that it provides a framework for developing applications based on RDMA in a cluster. Abstracting the actual RDMA operations makes the development easier. If the development is easier, developers can focus on complex problems without worrying about network-specific concerns. 2.5 discussion After analyzing the caching solutions on analytical processing frameworks, it is noticeable the mechanisms can be improved. The cache solutions always have a particular feature missing. In Apache Spark, the management is non-existent and the user must define what is cached and what is evicted. In Apache Flink there is too much redundancy, making the cache very inefficient in terms of memory usage. In Dremio, the cache is not in memory and implementing a cache between Reflections and Executors could benefit performance. Even though every studied framework includes a solution for caching, all of them could benefit from a more sophisticated one. As such, the development of a cache with memory management on top of an RDMA-capable network could improve these frameworks’ caching mechanisms. It is important to note that Apache Flink’s methods are more exposed to the development level. That particularity allows the integration of a new cache, like the one presented in this dissertation, more transparently. 3 USE CASE AND CHALLENGES Distributed caching applications usually rely on TCP sockets to get and put values. It is obvious that when accessing other machines with cached data, there is an overhead added by the network communication. But, when the information is cached on the machine that needs to access it, network communications should provide only minimal impact on the access time. Knowing that distributed caching systems usually rely on TCP sockets, even when data is on the same machine, a test was conducted to understand the impact of this approach. RDMA can provide several benefits in this context and, as such, an RDMA-based proof of concept cache was developed and tested to understand the challenges of this technology and conceive solutions. As discussed in the last chapter, a cache can be very useful in analytical environments. Figure 11 depicts the role and location of this cache in analytical environments. Figure 11: The cache in analytical environments. 20 3.1. Use-case 21 In Figure 11, we have the cache module that is used in Worker nodes as a middleware. This way, the number of accesses to the Data source is reduced, which is possibly in a remote server as illustrated. These cache modules are connected through Local Area Network (LAN), making the data in the cluster accessible to any worker. 3.1 use-case Two scenarios were considered. The purpose of the first scenario is to understand the impact of local accesses through a TCP connection. The second one is meant to supplement the development of a proof of concept. As already addressed, distributed caching systems usually rely on TCP sockets, even for local connections. As such, it is important to devise an experiment to help understand the impact of this communication strategy having a server on the same machine as the client. As there are no standard benchmarks to evaluate this trade-off, a micro-benchmark was developed for that purpose. The scenario designed for this experiment includes a micro-benchmark, deployed from a single machine with a Linux distribution installed and a Memcached server running. Memcached is a distributed keyvalue store, as detailed in the previous chapter. The system holds the following hardware: •Intel R Core TM i7-3537U @ 2GHz with 2cores (4logical cores with hyperthreading) •8GB of RAM •240 GB of storage (SSD) In a Linux filesystem, the /tmp folder usually has the Temporary Filesystem (tmpfs) that keeps files in-memory (with swapping). This composition is represented in Figure 12, showing how the components interact with each other. Figure 12: Local accesses experiment scenario. The micro-benchmark developed for this experiment starts by generating 100 values and keys. The values generated are random strings that are 4Megabytes long. These values are saved on a Memcached local instance and also in the /tmp folder of the machine. In 3.1. Use-case 22 the folder, keys correspond to the name of the file. After the values are created, all the values from both sources are retrieved by the benchmark. This process consists of getting the values 10 times and outputs the time it took to get and read them. The process is reproduced for Memcached and the /tmp folder. For Memcached, the values are retrieved using a socket. For the folder, the program uses memory mapping and, to make sure every byte is read, it runs through every byte in a cycle. The results produced by this benchmark are depicted in Table 2. It shows that having a socket connection has a very negative impact on performance when compared with accessing local memory. With the Memcached’s socket connection, the execution time is three orders of magnitude higher. Environment Execution time(ms) Memcached 1090.72 /tmp 3.99 Table 2: Local accesses overhead analysis. The initial tests to assess the sockets’ overhead motivate that designing a solution using RDMA mechanisms can provide a performance improvement. As an exercise, consider using the tmp directory as the data structure as in the initial tests. The problem with this is the fact that it is against the purpose of RDMA. The goal is to have a zero-copy system, and having the tmp folder as a data structure would imply constant copies from the memory region to the tmp and vice-versa. With all the memory copy, there would not be a substantial difference between using sockets and using RDMA. As a first strategy, let’s assume that all the nodes in the cache know where all the values are stored and, consequently, if they exist. For now, we will ignore how the clients choose which server to connect to retrieve a value for a given key. The focus is on how the data is stored and retrieved. The objective is to have an initial version of a cache supporting the usual operations: GET, PUT and DELETE. Each server or node has a memory region that contains the data structure with all the keys and values. The server and client need three other memory regions, consisting of a send, receive, and data memory region. The send and receive memory regions are buffers used to send/receive requests, as the names suggest. These buffers are useful for two-sided operations where the client and server need to register the intention to send and receive. The data memory region is used by the client to perform a one-sided read when getting a value. In this prototype, the usage is not abstracted, and it is necessary to initialize the server and clients explicitly on each node. Also, it is required to specify the server for storing and getting a key/value pair. Then, the clients have a public API for the PUT and GET operations. To get a value, the caller must specify the key, that must be a string. For 3.1. Use-case 23 the PUT operation, the caller must specify the key and value that is also a string in this prototype. Comparing to the related work approaches, this is similar to Pilaf. The goal here is to use RDMA to read operations from the client without interrupting the remote processor. The Herd’s approach indeed gets better results when comparing to Pilaf [19], as it takes advantage of the discoveries made about the efficiency of the write operation. The problem is that it is not trivial to use it for large values as Herd has a maximum size for each key-value pair, which is 1KB. Clients know the memory region’s address after connecting to the server and use that as a reference point. When a client needs to access a value, it uses the key to request it from the server that has it stored. When the server receives such a request, it returns the offset and the size that represent the value position in the memory region. The server returns this pair only when the key exists. In the current solution, to perform a PUT operation, a client sends the key/value pair to any server. But, all the nodes must know where any key/value is. For that reason, a deterministic algorithm or mapping service collects the server location. Figure 13 depicts the prototype’s architecture. It is worth noting that a server node can also be a client to other server nodes and vice-versa. This configures the expected pattern in an analytical context, where every node uses cached values across all nodes. Figure 13: First approach architecture. 3.1. Use-case 24 The second experiment provides the evaluation required to assess the proposed approach. It is meant to help understand the technology challenges and possible problems in the first approach. The second experiment requires two nodes, and each node must have an RDMA-enabled network adapter. In this stage, we used software emulation, resorting to SoftiWarp, which is a software iWARP kernel driver and user library for Linux that implements the iWARP protocol suite in software, without requiring any dedicated RDMA hardware. SoftiWarp makes it possible for any machine to speak RDMA,asRDMA-capable network cards are expensive, and only available in particular nodes. It is costly for any of the standards described previously (IB,RoCE and iWARP). In this experiment, the nodes are virtual machines with access to equivalent hardware resources: •Intel Core i7 9xx @ 2GHz with 1core •2GB of RAM •20 GB of HDD storage The operating system installed in each one is Ubuntu 16.04 LTS with the 4.4.0-171-generic kernel version to support RDMA. The first node contains a micro-benchmark very similar to the one developed for the first scenario. There are two main differences. The first difference is the fact that in this case, the Memcached server is running in another node. The second difference is the purpose. This experiment is intended to compare Memcached to the developed prototype. Therefore, the values are now fetched from remote servers and the /tmp folder has no role in the experiment. The servers run in the second node. This scenario is represented in Figure 14. Figure 14: Second experiment scenario. The results for this preliminary evaluation show a high impact on the execution time when using the prototype (Tables 3and 4). The outcome of this experiment is due to the 3.2. Discussion 25 Packet size Execution Time (ms) 512 KB 626.17 1MB 1110.55 2MB 2137.83 Table 3: Prototype experiment - Memcached results. Packet size Execution Time (ms) 37 B1475 185 B1444 8KB 13413 Table 4: Prototype experiment - RdmaCache results. inadequate usage of the buffers that are registered as memory regions to perform two-sided RDMA operations, as described above. The strategy employed for these buffers is to register memory regions with a size that is capable of holding the biggest value supported by the cache. This approach is explained by the fact that the value is sent on the PUT operation, using RDMA send/recv. The length of the data can be defined before sending and that will avoid sending the complete buffer. But, as the memory registered for the buffer is larger, the memory mapping tables’ performance is still affected. This outcome is also influenced by inefficient buffer handling when reading and writing. In this prototype, the values and messages exchanged are always assumed to be a string. As such, the buffers are converted to a string for writing and reading, using a method that creates a char view of the buffer. This view shares the memory space but not the pointers (position and limit). With this approach, when writing and reading to the char view, the pointer of the original buffer can be different and leads to inconsistencies and data corruption. These conclusions impact on the design of the middleware because it is imperative to rethink the memory region registration for send and receive buffers. Furthermore, it is necessary to improve the buffer handling by manipulating the buffers directly to make sure the position and limit pointers are correct and data is not corrupted. With this approach, the client can still fetch the value as a string instead of a char view of the buffer, for example, converting the byte array to string with a particular encoding. 3.2 discussion One of the assumptions made on this prototype is that servers or nodes know where the value for a given key is stored and if it exists. One of the challenges to be addressed is finding a deterministic algorithm or service that returns the server that holds a given key. 3.2. Discussion 26 Moreover, the eviction strategy for the cache is yet to be defined. An eviction strategy must be in place, as deciding what to do when the memory is full is not enough or when values are not accessed for a long time. When developing a caching system for an analytical environment, the complete dataset will not fit in memory. The memory is limited, and the cache must manage it efficiently to maximize cache hits. After the second experiment, it is clear that the buffer handling needs improvements. The first step is to consider values as bytes and provide an option to get and put as a string but always converting from string to byte using the buffer directly and not the char view, because of the problems detected during the experiments. The second improvement is rethinking the memory regions registered for two-sided operations because it also had an impact on the collected results. The cache presented in the next chapter is a middleware, and one of the main motivations for that is how challenging taking advantage of RDMA mechanisms is, due to its different protocol and flow of information when compared to other network protocols. Currently, the main obstacle in using RDMA is the fact that it is hard for a programmer to adopt RDMA technologies due to the different characteristics of the protocol and concepts. Thus, packaging the cache as a middleware that takes care of all the configuration and connections necessary is crucial, providing a simple PUT/GET API for the programmer while also ensuring all the performance produced by RDMA. 4 DISTRIBUTED CACHE RDMA mechanisms have the potential to improve data transmission performance by using a zero-copy protocol. In the preliminary experiments, it is possible to realize that developing an application based on an RDMA-capable network communication is not simple. The distributed cache abstracts the usage of RDMA for an application that requires a distributed cache with low latencies, high throughput, and low CPU usage. Using the distributed cache, the client application does not have to worry about the low-level intricacies of RDMA and buffer handling. The middleware manages the buffer handling taking advantage of RDMA features, and using an RDMA cache becomes as simple as a PUT and GET API. The proposed distributed cache is implemented as a middleware layer, enabling client applications to create nodes and configure the available servers. When using the middleware, it is possible to configure the available memory in each node and also the maximum value size supported for data transmission. 4.1 system architecture The verbs API makes it possible to interact with the hardware and perform RDMA operations. In essence, verbs are an abstract description of the functionality that is provided for applications for using RDMA. In Linux, the verbs API is made available in the open-source user libraries developed by OpenFabrics Enterprise Distribution (OFED). The distributed cache uses the verbs API to execute RDMA operations. As the RDMA user libraries are developed in C, to use them in Java, it is necessary to use a Java Native Interface (JNI) layer. To achieve that, the Direct Storage and Networking Interface (DiSNI) library is used, which creates a thin JNI layer to bridge between Java and the RDMA user libraries. The system architecture presented in Figure 15 reveals how the cache is packaged as a middleware to be used by external applications. This diagram shows the inner architecture of the middleware. 27 4.3. Implementation 34 Figure 18: Client endpoint’s buffers. In the send buffer, the first byte is used to specify which cache operation is being issued. To execute a GET operation, the byte corresponds to the character ”g”, and for a PUT operation it is ”p”. The operation byte is always followed by the key, that must be a string, and other optional fields. The optional fields are used when a PUT is being executed. To avoid the issues encountered when developing the proof of concept, namely, the buffer size impact on the performance of send/recv verbs, the send and recv buffers are kept short and the values are never sent in the operation message. Instead, the PUT operation includes the memory region information required for the server to perform an RDMA read and get the value directly. This strategy circumvents using long buffers for very short messages. The recv buffer is used to execute an RDMA recv when waiting for the server to respond. Although Figure 16 depicts the recv buffer as having all those parameters, that is only the case when the operation performed is a GET. In that case, the server sends the memory region’s address and key, the offset of the value, and its length. With this information, the client can read the value directly by executing an RDMA read. Using the RDMA read operation, it is possible to obtain the value directly, with zero-copy among buffers in the remote server. In the Server Endpoint, the recv buffer is also used to execute an RDMA recv, but in this case, the server always registers a recv after every handled request, because it is always listening for requests. The data buffer is used when performing an RDMA read. That is why its size corresponds to the maximum value supported by the cache. As described above, an RDMA read is performed by the server when a PUT operation is requested. The client resorts to its data buffer when the GET operation is executed. In both cases, the data buffer gets filled with the specified remote data. Lastly, the Memory Region buffer depicted in Figure 17 is dedicated to storing the actual values and is only allocated in the Server Endpoint. The values are stored contiguously and a data structure is maintained to identify the available memory space. When a value is 4.3. Implementation 35 deleted, the space occupied by that value will become available and, sometimes, that creates noncontiguous free space. Likewise, it is possible to know where the available spaces are. To do this, when the server endpoint is initialized, it creates a HashMap of free spaces with only one value. That value corresponds to the entire memory region because, at this point, all the space is available. In Figure 17 there is an example of the state of the memory region when a value is explicitly deleted. Figure 19: Server’s memory region. The CacheNode component implements an LRU eviction strategy because it only makes sense to cache something when it is being used multiple times in a short period. If a value is not used for a long time and is the least recently used, then it can be beneficial to delete it and leave room for a value that, possibly, will be used multiple times. To achieve the LRU eviction strategy, the Cache Node keeps two important pointers. The start pointer leads to the most recently used value and the end pointer corresponds to the least recently used one. As it is depicted in Figure 18, it is also necessary to keep a double-linked list for the values. These links help to update the start and end pointers when a value is evicted, deleted, added or retrieved. For example, when a value is evicted, the left pointer is used to determine the new least recently used value. Figure 20: LRU cache implementation using an HashMap and double linked list. 5 SYSTEM ANALYSIS AND RESULTS The distributed cache is evaluated considering a micro-benchmark specially tailored for this purpose. Two evaluation campaigns were then carried out, executing the same job for Memcached and the distributed cache introduced in this dissertation. The main goal is to examine to what extent the developed cache delivers performance wise, in comparison to one of the most used distributed caches, Memcached. 5.1 experimental setting The performance analysis relies on two micro-benchmarks, to compare the distributed cache to another cache with very similar environments, making sure no external factors influence the results. Standard benchmarks are not suitable as, generally, they target high level processing systems with abstractions at the application level. As the cache is completely agnostic to such high level abstractions, these benchmarks are not adequate for this environment. The main purpose is to assess the performance when getting values from the cache by running the micro-benchmark in multiple configuration settings. As the main goal of a cache is to get values that were already fetched from the data source, it is important to understand to which point an RDMA-based cache can improve the latency and throughput during the GET operation. The micro-benchmarks are split into two stages. The first stage consists of populating the remote node with values of a given size or sizes. The second stage executes the GET operation continuously for a given period. During the execution, the benchmark gets the values from the remote server and registers the response time. In the end, it outputs the average response time and also the throughput (operations per second, and MBits per second). The evaluation is deployed over two setups. The first setup is based on two nodes running in an emulated and virtualized environment. In the emulated environment, there is no RDMA-enabled hardware and software emulation is used resorting to Softiwarp. Moreover, there is only one physical machine and the nodes are virtual machines. The second setup is hosted in the Minho Advanced Computing Center and is also comprised of two nodes 36 5.2. Configuration 37 but, in this case, the network is based on Infiniband, which means RDMA operations can be executed without software emulation. Also, both nodes in this setup correspond to physical machines. The first batch of evaluations is performed in the first setup and the physical machine’s hardware is: •Intel R Core TM i7-3537U @ 2GHz with 2cores (4logical cores with hyperthreading), 8GB of RAM and 240 GB of storage (SSD) In this setup, two virtual machines are created and configured with 1GB of RAM and one CPU core each, with 20GB of SSD storage available for each virtual machine. The experiments performed in this environment are useful to determine the viability of the buffer strategy in the distributed cache, that will be referred to as RDMA Cache. As such, RDMA hardware is not mandatory and both nodes are setup with Softiwarp, to emulate RDMA-enabled hardware. In this environment, the comparison is performed between the RDMA Cache, Memcached and an early version of the RDMA Cache. Both nodes are setup with Memcached, RDMA Cache’s final version, and RDMA Cache with the early buffer handling strategy. The second batch of evaluations is performed in the second setup, which holds the following hardware: •8-core Intel Xeon E5-2680 @2.7GHz, 32GB of RAM and 115 TB in a shared Lustre parallel filesystem. •8-core Intel Xeon E5-2680 @2.7GHz, 32GB of RAM and 115 TB in a shared Lustre parallel filesystem. The nodes are interconnected with an Infiniband FDR network (54 Gbps). In this setup, both physical nodes are setup with Memcached and the RDMA cache. The goal of the evaluations performed in this setup is to assess the performance difference between using Memcached and the RDMA cache in an RDMA-capable environment. Softiwarp is no longer required, as this setup’s network is based on Infiniband hardware. 5.2 configuration It is important to test the cache with different configurations to determine their impact. The configurations manipulated during the experiments are divided into two groups. The first group is the cache’s configuration. For the RDMA Cache, the configuration consists of manipulating following values: •Maximum value size. 5.3. Results 38 •Available memory for values. •Available servers. For Memcached, the configuration is very similar, but it is necessary to provide the location of every server explicitly. The second group is the benchmark configuration that allows configuring the following parameters: •Value size of the populated values. •Benchmark running time. 5.3 results This section focuses on analyzing the results produced by running the micro-benchmarks. Firstly, the RDMA Cache buffer strategy is analyzed to understand the impact of the decisions made in the final version when compared to an early version. The early version considered has all the buffer handling problems encountered in the proof of concept solved. After asserting the viability of the RDMA cache buffer strategy, the analysis is focused on comparing it to Memcached, which is one of the most used distributed caches. 5.3.1Emulated and Virtualized environment The first experiments of the micro-benchmarks are performed in the emulated environment. These results provided important knowledge for a more efficient implementation of the RDMA cache. The experiments are performed with two versions of the RDMA cache. The first version shares the same buffer strategy with the proof of concept but the buffer handling issues are resolved. The second version corresponds to the final version, with short buffers for RDMA send/recv messages and a data buffer for reading remote values, as described in the last chapter. The one-sided experiment is the first evaluation performed in this environment, which is conducted by setting up the benchmarks to run in one of the nodes. As such, the values are only being retrieved in one way, which means that one of the nodes is acting only as a server and the other as a client. The benchmark is set up with different value sizes and always runs for 30 seconds. As the value size changes, the RDMA cache’s configuration also changes accordingly. The server instances configuration is always the same, as there are only two instances for all benchmark runs. The value sizes considered in this experiment range from 16KB to 2MB to understand how the size variation impacts the performance. For small value sizes, the minimum is 16KB because we need small values that still can store some meaningful information. The maximum value size is only 2MB due to the context of analytical processing, as the data is, often, processed in shards. 5.3. Results 39 The values represented in Table 5correspond to the results obtained when running the benchmark against the RDMA cache with the first buffer method. As it is possible to notice, solving the buffer handling issues delivers results much closer to what was expected. Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 803.34 1.25 105.29 32 KB 450 2.23 117.96 64 KB 393.34 2.56 206.22 128 KB 265 3.81 277.87 256 KB 180 5.60 377.49 512 KB 103.33 9.85 433.39 1MB 68.34 14.95 573.28 2MB 33.33 30.11 559.18 Table 5: One sided results for the RdmaCache’s first method. The values depicted in Table 6were collected by running the benchmark against Memcached. It is still noticeable that Memcached has better performance in this environment, but it is imperative to note that this is an emulated environment and there is no RDMA- enabled hardware. Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 881.44 1.13 115.53 32 KB 872.3 1.15 228.67 64 KB 865.46 1.16 453.75 128 KB 723.85 1.38 759.01 256 KB 450.31 2.22 944.37 512 KB 287.54 3.48 1206.03 1MB 198.56 5.04 1665.64 2MB 144.78 6.91 2429 Table 6: One sided results for Memcached. The values described in Table 7correspond to the results collected when running the benchmark against the RDMA cache’s final version. The results provide better response times and throughput in comparison to the first version, especially as the value size increases. It is possible to infer that the new buffer strategy delivers better performance. 5.3. Results 40 Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 652.67 1.54 85.54 32 KB 625.33 1.60 163.93 64 KB 596.67 1.68 312.83 128 KB 462.67 2.17 485.14 256 KB 295.33 3.40 619.35 512 KB 178.67 5.67 749.39 1MB 106.67 9.53 894.81 2MB 57.50 17.67 964.69 Table 7: One sided results for the RdmaCache’s new method. To support the analysis of the results, the data is represented in two-axis graphs. Figure 21 depicts the throughput results for all the tests performed in this experiment and Figure 22 depicts the response time results for the same tests. Both figures provide a visualization of the performance difference between the caches. 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 Throughput (MBits/s) Value size (kb) RDMACache Memcached RDMACache (new method) Figure 21: Throughput results for the one sided benchmark. 5.3. Results 41 0 5 10 15 20 25 30 35 0 500 1000 1500 2000 2500 Averageresponsetime(ms) Valuesize(kb) RDMACache Memcached RDMACache(newmethod) Figure 22: Response Time results for the one sided benchmark. The two-sided experiments were performed in the same environment, but are more realistic when comparing to real-world applications. In a distributed computing environment, all the nodes will need to access the cache in each others’ memory. In this experiment, the benchmark is running in both nodes. The first node is always configured to run the benchmark for 30 seconds, where the results will be recorded. The second node is configured with a longer running time to ensure the other node performs the benchmark while data is flowing in the other direction for the whole execution. The results obtained for the RDMA cache’s first method are represented in Table 8. The values show that even running in a two-sided setup, the performance is much better than what was accomplished in the proof of concept. This confirms that the buffer handling problems were solved. Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 838.66 1.19 109.92 32 KB 683.33 1.48 179.13 64 KB 463.33 2.17 242.92 128 KB 242.67 4.17 254.46 256 KB 145.33 6.95 304.78 512 KB 75.53 13.60 316.79 1MB 42.11 24.12 353.24 2MB 17.97 56.46 301.49 Table 8: Two sided results for the RdmaCache’s first method. 5.3. Results 42 Table 9represents the results obtained by running the benchmark against Memcached. These results serve as a reference to compare with the two versions of RDMA Cache. Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 1942.16 0.51 254.56 32 KB 1854.70 0.54 486.19 64 KB 1641.67 0.61 860.71 128 KB 1054.08 0.95 1105.28 256 KB 596.18 1.68 1250.28 512 KB 329.63 3.04 1382.57 1MB 160.01 6.28 1342.26 2MB 86.44 11.62 1450.22 Table 9: Two sided results for Memcached. The values presented in Table 10 correspond to the output of the benchmark when running against the RDMA cache’s final version. It is possible to notice a big improvement when compared to the first version of buffer handling. These results are much closer to the Memcached ones, even though the benchmarks were performed in an emulated environment. Packet size Throughput (op/s) Avg Response Time (ms) Throughput (MBits/s) 16 KB 1144.67 0.87 150.03 32 KB 914.67 1.09 239.78 64 KB 689.33 1.45 361.41 128 KB 467.73 2.14 490.45 256 KB 218 4.54 457.18 512 KB 135.33 7.48 567.62 1MB 72.67 14.03 609.60 2MB 34.21 29.67 573.95 Table 10: Two sided results for the RdmaCache’s new method. To support the comparison of the values presented in the above tables, the results are presented in two 2-axis graphs. Figure 23 depicts the throughput graph and Figure 24 represents the response time graph. 5.3. Results 43 0 200 400 600 800 1000 1200 1400 1600 0 500 1000 1500 2000 2500 Throughput (MBits/s) Value size (kb) RDMACache Memcached RDMACache (new method) Figure 23: Throughput results for the two sided benchmark. 0 10 20 30 40 50 60 0 500 1000 1500 2000 2500 Averageresponsetime(ms) Valuesize(kb) RDMACache Memcached RDMACache(newmethod) Figure 24: Response time results for the two sided benchmark. The emulated environment provides valuable information to determine that the new strategy for buffer handling provides better performance. In the first approach, send/recv buffers were as big as the maximum value size required it. Even though only the filled part of the buffer is transmitted, the addressing tables in the RNIC are larger and, as such, the performance is worse. In the final version’s approach, using short send/recv buffers and one data buffer whose size corresponds to the maximum value size solves this problem, as proven by the results presented by the benchmarks presented in this section. 6.2. Future work 50 The results obtained with the prototype in chapter 3are very important to understand the impact and the intricacies of buffer handling. The distributed cache has a vital role as it takes care of the buffer handling, providing an easy to use API. In the experiment with the prototype, it is possible to understand the impact of inadequate buffer handling. The benchmark and analysis of the proposed solution against one of the most used distributed caches, Memcached, corroborated that the RDMA-based distributed cache is more performant. Compiling all the experiments, it is possible to say that resorting to the presented cache improves the performance three to four times in terms of throughput and response time. In particular, if we consider the experiment with variable sized values, the Memcached’s performance decreased, and the distributed cache maintained the same average values. These results show that the distributed cache is five times more performant in this particular case, which is closer to a real-world scenario. 6.2 future work The distributed cache is a middleware, and the next step is to integrate it into a system that requires distributed caching. Regarding the scope of this dissertation, it is most useful to integrate the cache in a distributed query processing engine, for example, Apache Spark or Apache Flink. The cache is not production-ready, and it needs two enhancements to ensure its stability for a production environment. The first action is to benchmark the cache in a distributed computing framework, to understand if the performance improvements sustain in production environments. Also, fault-tolerance could be considered, resorting to redundancy, ensuring that all values stay in cache until evicted, even in the event of node failure. Apache Flink’s methods are more exposed to the development level, which allows easy integration of a new cache. As such, it is a strong candidate as a framework to evaluate the cache’s performance with an industry-standard benchmark. Currently, values are stored in one node and, if that node dies, the cache continues operational, but the values in that node are no longer available. This is a problem because the values are deleted from a fault and not from eviction. The introduction of redundancy to the cache will provide fault-tolerance in these cases and, as a result, values only disappear from the cache when evicted. These two aspects improve the cache in different fashions. The benchmark serves the purpose of determining if the cache can benefit a real-world application with easy integration. The fault-tolerance contributes to the delivery of a better product, that is production-ready and stable. BIBLIOGRAPHY [1] Supplement to infinibandTM architecture specification, annex a16: Rdma over converged ethernet (roce), volume 1, release 1.2.1. Technical report, InfinibandTM Trade Association, September 2014. [2] Supplement to infinibandTM architecture specification, annex a17: Rocev2, volume 1, release 1.2.1. Technical report, InfinibandTM Trade Association, September 2014. [3] InfinibandTM architecture specification, volume 1, release 1.3. Technical report, InfinibandTM Trade Association, March 2015. [4] Alluxio, 2018. URL http://alluxio.org/. [5] Apache Arrow - A cross-language development platform for in-memory data, 2019. URL https://arrow.apache.org/. [6] Apache Flink - Stateful Computations over Data Streams, 2018. URL https://flink. apache.org/. [7] Apache Hadoop, 2019. URL https://hadoop.apache.org/. [8] Apache Parquet, 2019. URL https://parquet.apache.org/. [9] Apache Spark - Unified Analytics Engine for Big Data, 2018. URL https://spark. apache.org/. [10] M. Chen, S. Mao, and Y. Liu. Big data: A survey. Mobile Networks and Applications,19, 04 2014. [11] J. Dean and S. Ghemawat. Mapreduce: Simplified data processing on large clusters. In OSDI’04: Sixth Symposium on Operating System Design and Implementation, pages 137– 150, San Francisco, CA, 2004. [12] A. Dragojevi´ c, D. Narayanan, M. Castro, and O. Hodson. Farm: Fast remote memory. In 11th USENIX Symposium on Networked Systems Design and Implementation (NSDI 14), pages 401–414, Seattle, WA, 2014. USENIX Association. ISBN 978-1-931971-09-6. [13] Dremio - Data-as-a-Service Platform, 2019. URL https://www.dremio.com/. 51 Bibliography 52 [14] U. Elzur, J. Carrier, R. Recio, P. Culley, and S. Bailey. Marker pdu aligned framing for tcp specification. RFC 5044, IBM Corporation and Hewlett-Packard Company and Sandburst Corporation and Broadcom Corporation, October 2007. URL https://tools.ietf.org/html/rfc5044. [15] M. Girault. Hash-functions using modulo-n operations. In D. Chaum and W. L. Price, editors, Advances in Cryptology — EUROCRYPT’ 87, pages 217–226, Berlin, Heidelberg, 1988. Springer Berlin Heidelberg. ISBN 978-3-540-39118-0. [16] J. Hilland, P. Culley, J. Pinkerton, and R. Recio. Rdma protocol verbs specification. Technical report, IBM Corporation and Hewlett-Packard Company, april 2003. URL https://tools.ietf.org/html/draft-hilland-rddp-verbs-00. [17] iWARP RDMA Here and Now. URL https://www.marvell.com/documents/ 54a11326t7lnomlwfmof/. [18] B. Jenkins. A hash function for hash table lookup, 1996. URL http://www. burtleburtle.net/bob/hash/doobs.html. [19] A. Kalia, M. Kaminsk, and D. G. Andersen. Using rdma efficiently for key-value services. ACM SIGCOMM Computer Communication Review - SIGCOMM’14,44(4):295– 306,2014. [20] D. Karger, E. Lehman, T. Leighton, M. Levine, D. Lewin, and R. Panigrahy. Consistent hashing and random trees: Distributed caching protocols for relieving hot spots on the world wide web. Proceedings of the twenty-ninth annual ACM symposium on Theory of computing. ACM STOC,02 2001. doi: 10.1145/258533.258660. [21] H. Lim, D. Han, D. G. Andersen, and M. Kaminsky. Mica: A holistic approach to fast in-memory key-value storage. USENIX NSDI,2014. [22] Memcached, 2018. URL http://memcached.org/. [23] C. Mitchell, Y. Geng, and J. Li. Using one-sided rdma reads to build a fast, cpu-efficient key-value store. USENIX ATC,2013. [24] R. Recio, B. Metzler, P. Culley, J. Hilland, and D. Garcia. A remote direct memory access protocol specification. RFC 5040, IBM Corporation and Hewlett-Packard Company, October 2007. URL https://tools.ietf.org/html/rfc5040. [25] Redis, 2018. URL https://redis.io/. [26] R. Rosen. Infiniband. In Linux Kernel Networking: Implementation and Theory, chapter 13. Apress, New York City, 2014. Bibliography 53 [27] R. Sedgewick and K. Wayne. Algorithms. 2011. [28] H. Shah, J. Pinkerton, R. Recio, and P. Culley. Direct data placement over reliable transports. RFC 5041, IBM Corporation and Hewlett-Packard Company and Microsoft Corporation and Broadcom Corporation, October 2007. URL https://tools.ietf. org/html/rfc5041. [29] M. Zaharia, M. Chowdhury, T. Das, A. Dave, J. Ma, M. McCauly, M. J. Franklin, S. Shenker, and I. Stoica. Resilient distributed datasets: A fault-tolerant abstraction for in-memory cluster computing. In Presented as part of the 9th USENIX Symposium on Networked Systems Design and Implementation (NSDI 12), pages 15–28, San Jose, CA, 2012. USENIX. ISBN 978-931971-92-8. URL https://www.usenix.org/conference/ nsdi12/technical-sessions/presentation/zaharia.