[go: up one dir, main page]

CN113485946A - Persistent memory key value system and operation method thereof - Google Patents

Persistent memory key value system and operation method thereof Download PDF

Info

Publication number
CN113485946A
CN113485946A CN202011218384.6A CN202011218384A CN113485946A CN 113485946 A CN113485946 A CN 113485946A CN 202011218384 A CN202011218384 A CN 202011218384A CN 113485946 A CN113485946 A CN 113485946A
Authority
CN
China
Prior art keywords
key
value pair
metadata
persistent memory
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011218384.6A
Other languages
Chinese (zh)
Other versions
CN113485946B (en
Inventor
舒继武
汪庆
屠要峰
杨洪章
韩银俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tsinghua University
ZTE Corp
Original Assignee
Tsinghua University
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tsinghua University, ZTE Corp filed Critical Tsinghua University
Priority to CN202011218384.6A priority Critical patent/CN113485946B/en
Publication of CN113485946A publication Critical patent/CN113485946A/en
Priority to PCT/CN2021/124463 priority patent/WO2022095685A1/en
Application granted granted Critical
Publication of CN113485946B publication Critical patent/CN113485946B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • G06F12/0261Garbage collection, i.e. reclamation of unreferenced memory using reference counting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a persistent memory key value system and an operation method thereof, wherein the operation method comprises the following steps: searching an index of a persistent memory key value system to locate key value pair metadata to be inserted; acquiring write lock resources corresponding to the key value pair metadata in a dynamic random access memory; allocating a persistent memory to the key-value pair metadata and persisting the key-value pair metadata; atomically inserting the key-value pair metadata in the persistent memory key-value system. By the method and the device, in the key value pair insertion operation process, any write to the persistent memory is not introduced to the write lock resource operation, any log operation is not needed, the insertion operation performance is improved, and the expansibility under a multi-core architecture is improved.

Description

Persistent memory key value system and operation method thereof
Technical Field
The embodiment of the invention relates to the technical field of persistent memory storage, in particular to a persistent memory key value system and an operation method thereof.
Background
Persistent Memory (Persistent Memory) has similar performance to Dynamic Random Access Memory (DRAM) and supports byte-granular addressing; meanwhile, the persistent memory can store data persistently like a magnetic disk. For example, existing persistent memory products have sub-microsecond latency and a single maximum capacity of 512GB, which presents many opportunities for new memory storage systems. Existing persistent memory supports two modes: a direct access mode and a memory mode are applied. And abstracting the persistent memory into special storage equipment which can be directly read and written through load and store instructions by applying a direct access mode. In memory mode, DRAM acts as a cache for persistent memory, providing an abstraction of large memory for applications, but without storage capability.
Most modern servers are of a multi-core architecture, that is, one processor contains dozens or even hundreds of CPU cores, so as to improve the concurrency performance of the whole system. However, the multi-core architecture presents a problem of concurrency control, i.e., how efficiently and correctly threads on different CPU cores concurrently access data.
The existing persistent memory key value system is not designed for a multi-core architecture, so that a plurality of problems are caused. First, concurrent primitives (e.g., read-write locks) that guarantee correct execution of multiple threads cause data to jitter back and forth between caches of different CPU cores, frequently triggering inefficient cache coherency protocols, and severely impacting CPU performance. Secondly, the write bandwidth of the persistent memory is very low, the single write bandwidth is only about 2.3GB/s, which is about 1/6 of DRAM, and various consistency mechanisms (such as logs) adopted by the key value system for ensuring crash consistency can consume extra write bandwidth of the persistent memory; meanwhile, the read-write lock is usually embedded inside the data structure, and the cache jitter caused by the read-write lock also causes write-back of a large amount of persistent memory. Finally, due to the high read latency and persistence latency of persistent memory, the time of critical sections is lengthened, causing the conflicting operations among different threads to be severely blocked.
Disclosure of Invention
The embodiment of the invention provides a persistent memory key value system and an operation method thereof, which at least solve the problem of low operation performance caused by the fact that the existing persistent memory key value system in the related art is not designed for a multi-core architecture.
According to an embodiment of the present invention, there is provided an operating method of a persistent memory key-value system, the method including: searching an index of a persistent memory key value system to locate key value pair metadata to be inserted; acquiring write lock resources corresponding to the key value pair metadata in a dynamic random access memory; allocating a persistent memory to the key-value pair metadata and persisting the key-value pair metadata; atomically inserting the key-value pair metadata into the persistent memory key value system, wherein the submission process of the key-value pair metadata insertion comprises two stages, in the first stage, emptying a persistent flag bit in the key-value pair metadata, and calling a CPU persistent instruction to write the persistent flag bit from a CPU cache to a persistent memory; in the second phase, the persistence flag is set and the read operation is notified that the key-value pair metadata has been successfully persisted.
In an exemplary embodiment, before acquiring the write lock resource corresponding to the key-value pair metadata in the dynamic random access memory, the method further includes; separating the write lock resource from an index of a persistent memory key value system, and maintaining the write lock resource in the dynamic random access memory.
In one exemplary embodiment, the write lock resource is maintained in the dynamic random access memory in a table structure, wherein an input of the table structure is an indexed node address and an output of the table structure is the corresponding write lock resource.
In an exemplary embodiment, before atomically inserting the key-value pair metadata in the persistent memory key-value system, the method further comprises: storing the key-value pair metadata in an atomically modifiable format.
In an exemplary embodiment, the atomically modifiable format means that the key-value pair metadata is wrapped into a continuous persistent memory space and is supported for atomic modification by the CPU.
In an exemplary embodiment, when the conflicting first insert operation and second insert operation occur simultaneously, the first insert operation is returned without allocating and writing persistent memory to the first insert operation.
In one exemplary embodiment, the key-value pair metadata includes at least one of: a key-value pair fingerprint, a key-value pair address, and a persistence flag bit; wherein the key-value pair fingerprint is a number of bits of a hash value of a key, the key-value pair address points to a key-value pair in persistent memory, and the persistent flag bit indicates a persistent state of the key-value pair metadata.
In one exemplary embodiment, after atomically inserting the key-value pair metadata into the persistent memory key-value system, further comprising: querying the key-value pair metadata in the persistent memory key-value system without a lock.
In one exemplary embodiment, querying the key-value pair metadata without a lock comprises: checking a persistence flag bit in the key-value pair metadata, and calling a CPU persistence instruction to persist the target key-value pair metadata if the persistence flag bit is in a clear state; and calling an atomic instruction to set the persistent flag bit and read the key-value pair pointed by the metadata.
In one exemplary embodiment, the method further comprises: and periodically recovering the persistent memory garbage through the background thread based on a memory recovery mode of a time period.
According to another embodiment of the present invention, there is provided a persistent memory key-value system, including: the searching module is used for searching the index of the persistent memory key value system to locate the key value pair metadata to be inserted; the acquisition module is used for acquiring write lock resources corresponding to the key value pair metadata in the dynamic random access memory; the allocation module is used for allocating a persistent memory for the key-value pair metadata and persisting the key-value pair metadata; the insertion module is used for atomically inserting the key-value pair metadata into the key-value system of the persistent memory, wherein the submission process of the key-value pair metadata insertion comprises two stages, in the first stage, a persistent flag bit in the key-value pair metadata is cleared, and a CPU persistent instruction is called to flush the persistent flag bit from a CPU cache to the persistent memory; in the second phase, the persistence flag is set and the read operation is notified that the key-value pair metadata has been successfully persisted.
In one exemplary embodiment, the system further comprises: and the maintenance module is used for separating the write lock resource from the index of the persistent memory key value system and maintaining the write lock resource in the dynamic random access memory.
In one exemplary embodiment, the system further comprises: a storage module to store the key-value pair metadata in an atomically modifiable format.
In one exemplary embodiment, the system further comprises: and the query module is used for querying the key-value pair metadata in the persistent memory key-value system without lock.
In one exemplary embodiment, the system further comprises: and the recovery module is used for periodically recovering the persistent memory garbage through the background thread based on a memory recovery mode of a time period.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
Through the embodiment of the invention, in the inserting operation process of the key value pair, the operation on the write lock resource does not introduce any writing on the persistent memory, and any log operation is not needed, so that the inserting operation performance is improved, and the expansibility under a multi-core architecture is improved.
Drawings
FIG. 1 is a flow diagram of a method of operation of a persistent memory key-value system according to an embodiment of the present invention;
FIG. 2 is a block diagram of a persistent memory key-value system according to an embodiment of the present invention;
FIG. 3 is a block diagram of a persistent memory key-value system according to another embodiment of the present invention;
FIG. 4 is a schematic diagram of a multi-core architecture-friendly persistent memory key-value system, according to one embodiment of the present invention;
FIG. 5 is a schematic diagram of a structure of key-value pair metadata according to an embodiment of the present invention;
FIG. 6 is a flowchart of an insert operation of a multi-core architecture-friendly persistent memory key-value system according to an embodiment of the present invention;
FIG. 7 is a flowchart of a query operation of a multi-core architecture-friendly persistent memory key-value system according to an embodiment of the present invention;
fig. 8 is a schematic diagram of the elimination of two concurrent collision insertion operations according to an embodiment of the present invention.
Detailed Description
Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Example 1
In this embodiment, an operation method of a persistent memory key value system is provided, and fig. 1 is a flowchart according to an embodiment of the present invention, where as shown in fig. 1, the flowchart includes the following steps:
step S102, searching an index of a persistent memory key value system to locate key value pair metadata to be inserted;
step S104, acquiring write lock resources corresponding to the key value pair metadata in the dynamic random access memory;
step S106, allocating a persistent memory for the key-value pair metadata and persisting the key-value pair metadata;
step S108, the key value pair metadata are atomically inserted into the key value system of the persistent memory, wherein the submission process of the key value pair metadata insertion comprises two stages, in the first stage, a persistent flag bit in the key value pair metadata is cleared, and a CPU persistent instruction is called to flush the persistent flag bit from a CPU cache to the persistent memory; in the second phase, the persistence flag is set and the read operation is notified that the key-value pair metadata has been successfully persisted.
Before step S104 in this embodiment, the method may further include; separating the write lock resource from an index of a persistent memory key value system, and maintaining the write lock resource in the dynamic random access memory.
In this embodiment, the write lock resource may be maintained in the dynamic random access memory in a table structure, where an input of the table structure is an indexed node address, and an output of the table structure is the corresponding write lock resource.
Before step S108 in this embodiment, the method may further include: storing the key-value pair metadata in an atomically modifiable format.
In this embodiment, the atomically modifiable format means that the key-value pair metadata is wrapped into a continuous persistent memory space and supported to be atomically modified by the CPU.
In this embodiment, when the conflicting first insert operation and second insert operation occur simultaneously, the first insert operation is returned without performing allocation and writing of the persistent memory to the first insert operation.
In this embodiment, the key-value pair metadata includes at least one of: a key-value pair fingerprint, a key-value pair address, and a persistence flag bit; wherein the key-value pair fingerprint is a number of bits of a hash value of a key, the key-value pair address points to a key-value pair in persistent memory, and the persistent flag bit indicates a persistent state of the key-value pair metadata.
After step S108 of the present embodiment, the method may further include: querying the key-value pair metadata in the persistent memory key-value system without a lock.
In this embodiment, querying the key-value pair metadata without a lock may include: checking a persistence flag bit in the key-value pair metadata, and calling a CPU persistence instruction to persist the target key-value pair metadata if the persistence flag bit is in a clear state; and calling an atomic instruction to set the persistent flag bit and read the key-value pair pointed by the metadata.
In this embodiment, the method may further include: and periodically recovering the persistent memory garbage through the background thread based on a memory recovery mode of a time period.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
In this embodiment, a persistent memory key value system is further provided, and the system is used to implement the foregoing embodiments and preferred embodiments, and the description of which has been already made is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 2 is a block diagram of a persistent memory key value system according to an embodiment of the present invention, and as shown in fig. 2, the system includes a lookup module 10, an acquisition module 20, an allocation module 30, and an insertion module 40.
The searching module 10 is configured to search an index of the persistent memory key value system to locate key value pair metadata to be inserted.
An obtaining module 20, configured to obtain a write lock resource in the dynamic random access memory, where the write lock resource corresponds to the key-value pair metadata.
An allocating module 30, configured to allocate a persistent memory to the key-value pair metadata and persist the key-value pair metadata.
An inserting module 40, configured to insert the key-value-pair metadata into the persistent memory key-value system atomically, where a submitting process of the key-value-pair metadata insertion includes two stages, and in a first stage, a persistent flag bit in the key-value-pair metadata is cleared, and a CPU persistent instruction is called to flush the persistent flag bit from a CPU cache to a persistent memory; in the second phase, the persistence flag is set and the read operation is notified that the key-value pair metadata has been successfully persisted.
Fig. 3 is a block diagram of a persistent memory key-value system according to another embodiment of the present invention, and as shown in fig. 3, the system includes a maintenance module 50, a storage module 60, a query module 70, and a recycle module 80 in addition to all the modules shown in fig. 2.
A maintaining module 50, configured to separate the write lock resource from an index of a persistent memory key-value system, and maintain the write lock resource in the dynamic random access memory.
A storage module 60 for storing the key-value pair metadata in an atomically modifiable format.
A query module 70 configured to query the key-value pair metadata in the persistent memory key-value system without lock.
The recovery module 80 is configured to periodically recover persistent memory garbage through a background thread in a memory recovery manner based on a time period.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
In order to facilitate understanding of the technical solutions provided by the present invention, the following detailed description will be made with reference to embodiments of specific scenarios.
Example 3
Fig. 4 is a schematic diagram of a multi-core architecture-friendly persistent memory key value system according to an embodiment of the present invention. As shown in fig. 4, based on the multi-core architecture-friendly persistent memory key value system of the present embodiment, the following insertion and query operations may be performed:
s1, separating the write lock resource from the index of the persistent memory key value system, and maintaining the write lock resource in the dynamic random access memory;
s2, storing the key-value pair metadata into an atomically modifiable format, atomically switching the system from one coherency state to another coherency state (two-phase atomic insertion) when an insert operation occurs using the atomic instructions of the CPU;
s3, when two conflict insert operations occur at the same time, one operation is returned directly without any allocation and writing of the persistent memory (concurrent insert elimination);
s4, when a query operation occurs, the key-value data is read without lock.
In this embodiment, the write lock resource is used to control multiple concurrent insert operations.
Further, in one embodiment of the invention, the write lock resources in the dynamic random access memory are maintained in a table structure with the table structure input being the node address of the index and the output being the corresponding lock resource.
Specifically, for example, the table structure of write lock resources is an array of 4096 64-bit lock fields; since the lock table only occupies 32KB of space, it can be cached in a high speed CPU second level cache with little introduction of TLB misses. Notably, the table structure may introduce a pseudo conflict, i.e., different inodes contend for the same lock field. But since the true load is mostly query intensive and the query operation is lock-free, the probability of false collisions is very low.
It should be noted that, the conventional persistent memory key-value system embeds the write lock into the persistent index, which may cause various problems: firstly, the lock operation brings extra write of the persistent memory, and consumes the limited bandwidth of the persistent memory; second, when the key-value system crashes and restarts, the entire index needs to be scanned, clearing the contents of the lock fields. The invention maintains the lock resources in the DRAM, reduces the consumption of the bandwidth of the persistent memory and improves the recovery performance at the same time.
Further, in one embodiment of the invention, the metadata of the key-value pair includes a key-value pair fingerprint, a key-value pair address, and a persistence flag bit, wherein the key-value pair fingerprint is bits of a hash value of the key, the key-value pair address points to a key-value pair in a persistence memory, and the persistence flag bit indicates a persistence state of the key-value pair metadata.
In particular, key-value pair fingerprints are used to speed up the positioning of key-value pairs. When the fingerprints are not matched, the query operation can directly skip the corresponding key-value pair metadata, so that the key-value pair in the persistent memory is prevented from being read for one time. When the persistence flag bit is 0, the key value pair metadata is not persisted; otherwise, it is successfully persisted. Key-value metadata is typically stored in indexes including hash tables, B + trees, dictionary trees, and the like.
Further, in one embodiment of the invention, an atomically modifiable format means that the key-value pair metadata is wrapped into a continuous persistent memory space and supported to be atomically modified by the CPU.
Specifically, fig. 5 is a schematic structural diagram of key-value pair metadata according to an embodiment of the present invention. As shown in FIG. 5, the key-value pair metadata is 64 bits, with the highest 16 bits storing the key-value pair fingerprint, the middle 47 bits storing the key-value pair address, and the lowest 1 bit storing the persistence flag bit. The reason why the highest 16 bits and the lowest bit can store additional information is that: first, the virtual address space of the intel processor has only the low 48 bits, and second, the key-value system assigns a persistent memory address that is 8-byte aligned (i.e., the lowest 3 bits of the address are 0). The CPU may atomically manipulate 64-bit key-value pair metadata.
Further, in one embodiment of the invention, the coherency state means that the metadata of the key value system and the inserted key value pairs may be in a one-to-one correspondence and permanently stored in persistent memory.
Further, in an embodiment of the present invention, the commit process of the insert operation includes two stages, where the first stage clears the persistent flag bit in the key-value pair metadata and invokes a CPU persistent instruction to flush it from the CPU cache to the persistent memory; in the second phase, a persistence flag bit is set to inform a read operation that the key-value pair metadata has been successfully persisted.
Fig. 6 is a flowchart of an insert operation of a multi-core architecture-friendly persistent memory key value system according to an embodiment of the present invention, and as shown in fig. 6, the insert operation may include the following steps:
step S601, searching indexes and positioning key value pair metadata;
step S602, acquiring corresponding lock resources in the DRAM;
step S603, allocating a persistent memory and persisting key value pairs;
step S604, the submission process of the key-value pair metadata insertion comprises two stages, wherein in the first stage, the persistent flag bit in the key-value pair metadata is cleared, and a CPU persistent instruction is called to flush the persistent flag bit from the CPU cache to a persistent memory;
step S605, in the second phase of the submission of the insert operation, sets the persistence flag bit, and notifies the read operation that the key-value pair metadata has been successfully persisted.
As shown in FIG. 6, prior to the commit process, the insert operation successfully acquires the corresponding lock resources in DRAM and allocates persistent memory and persists the inserted key-value pair. For example, on an Intel CPU, the persistence instructions include CLFLUSH, CLWB, and CLFLUSHOPT. Assignment of key-value pair metadata in both phases of submission is atomic; in the first phase, the entire new key-value pair metadata value is written and persisted. Depending on the atomic write provided by the CPU, the consistency of the insertion operation is protected without a mechanism such as a log.
Further, in an embodiment of the present invention, in the lock-free query process of the query operation, the persistent flag bit in the target key-value pair metadata is checked, if the persistent flag bit is in a clear state, the CPU persistent instruction persistent key-value pair metadata is called, and then the atomic instruction is called to set the persistent flag bit.
Fig. 7 is a flowchart of a query operation of a multi-core architecture-friendly persistent memory key-value system according to an embodiment of the present invention, where, as shown in fig. 7, the query operation may include the following steps:
step S701, searching indexes and positioning target key value pair metadata;
step S702, judging whether the persistent flag bit of the target key value pair metadata is in an empty state, if so, executing step S703, and if not, executing step S705;
step S703, calling a CPU persistence instruction to persist the target key value pair metadata;
step S704, calling an atomic instruction CAS (compare-and-swap) to set a persistent flag bit;
step S705, the target key-value pair pointed to by the metadata is read.
As shown in fig. 7, in the process of query operation, when the persistence flag bit of the target key value pair metadata is in a clear state, it represents that the metadata has not been successfully persisted, and in order to ensure that the query operation does not read uncommitted data, the query operation actively persists the metadata, and calls an atomic instruction to set the persistence flag bit. The active persistence mechanism ensures that all key-value pair metadata do not need to be traversed to set the persistence flag after a system crash restarts.
Fig. 8 is a schematic diagram illustrating the elimination of two concurrent conflict insertion operations according to an embodiment of the present invention. As shown in fig. 8, in this embodiment, when two concurrent conflicting insert operations occur, one of the operations returns directly without any allocation and modification of persistent memory. This mechanism of eliminating operations does not violate the correct concurrency semantics because the execution results of two operations that overlap in time are equivalent to the execution results in some serial order in the definition of linearization (linearization).
Further, in an embodiment of the present invention, for the problem of lock-free reading of the query operation, an Epoch (time period) -based memory reclamation method is used, and the background thread is used to periodically reclaim the memory garbage.
Specifically, the key-value system maintains a global counter while each thread maintains a local counter. Each key value operation begins by updating a local counter to a global counter. When the persistent memory space needs to be released, the value of the local counter and the released memory address are recorded in the recovery linked list. Meanwhile, a background thread periodically adds 1 to the global counter, collects the local counter values of all threads, calculates the minimum value and records the minimum value as Safe-Epoch; at this time, all the memory smaller than Safe-Epoch in the recycle linked list can be safely released.
In the insertion operation process of the embodiment of the invention, the operation on the write lock resource does not introduce any write on the persistent memory, and any log operation is not needed, so that the insertion operation performance is improved. In addition, when multiple concurrent conflicting insert operations occur, persistent memory allocation and writing is further reduced. Aiming at query operation, the lock-free process greatly improves the concurrent query performance of a key value system under a multi-core architecture while ensuring correct semantics.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (17)

1.一种持久性内存键值系统的操作方法,其特征在于,包括:1. an operation method of a persistent memory key-value system, characterized in that, comprising: 查找持久性内存键值系统的索引以定位待插入的键值对元数据;Look up the index of the persistent memory key-value system to locate the key-value pair metadata to be inserted; 获取动态随机存取存储器中与所述键值对元数据对应的写锁资源;obtaining the write lock resource corresponding to the key-value pair metadata in the dynamic random access memory; 为所述键值对元数据分配持久性内存,并持久化所述键值对元数据;Allocating persistent memory for the key-value pair metadata, and persisting the key-value pair metadata; 在所述持久性内存键值系统中原子地插入所述键值对元数据,其中,所述键值对元数据插入的提交过程包括两个阶段,在第一阶段中,将所述键值对元数据中持久性标志位清空,并调用CPU持久化指令将其从CPU缓存刷写至持久性内存;在第二阶段中,设置所述持久性标志位,并通知读操作所述键值对元数据已经被成功持久化。The key-value pair metadata is atomically inserted into the persistent memory key-value system, wherein the commit process of the key-value pair metadata insertion includes two stages. Clear the persistent flag bit in the metadata, and call the CPU persistent instruction to flush it from the CPU cache to persistent memory; in the second stage, set the persistent flag bit and notify the read operation of the key value The metadata has been successfully persisted. 2.根据权利要求1所述的方法,其特征在于,在获取动态随机存取存储器中与所述键值对元数据对应的写锁资源之前,还包括;2. The method according to claim 1, wherein before acquiring the write lock resource corresponding to the key-value pair metadata in the dynamic random access memory, the method further comprises: 将所述写锁资源从持久性内存键值系统的索引中分离,并在所述动态随机存取存储器中维护所述写锁资源。The write lock resource is decoupled from the index of the persistent memory key-value system, and the write lock resource is maintained in the dynamic random access memory. 3.根据权利要求2所述的方法,其特征在于,其中,所述写锁资源在所述动态随机存取存储器中以表结构被维护,其中,所述表结构的输入为索引的节点地址,所述表结构的输出为对应的所述写锁资源。3. The method according to claim 2, wherein the write lock resource is maintained in a table structure in the dynamic random access memory, wherein the input of the table structure is the node address of the index , the output of the table structure is the corresponding write lock resource. 4.根据权利要求1所述的方法,其特征在于,在所述持久性内存键值系统中原子地插入所述键值对元数据之前,还包括:4. The method of claim 1, wherein before atomically inserting the key-value pair metadata in the persistent memory key-value system, further comprising: 将所述键值对元数据存储为可原子修改的格式。The key-value pair metadata is stored in an atomically modifiable format. 5.根据权利要求4所述的方法,其特征在于,所述可原子修改的格式指所述键值对元数据被包装到连续的持久性内存空间,并支持被CPU原子地修改。5. The method of claim 4, wherein the atomically modifiable format means that the key-value pair metadata is packaged into a contiguous persistent memory space and supports atomic modification by the CPU. 6.根据权利要求1所述的方法,其特征在于,还包括:6. The method of claim 1, further comprising: 当相冲突的第一插入操作和第二插入操作同时发生时,不对所述第一插入操作进行持久性内存的分配和写入,将所述第一插入操作返回。When the conflicting first insert operation and the second insert operation occur at the same time, the persistent memory allocation and writing are not performed for the first insert operation, and the first insert operation is returned. 7.根据权利要求1所述的方法,其特征在于,其中,所述键值对元数据至少包括以下之一:键值对指纹、键值对地址以及持久化标志位;其中,所述键值对指纹为键的哈希值的其中若干位,所述键值对地址指向持久性内存中的键值对,所述持久性标志位指示所述键值对元数据的持久化状态。7. The method according to claim 1, wherein the key-value pair metadata comprises at least one of the following: a key-value pair fingerprint, a key-value pair address, and a persistent flag; wherein the key The fingerprint of the value pair is several bits of the hash value of the key, the address of the key-value pair points to the key-value pair in the persistent memory, and the persistence flag bit indicates the persistent state of the metadata of the key-value pair. 8.根据权利要求1所述的方法,其特征在于,在将所述键值对元数据原子地插入所述持久性内存键值系统之后,还包括:8. The method of claim 1, further comprising: after atomically inserting the key-value pair metadata into the persistent memory key-value system 在所述持久性内存键值系统中无锁地查询所述键值对元数据。The key-value pair metadata is queried lock-free in the persistent memory key-value system. 9.根据权利要求8所述的方法,其特征在于,其中,无锁地查询所述键值对元数据包括:9. The method of claim 8, wherein querying the key-value pair metadata lock-free comprises: 检查所述键值对元数据中的持久性标志位,若所述持久性标志位为清空状态,则调用CPU持久化指令持久化所述目标键值对元数据;Check the persistence flag bit in the key-value pair metadata, and if the persistence flag bit is in a clear state, call the CPU persistence instruction to persist the target key-value pair metadata; 调用原子指令设置所述持久性标志位,并读取元数据指向的键值对。Call the atomic instruction to set the persistent flag, and read the key-value pair pointed to by the metadata. 10.根据权利要求1所述的方法,其特征在于,还包括:10. The method of claim 1, further comprising: 基于时间周期的内存回收方式,通过后台线程周期性回收持久性内存垃圾。A time-cycle-based memory recycling method that periodically recycles persistent memory garbage through background threads. 11.一种持久性内存键值系统,其特征在于,包括:11. A persistent memory key-value system, comprising: 查找模块,用于查找持久性内存键值系统的索引以定位待插入的键值对元数据;A lookup module, used to look up the index of the persistent memory key-value system to locate the key-value pair metadata to be inserted; 获取模块,用于获取动态随机存取存储器中与所述键值对元数据对应的写锁资源;an acquisition module, configured to acquire the write lock resource corresponding to the metadata of the key-value pair in the dynamic random access memory; 分配模块,用于为所述键值对元数据分配持久性内存,并持久化所述键值对元数据;an allocation module, configured to allocate persistent memory for the key-value pair metadata, and persist the key-value pair metadata; 插入模块,用于在所述持久性内存键值系统中原子地插入所述键值对元数据,其中,所述键值对元数据插入的提交过程包括两个阶段,其中,在第一阶段中,将所述键值对元数据中持久性标志位清空,并调用CPU持久化指令将其从CPU缓存刷写至持久性内存;在第二阶段中,设置所述持久性标志位,并通知读操作所述键值对元数据已经被成功持久化。an insertion module for atomically inserting the key-value pair metadata in the persistent memory key-value system, wherein the submission process of the key-value pair metadata insertion includes two stages, wherein in the first stage , clear the persistent flag bit in the metadata of the key-value pair, and call the CPU persistence instruction to flush it from the CPU cache to persistent memory; in the second stage, set the persistent flag bit, and Notifies read operations that the key-value pair metadata has been successfully persisted. 12.根据权利要求11所述的系统,其特征在于,还包括;12. The system of claim 11, further comprising; 维护模块,用于将所述写锁资源从持久性内存键值系统的索引中分离,并在所述动态随机存取存储器中维护所述写锁资源。A maintenance module, configured to separate the write lock resource from the index of the persistent memory key-value system, and maintain the write lock resource in the dynamic random access memory. 13.根据权利要求11所述的系统,还包括:13. The system of claim 11, further comprising: 存储模块,用于将所述键值对元数据存储为可原子修改的格式。A storage module for storing the key-value pair metadata in an atomically modifiable format. 14.根据权利要求11所述的系统,其特征在于,还包括:14. The system of claim 11, further comprising: 查询模块,用于在所述持久性内存键值系统中无锁地查询所述键值对元数据。A query module, configured to query the key-value pair metadata in the persistent memory key-value system without lock. 15.根据权利要求11所述的系统,其特征在于,还包括:15. The system of claim 11, further comprising: 回收模块,用于基于时间周期的内存回收方式,通过后台线程周期性回收持久性内存垃圾。The recycling module is used for the memory recycling method based on the time period, and the persistent memory garbage is periodically recycled through the background thread. 16.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,其中,所述计算机程序被处理器执行时实现所述权利要求1至10任一项中所述的方法的步骤。16. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, wherein, when the computer program is executed by a processor, any one of the claims 1 to 10 is implemented the steps of the method. 17.一种电子装置,包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现所述权利要求1至10任一项中所述的方法的步骤。17. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the right when executing the computer program Claims 1 to 10 of the steps of the method described in any one.
CN202011218384.6A 2020-11-04 2020-11-04 Persistent memory key-value system and operation method thereof Active CN113485946B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011218384.6A CN113485946B (en) 2020-11-04 2020-11-04 Persistent memory key-value system and operation method thereof
PCT/CN2021/124463 WO2022095685A1 (en) 2020-11-04 2021-10-18 Persistent memory key value system and operation method therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011218384.6A CN113485946B (en) 2020-11-04 2020-11-04 Persistent memory key-value system and operation method thereof

Publications (2)

Publication Number Publication Date
CN113485946A true CN113485946A (en) 2021-10-08
CN113485946B CN113485946B (en) 2024-12-03

Family

ID=77932594

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011218384.6A Active CN113485946B (en) 2020-11-04 2020-11-04 Persistent memory key-value system and operation method thereof

Country Status (2)

Country Link
CN (1) CN113485946B (en)
WO (1) WO2022095685A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608804A (en) * 2021-10-11 2021-11-05 北京华品博睿网络技术有限公司 Persistent Java off-heap cache system and method
WO2022095685A1 (en) * 2020-11-04 2022-05-12 中兴通讯股份有限公司 Persistent memory key value system and operation method therefor

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117131012B (en) * 2023-08-28 2024-04-16 中国科学院软件研究所 Sustainable and extensible lightweight multi-version ordered key value storage system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9852146B1 (en) * 2015-03-20 2017-12-26 EMC IP Holding Company LLC Distributed metadata servers for cluster file systems using shared low latency persistent key-value metadata store
CN107728937A (en) * 2017-09-15 2018-02-23 上海交通大学 A kind of key-value pair persistence methods and system using Nonvolatile memory medium
CN107862064A (en) * 2017-11-16 2018-03-30 北京航空航天大学 One high-performance based on NVM, expansible lightweight file system
CN110377531A (en) * 2019-07-19 2019-10-25 清华大学 Based on log-structured persistence memory storage engine apparatus and control method
CN110678836A (en) * 2017-04-20 2020-01-10 阿里巴巴集团控股有限公司 Persistent memory for key value storage
CN111309270A (en) * 2020-03-13 2020-06-19 清华大学 Persistent memory key value storage system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107479833B (en) * 2017-08-21 2020-04-17 中国人民解放军国防科技大学 Key value storage-oriented remote nonvolatile memory access and management method
CN108897642B (en) * 2018-06-27 2020-11-27 清华大学 Method and device for optimizing log mechanism in persistent transactional memory system
CN113485946B (en) * 2020-11-04 2024-12-03 中兴通讯股份有限公司 Persistent memory key-value system and operation method thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9852146B1 (en) * 2015-03-20 2017-12-26 EMC IP Holding Company LLC Distributed metadata servers for cluster file systems using shared low latency persistent key-value metadata store
CN110678836A (en) * 2017-04-20 2020-01-10 阿里巴巴集团控股有限公司 Persistent memory for key value storage
CN107728937A (en) * 2017-09-15 2018-02-23 上海交通大学 A kind of key-value pair persistence methods and system using Nonvolatile memory medium
CN107862064A (en) * 2017-11-16 2018-03-30 北京航空航天大学 One high-performance based on NVM, expansible lightweight file system
CN110377531A (en) * 2019-07-19 2019-10-25 清华大学 Based on log-structured persistence memory storage engine apparatus and control method
CN111309270A (en) * 2020-03-13 2020-06-19 清华大学 Persistent memory key value storage system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴海源: "基于DRAM-NVM混合内存的持久化键值存储系统研究", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》, 15 March 2020 (2020-03-15), pages 137 - 122 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022095685A1 (en) * 2020-11-04 2022-05-12 中兴通讯股份有限公司 Persistent memory key value system and operation method therefor
CN113608804A (en) * 2021-10-11 2021-11-05 北京华品博睿网络技术有限公司 Persistent Java off-heap cache system and method

Also Published As

Publication number Publication date
WO2022095685A1 (en) 2022-05-12
CN113485946B (en) 2024-12-03

Similar Documents

Publication Publication Date Title
US11080260B2 (en) Concurrent reads and inserts into a data structure without latching or waiting by readers
WO2022095685A1 (en) Persistent memory key value system and operation method therefor
US6360220B1 (en) Lock-free methods and systems for accessing and storing information in an indexed computer data structure having modifiable entries
US8024505B2 (en) System and method for optimistic creation of thread local objects in a virtual machine environment
US8473950B2 (en) Parallel nested transactions
US9501421B1 (en) Memory sharing and page deduplication using indirect lines
US7716448B2 (en) Page oriented memory management
CN110727675B (en) Method and device for processing linked list
CN109690522B (en) Data updating method and device based on B+ tree index and storage device
CN104573112A (en) Page query method and data processing node for OLTP cluster database
US11347698B2 (en) Garbage collection for hash-based data structures
CN115617542A (en) Memory exchange method and device, computer equipment and storage medium
US12079278B2 (en) Scalable range locks
US7711921B2 (en) Page oriented memory management
Wang et al. Dhash: Dynamic hash tables with non-blocking regular operations
US12019629B2 (en) Hash-based data structure
Chen et al. Lock-free high-performance hashing for persistent memory via PM-aware holistic optimization
US9223780B2 (en) Non-blocking caching technique
Singh et al. Efficient hardware primitives for immediate memory reclamation in optimistic data structures
EP0394173A2 (en) High concurrency manager of open files
CN117056363B (en) Data caching method, system, equipment and storage medium
US11604603B2 (en) Method and system for persistent partitionable distributed map using sparse arrays and sparse ordered two-bit bitmaps in shared memory
Coccimiglio¹ et al. Check for updates The Fence Complexity of Persistent Sets
CN119271667A (en) A sequence value cache processing method and related device
CN116302550A (en) Memory exchange method, memory exchange device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant