Enabling Efficient OS Paging for Main-Memory OLTP Databases

Enabling Efficient OS Paging for Main-Memory OLTP Databases

Enabling Efficient OS Paging for Main-Memory OLTP Databases Radu Stoica Anastasia Ailamaki École Polytechnique Fédérale de Lausanne École Polytechnique Fédérale de Lausanne radu.stoica@epfl.ch anastasia.ailamaki@epfl.ch ABSTRACT Hana[7]). Such systems assume all data resides in RAM Even though main memory is becoming large enough to fit and explicitly eliminate traditional disk optimizations that most OLTP databases, it may not always be the best option. are deemed to introduce an unacceptable large overhead. OLTP workloads typically exhibit skewed access patterns Today storage technology trends have changed - along where some records are hot (frequently accessed) but many with the large main memory of modern servers, we have records are cold (infrequently or never accessed). Therefore, solid-state drives (SSDs) that can support hundreds of thou- it is more economical to store the coldest records on a fast sands of IOPS. In recent years, the capacity improvements of secondary storage device such as a solid-state disk. How- NAND flash-based devices outpaced DRAM capacity growth, ever, main-memory DBMS have no knowledge of secondary accompanied by corresponding trends in cost per gigabyte. storage, while traditional disk-based databases, designed for In addition, major hardware manufacturers are investing workloads where data resides on HDD, introduce too much in competing solid-state technologies such as Phase-Change overhead for the common case where the working set is mem- Memory. ory resident. In OLTP workloads, record accesses tend to be skewed: In this paper, we propose a simple and low-overhead tech- some records are ”hot”and accessed frequently (the working nique that enables main-memory databases to efficiently mi- set), others are ”cold”and accessed infrequently. Hot records grate cold data to secondary storage by relying on the OS’s should reside in memory to guarantee good performance; virtual memory paging mechanism. We propose to log ac- cold records, however, can be moved to cheaper external cesses at the tuple level, process the access traces o✏ine solid-state storage. to identify relevant access patterns, and then transparently Ideally, we want a DBMS that: a) has high performance, re-organize the in-memory data structures to reduce paging characteristic of main-memory databases, when the working I/O and improve hit rates. The hot/cold data separation set fits in RAM, and b) the ability of a traditional disk-based is performed on demand and incrementally through careful database engine to keep cold data on the larger and cheaper memory management, without any change to the underly- storage media, while supporting, as efficiently as possible, ing data structures. We validate experimentally the data the infrequent cases where data needs to be retrieved from re-organization proposal and show that OS paging can be ef- secondary storage. ficient: a TPC-C database can grow two orders of magnitude There is no straightforward solution as DBMS engines op- larger than the available memory size without a noticeable timized for in-memory processing have no knowledge of sec- impact on performance. ondary storage. Traditional storage optimizations, such as the bu↵er pool abstraction, the page organization, certain data structures (e.g. B-Trees), and ARIES-style logging are 1. INTRODUCTION explicitly discarded in order to reduce overhead. At the Database systems have been traditionally designed under same time, switching back to a traditional disk-based DBMS the assumption that most data is disk resident and is paged would forfeit the fast processing benefits of main-memory in and out of memory as needed. However, the drop in systems. memory prices over the past 30 years led several database In this paper, we take the first step toward enabling a engines to optimize for the case when all data fits in memory. main-memory database to migrate data to a larger and cheaper Examples include both research systems (MonetDB[6], H- secondary storage. We propose to record accesses during Store[13], Hyper[14], Hyrise [11]) and commercial systems normal system runtime at the tuple level (possibly using (Oracle’s TimesTen[2], IBM’s SolidDB [1], VoltDB[4], SAP sampling to reduce overhead) and process the access traces o↵ the critical path of query execution in order to identify data worth storing in memory. Based on the access statis- Permission to make digital or hard copies of all or part of this work for tics, the relational data structures are re-organized such that personal or classroom use is granted without fee provided that copies are the hot tuples are stored as compactly as possible, which not made or distributed for profit or commercial advantage and that copies leads to improved main memory hit rates and to reduced bear this notice and the full citation on the first page. To copy otherwise, to OS paging I/O. The data re-organization is unintrusive since republish, to post on servers or to redistribute to lists, requires prior specific only the location of tuples in memory changes, while the permission and/or a fee. internal pointer structure of existing data-structures and DaMoN ’13 Copyright 2013 ACM Copyright 2013 ACM 978-1-4503-2196-9/13/06 query execution remain una↵ected. In addition, the data ...$15.00. 3GB RAM 18GB RAM 62GB RAM DBMS engine 35 3 Process access logs 2 Write access Query 1 Sample accesses logs Monitoring process 30 Access logs Writer thread a) Access frequency B) Memory allocation 25 Data-structures c) Misplaced tuples 20 15 Heap files Binary trees Hash Indexes Hot 10 Network Start of swapping on FusionIO SSD Cold Transactions/sec (1000s)Transactions/sec 5 Insert/delete trx. Read optimal tuple 0 4 Storage 5 Re-organization placement 0 20 40 60 80 100 120 140 160 180 200 220 Database size (GB) Figure 2: System Architecture Figure 1: VoltDB throughput when paging to a SSD re-organization is performed incrementally and only when minutes. In addition to the price, the maximum memory required by the workload. capacity of a server or the memory density can both pose We implement the data re-organization proposal in a state- challenges. Today, a high-end workstation can fits at most of-art, open source main-memory database, VoltDB [4]. Our 4TB of main memory, servers can handle around 256GB of experimental results show that a TPC-C database can grow DRAM per CPU socket, while a 1U rack slot hosts less than 50 larger than the available DRAM memory without a 512GB of DRAM. noticeable⇥ impact on performance or latency, and present micro-benchmark results that indicate that a system can de- liver reasonable performance even in cases where the work- 2.2 Skewed Accesses in OLTP workloads ing set does not fully fit in memory and secondary storage Real-life transactional workloads typically exhibit consid- data is frequently accessed. erable access skew. For example, package tracking workloads In this paper we make the following contributions: for companies such as UPS or FedEx exhibit time-correlated skew. Records for a new package are frequently updated un- 1. We profile the performance of a state-of-art main-memory til delivery, then used for analysis for some time, and after DBMS and identify its inefficiencies in moving data to sec- are accessed only on rare occasions. Another example is ondary storage. the natural skew found on large e-commerce sites such as 2. We propose an unintrusive data re-organization strat- Amazon, where some items are much more popular than egy that separates hot from cold data with minimal over- others are or where some users are much more active than head and allows the OS to efficiently page data to a fast the average. Such skewed accesses may change over time solid-state storage device. but typically not very rapidly (the access skews might shift 3. We implement the data re-organization technique in a over days rather than seconds). state-of-art database and show that it can support a TPC- C dataset that grows 50 bigger than the available physical 2.3 Existing DBMS Architectures memory without a significant⇥ impact on throughput or la- tency. 2.3.1 Disk-based DBMS. The remaining of this document is organized as follows. One possible option is to use a disk-based database archi- Section 2 details the motivation for our work; Section 3 de- tecture that optimizes for the case data is on secondary stor- scribes the architecture of the data re-organization proposal, age. Traditional DBMS pack data in fixed-size pages, use which is validated experimentally in Section 4; Section 5 sur- logical pointers (e.g. page IDs and record o↵sets) that al- veys the related work and, finally, Section 6 concludes. lows the bu↵er pool abstraction to move data between mem- ory and storage transparently, and have specialized page re- 2. MOTIVATION placement algorithms to maximize hit rates and reduce I/O Our work is motivated by several considerations: i) by latency. hardware trends that make storing data on solid-state stor- However, given current memory sizes and the lower la- age attractive; ii) by the workload characteristics of OLTP tency of SSDs compared to HDDs, such optimizations might databases; and iii) by the inefficiencies of existing systems, not be desirable. Stonebraker et al. [20] introduced a main- either traditional disk-based databases or newer main-memory memory database that is two orders of magnitude faster than optimized DBMS. a general purpose disk-based DBMS, while Harizopoulos et al. [12] showed that for transactional workloads the bu↵er 2.1 Hardware trends pool introduces a significant amount of CPU overhead: more It is significantly cheaper to store cold data on secondary than 30% of execution time is wasted due to extra indirec- storage rather than in DRAM.

View Full Text

Details

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

Download

Channel Download Status
Express Download Enable

Copyright

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

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

Support

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