Abstract
Non-volatile memory (NVM) has byte-addressability and data-durability. Redis, a popular in-memory kv-store system, can persist data when replacing DRAM with NVM. However, to implement NVM Redis, we need to use general NVM allocators to obtain NVM and guarantee the data consistency of Redis. There are two problems in NVM Redis. First, it is expensive to directly use NVM allocators with numerous metadata modification and logging. Second, logging which is also used to guarantee the data consistency of NVM Redis leads to write amplification and degrades the run-time performance of Redis. In this paper, we find that these two problems can be solved by exploiting memory caching inside Redis under NVM. Firstly, memory caching like the well-known Linux Slab will cache freed memory, reducing expensive NVM allocation/deallocation. Secondly, by recording all allocated NVM, caching can handle the persistent memory leak of Redis, which is the only inconsistent state induced by failures. Thus, the use of logging in NVM Redis can be avoided by using memory caching. In this paper, we propose an NVM caching called LFSlab (Log-Free Slab), while the conventional Slab needs logging to guarantee its consistency under NVM. Using LFSlab, we propose NCRedis (NVM Caching Redis) under NVM. In the experiment with Optane persistent memory, Redis with LFSlab outperforms the naive implementation of NVM Redis with no caching by 1.52-2.65x and DRAM Redis with data backup in disks by 1.27x, and gets at least 94% performance of DRAM-only Redis, while Optane persistent memory is 2-3x slower than DRAM at a 39% cost savings.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Bhandari, K., Chakrabarti, D.R., Boehm, H.J.: Makalu: fast recoverable allocation of non-volatile memory. ACM SIGPLAN Not. 51(10), 677–694 (2016)
Bonwick, J., et al.: The slab allocator: An object-caching kernel memory allocator. In: USENIX Summer, vol. 16. Boston (1994)
Cai, W., Wen, H., Beadle, H.A., Kjellqvist, C., Hedayati, M., Scott, M.L.: Understanding and optimizing persistent memory allocation. In: Proceedings of the 2020 ACM SIGPLAN International Symposium on Memory Management, pp. 60–73 (2020)
Carlson, J.: Redis in Action. Simon and Schuster, New York (2013)
Liu, J., Chen, S., Wang, L.: Lb+ Trees: optimizing persistent index performance on 3dxpoint memory. Proc. VLDB Endow. 13(7), 1078–1090 (2020)
Oukid, I., Lasperas, J., Nica, A., Willhalm, T., Lehner, W.: FPTree: a hybrid SCM-DRAM persistent and concurrent b-tree for storage class memory. In: Proceedings of the 2016 International Conference on Management of Data, pp. 371–386 (2016)
Scargall, S.: Programming Persistent Memory: A Comprehensive Guide for Developers (2020)
Schwalb, D., Berning, T., Faust, M., Dreseler, M., Plattner, H.: nvm malloc: memory allocation for NVRAM. ADMS@VLDB 15, 61–72 (2015)
Acknowledgements
We thank NetEase for providing the machine with Optane persistent memory. The corresponding author of this work is Jianlin Feng. This work is partially supported by China NSFC under Grant No. 61772563.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Zhang, J., Yao, Z., Feng, J. (2021). NCRedis: An NVM-Optimized Redis with Memory Caching. In: Strauss, C., Kotsis, G., Tjoa, A.M., Khalil, I. (eds) Database and Expert Systems Applications. DEXA 2021. Lecture Notes in Computer Science(), vol 12924. Springer, Cham. https://doi.org/10.1007/978-3-030-86475-0_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-86475-0_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-86474-3
Online ISBN: 978-3-030-86475-0
eBook Packages: Computer ScienceComputer Science (R0)