计算机科学与探索 ›› 2011, Vol. 5 ›› Issue (8): 686-694.

• 学术研究 • 上一篇    下一篇

使用固态硬盘管理主存KV数据库的虚拟内存

韩 旭, 曹 巍, 孟小峰   

  1. 中国人民大学 信息学院, 北京 100872
  • 收稿日期:1900-01-01 修回日期:1900-01-01 出版日期:2011-08-01 发布日期:2011-08-01

Virtual Memory Management for Main-Memory KV Database Using Solid State Disk

HAN Xu, CAO Wei, MENG Xiaofeng   

  1. School of Information, Renmin University of China, Beijing 100872, China
  • Received:1900-01-01 Revised:1900-01-01 Online:2011-08-01 Published:2011-08-01

摘要: 主存键值(key-value, KV)数据库具有高效性、易用性和可扩展性。由于主存容量有限, 一些数据量较大的应用必须使用磁盘进行数据交换。而固态硬盘(solid state disk, SSD)有高速的随机读特点, 使用固态硬盘作为主存KV数据库的虚拟内存会提高对不在主存中的数据的读性能。但是固态硬盘的随机写性能较差, 于是提出了针对固态硬盘的写缓冲区优化算法, 将多个随机写转化为一个连续写, 并设计了固态硬盘虚拟内存的垃圾回收机制, 将多个随机写转化为一个连续读和一个连续写, 从而提高主存KV数据库的性能。通过改写源代码, 将该虚拟内存管理应用于Redis中, 并进行了实验测试, 结果表明该虚拟内存管理的性能比原有性能最大提升了40%。

关键词: 键值, 固态硬盘, 虚拟内存, 缓冲区

Abstract: Key-value in-memory databases have the characteristics of efficiency, usability and scalability. Because of the limits of the capacity of main memory, the applications dealing with large amount of data have to swap data between main memory and disks. While solid state disks (SSDs) have the high performance of random reads as a new storage medium, they can speed up random reads on virtual memory. To remedy the lower performance of random writes on SSDs, this paper proposes an optimization method of write buffer of SSD, which transforms several random writes to a sequential write, and designs a garbage collection policy of SSD, which transforms several random writes to a sequential read and a sequential write, to improve the spatial utilization of key-value in-memory database. Finally, an SSD-based virtual memory implementation is proposed to realize high performance of key-value main memory data-bases, and the improvement which is at most 40%, is confirmed by changing the source code of Redis in experiment.

Key words: key-value, solid state disk (SSD), virtual memory, buffer