A data processing method, device, electronic equipment and storage medium

By optimizing the parallel architecture of the key-value database through modular design and asynchronous high-performance storage engine, the problem of low non-volatile memory throughput in existing technologies is solved, achieving efficient data processing and storage.

CN115729915BActive Publication Date: 2026-11-20RENMIN UNIVERSITY OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211502934.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-28
Publication Date
2026-11-20
Estimated Expiration
2042-11-28

Smart Images

  • Figure CN115729915B_ABST
    Figure CN115729915B_ABST
Patent Text Reader

Abstract

The application provides a data processing method and device, electronic equipment and storage medium, the method comprises the following steps: in response to the interface call operation initiated by the client, the interface layer obtains the call request corresponding to the interface call operation generated by the client, and sends the call request to the parallel layer; the parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partition included in the processing layer, and sends the call request to the target data partition; the processing layer uses the processing mode corresponding to the target data partition to process the call request, and obtains a processing result. The application optimizes the storage system parallel architecture, access granularity, writing mode, data storage, garbage collection and the like, uses a modular design method, and realizes an asynchronous high-performance native database storage engine on non-volatile memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a data processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] Key-value databases, or NoSQL databases, are generally considered the simplest and fastest type of database to implement. The basic storage unit in a key-value store is the key-value pair, consisting of a key and a value. Each value in the database is uniquely identified by a key. Key-value stores do not define a specific data type, but they can contain almost anything. Values ​​can store data of any form, including structured integers and strings, as well as unstructured data such as nested JSON documents, HTML information, and base64-encoded images. Values ​​in a key-value store are independent of each other and have no dependencies. Furthermore, key-value stores do not have a default query language; operations on key-value pairs are provided by the API of each database, with common interfaces including Put, Get, Delete, and Scan operations.

[0003] Existing key-value databases, such as key-value storage systems based on block devices, cannot fully leverage the hardware advantages of non-volatile memory, are not fully compatible with existing hardware, have low throughput efficiency, and cannot meet current work requirements. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide a data processing method, apparatus, electronic device and storage medium to overcome the problems in the prior art.

[0005] In a first aspect, embodiments of this application provide a data processing method applied to a storage system, the storage system including an interface layer, a parallel layer, and a processing layer, the method comprising:

[0006] In response to an interface call initiated by the client, the interface layer obtains the call request generated by the client corresponding to the interface call operation and sends the call request to the parallel layer;

[0007] The parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, and sends the call request to the target data partition.

[0008] The processing layer processes the call request using the processing method corresponding to the target data partition to obtain the processing result.

[0009] In some technical solutions of this application, the steps executed by the interface layer are executed by the client thread, the steps executed by the parallel layer and the steps executed by the processing layer are executed by the worker thread, and the client thread and the worker thread are different threads.

[0010] In some technical solutions of this application, the above method also includes:

[0011] In the client thread, a promise and a future pair are created; the future is returned to the client and used to create an asynchronous callback chain or block and wait; the promise object is saved so that the result can be notified to the future object after the worker thread returns.

[0012] In some technical solutions of this application, the above-mentioned processing layer processes the call request using the processing method corresponding to the target data partition, including:

[0013] The call requests are arranged sequentially in the worker threads corresponding to the target data partition. The processing method corresponding to the target data partition processes the call requests sequentially according to the order in which they are arranged in the worker threads.

[0014] In some technical solutions of this application, the aforementioned call request contains key-value pairs. The parallel layer analyzes the call request and determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, including:

[0015] A hash operation is performed on the key of the call request to obtain the hash value corresponding to the key, and the target data partition corresponding to the call request is determined based on the hash value corresponding to the key.

[0016] In some technical solutions of this application, the processing method corresponding to the above-mentioned target data partition includes data storage, and the method processes the call request in the following manner:

[0017] Each stored record is checked using a checksum to determine whether it has been written.

[0018] In some technical solutions of this application, the processing method corresponding to the above-mentioned target data partition includes data updating, and the method processes the call request in the following way:

[0019] The method updates data by appending to the data.

[0020] Secondly, embodiments of this application provide a data processing apparatus, the apparatus residing in a storage system, the apparatus comprising:

[0021] The response module is used to respond to the interface call operation initiated by the client, obtain the call request generated by the client corresponding to the interface call operation, and send the call request to the analysis module;

[0022] The analysis module is used to analyze the call request, determine the target data partition corresponding to the call request from the candidate data partitions, and send the call request to the target data partition.

[0023] The processing module is used to process the call request using the processing method corresponding to the target data partition, and obtain the processing result.

[0024] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the data processing method described above.

[0025] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the data processing method described above.

[0026] The technical solutions provided by the embodiments of this application can include the following beneficial effects: The method of this application includes responding to an interface call operation initiated by a client. The interface layer obtains a call request generated by the client corresponding to the interface call operation and sends the call request to the parallel layer. The parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, and sends the call request to the target data partition. The processing layer processes the call request using the processing method corresponding to the target data partition to obtain a processing result. This application optimizes the parallel architecture of the storage system, access granularity, write method, data storage, and garbage collection, and uses a modular design approach to implement an asynchronous high-performance native database storage engine on non-volatile memory.

[0027] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 A flowchart illustrating a data processing method provided in an embodiment of this application is shown.

[0030] Figure 2 A schematic diagram of a storage system provided in an embodiment of this application is shown;

[0031] Figure 3 This illustration shows a schematic diagram of a recording structure provided in an embodiment of this application;

[0032] Figure 4 This illustration shows a thread diagram provided in an embodiment of this application;

[0033] Figure 5 A schematic diagram of a data processing apparatus provided in an embodiment of this application is shown;

[0034] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the accompanying drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.

[0036] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0037] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0038] Key-value databases, or NoSQL databases, are generally considered the simplest and fastest type of database to implement. The basic storage unit in a key-value store is the key-value pair, consisting of a key and a value. Each value in the database is uniquely identified by a key. Key-value stores do not define a specific data type, but they can contain almost anything. Values ​​can store data of any form, including structured integers and strings, as well as unstructured data such as nested JSON documents, HTML information, and base64-encoded images. Values ​​in a key-value store are independent of each other and have no dependencies. Furthermore, key-value stores do not have a default query language; operations on key-value pairs are provided by the API of each database, with common interfaces including Put, Get, Delete, and Scan operations.

[0039] Non-volatile memory (NVM) is a type of computer memory that retains stored information even after power is turned off. The most widely used form of main memory today is volatile random access memory (RAM), meaning that any content stored in it will be lost when the computer is turned off. Most forms of non-volatile memory have limitations that make them unsuitable for use as main memory.

[0040] Non-volatile main memory (NVRAM) is generally unsuitable as primary storage due to its lower performance, limited lifespan, coarser read / write granularity, or higher cost. Optane storage, which utilizes 3D XPoint technology, offers faster read / write speeds and byte-addressability, meeting the basic requirements for primary storage. Consequently, some Optane storage devices are packaged in DIMM form for use as NVRAM. Like traditional DRAM (Dynamic Random Access Memory), NVRAM uses a memory bus for data exchange. During use, the device is inserted into a DIMM slot in a server and connected to the processor's integrated memory controller.

[0041] Asynchronous programming is a programming paradigm that allows a program to start tasks that may run for a long time and still be able to respond to other events while those tasks are running, without having to wait for the tasks to complete. In asynchronous programming, a thread processes multiple tasks without waiting for results. When the results are ready, the thread collects the results and submits them.

[0042] HiKV: To address the issue of fast DRAM write speeds compared to slower NVM write speeds, Xia et al. proposed the HiKV system. Structurally, HiKV employs a parallel model combining data partitioning, a single worker thread, and a single partition, delegating data processing within a partition to that thread. Regarding data distribution, HiKV establishes an NVM-based hash index in each data partition, with each partition having its own independent hash index for fast data retrieval, while the system shares a single B+ tree index within the DRAM.

[0043] FlatStore: To adapt to NVM's 256-byte hardware write granularity and avoid mismatches between access granularity and NVM hardware caused by writing to NVM at small granularities, FlatStore proposes a dual storage structure of log structure and segment storage structure. Each write operation appends a record to the end of the log structure, distinguishing the content in the log based on the size of the key-value pair: if the key-value pair is small, the data is directly recorded in the log; if the key-value pair is large, a segment is allocated in the segment storage structure to store the key-value pair, and the persistent pointer of that space is stored in the log entry. Simultaneously, FlatStore designs a multi-threaded batch processing mode. During the processing of write requests, different threads elect a "leader thread." The leader thread summarizes the write operations of all threads within a certain period and performs a unified write operation, reducing the number of persistence operations.

[0044] Viper: Since the sequential write latency of NVM is not significantly different from that of DRAM, and NVM hardware aggregates multiple sequential write operations together and flushes them to persistent media during the write process, Viper organizes data into 4KB segments and writes them directly without going through the DRAM buffer to achieve the minimum latency of NVM write operations. Regarding multi-threaded parallelism, a single Viper write operation is executed in parallel on multiple threads, each corresponding to a different memory channel. To avoid the random write latency of NVM, Viper employs a key-value separation strategy. The persistent storage of the key-value pairs is handled by NVM, while the index is placed in DRAM. The index stores pointers to the key-value data in NVM, thereby improving performance.

[0045] Key-value storage systems based on block devices cannot fully leverage the hardware advantages of non-volatile memory. In terms of throughput, non-volatile memory can achieve hardware throughput close to 9GB / s, while the maximum throughput of traditional key-value storage systems on new hardware is only 588MB / s. Furthermore, the hardware throughput improvement from SSD to non-volatile memory is 3.3 times, while the maximum improvement for traditional key-value storage systems is only 2.37 times. This indicates that related design flaws in the system hinder hardware performance. Therefore, we need to analyze the reasons for the poor performance of traditional key-value storage systems on non-volatile memory and optimize them to achieve optimal performance on new hardware.

[0046] Based on this, embodiments of this application provide a data processing method, apparatus, electronic device, and storage medium, which are described below through embodiments.

[0047] Figure 1 This illustration shows a flowchart of a data processing method provided in an embodiment of this application, applied to a storage system. The storage system includes an interface layer, a parallel layer, and a processing layer. The method includes steps S101-S103; specifically:

[0048] S101. Responding to the interface call operation initiated by the client, the interface layer obtains the call request generated by the client corresponding to the interface call operation, and sends the call request to the parallel layer;

[0049] S102. The parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, and sends the call request to the target data partition.

[0050] S103. The processing layer processes the call request using the processing method corresponding to the target data partition to obtain the processing result.

[0051] This application optimizes the parallel architecture of the storage system, access granularity, write method, data storage, and garbage collection. It uses a modular design approach to implement an asynchronous high-performance native database storage engine on non-volatile memory.

[0052] The following describes some embodiments of this application in detail. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0053] The method described in this application is applied to storage systems, such as... Figure 2 As shown, the storage system in this application includes an interface layer, a parallel layer, and a processing layer. The processing layer includes an indexing layer and a storage layer. Interface Layer: Users invoke interfaces to initiate requests to the storage system. These requests can be initiated locally or remotely via RPC. Depending on the specific type of interface invoked, the client may block and wait for the result or execute other tasks. Parallel Layer: Forwards user requests to the corresponding data partitions, using the Seastar framework. Processing Layer: Each data partition processes user requests, retrieves key indexes from the HotTree index, and reads or stores data in the storage. The processing layer includes multiple data partitions, each containing CPU cores and data. Each data partition also has corresponding DRAM and PMEM: indexes, data block caches, and persistent files. Each persistent file contains a file header data block and multiple file data blocks.

[0054] S101. In response to an interface call operation initiated by the client, the interface layer obtains the call request generated by the client corresponding to the interface call operation and sends the call request to the parallel layer.

[0055] When processing data, users invoke API calls through a client. The client generates a call processing signal corresponding to the API call and sends it to the storage system. Clients include mobile phones, computers, tablets, etc. Client-side calls include inputting corresponding commands or selecting interfaces—actions that enable API functionality. In this application, the interface layer receives the call request, which contains key-value pairs, and then sends the request to the parallel layer.

[0056] S102. The parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, and sends the call request to the target data partition.

[0057] Since the processing layer of this application contains multiple data partitions, after receiving the call request sent by the interface layer, the parallel layer needs to analyze the call request to determine the target data partition corresponding to the call request. The analysis of the call request involves: performing a hash operation on the key of the call request to obtain the hash value corresponding to the key, and determining the target data partition corresponding to the call request based on the hash value. Specifically, the key of the call request is hashed, and the first four bits of the hash value are selected as the partition to which the key belongs. That is, all query, insert, update, and delete operations for this key are completed under the target data partition.

[0058] After determining the target data partition for the call request, the parallel layer sends the call request to the target data partition of the processing layer.

[0059] S103. The processing layer processes the call request using the processing method corresponding to the target data partition to obtain the processing result.

[0060] The target data partition handles call requests, including data storage and data updates. For data storage, this application uses a log structure to organize data writing, as multiple versions of data may exist simultaneously in the storage system. Appending writes ensure sequential access to persistent memory, increasing overall data write throughput. However, for frequently updated hot data, continuous append writes can lead to a large amount of invalid data in data pages, wasting persistent memory space. To optimize space utilization, this application uses a Slab data structure, in addition to the log structure, to cache frequently updated hot data. The Slab data structure is typically used in in-memory key-value storage systems. It divides data by size, storing data within a specific range in an array-like structure, where each data slot is the maximum size of that range. Each array maintains a separate free list, grouping elements of similar size together. If an element is deleted, a free data slot becomes available for subsequent elements, avoiding the impact of data fragmentation.

[0061] like Figure 3As shown, the storage system uses checksums to ensure that every record stored in non-volatile memory has been completely written during a restart. A record consists of a header and data items; the complete data class is called a DataEntry. The header is the data structure that ensures the persistence consistency of the data record, and the data items record metadata and key-value pairs. The header is 8 bytes in size, containing a 4-byte checksum and a 4-byte suffix length, which is exactly the granularity of an atomic write to non-volatile memory. The suffix length is the length of the data record immediately following the header. Before persistence, the checksums of the metadata, keys, and values ​​are calculated separately, and the three calculated structures are summed to obtain the checksum of the entire data record, which is stored in the header. The header is the first part written during the record persistence process; therefore, once the write begins, the header is guaranteed to be completely written. This design ensures data consistency after a storage system restart. By examining the header of each data record, the checksum length and checksum value (c1) can be obtained. The checksum (c2) is then recalculated after the header is updated to the suffix size. If c1 = c2, the data record is fully persisted and accepted by the restarted storage system. If c1 ≠ c2, the record is not fully persisted, and the storage system discards this incomplete record and clears the data in that area. Because the storage system does not notify the upper-layer application that the write is complete when data is not fully persisted, there is no need to worry about data inconsistency at the upper-layer application.

[0062] Persistent slabs: While append-only writes ensure sequential access to persistent memory, increasing overall write throughput, frequent updates to hot data can lead to a large amount of invalid data in data pages, wasting persistent memory. To address this, storage systems use persistent slabs to store frequently updated data. Slabs are typically used in in-memory key-value stores. They partition data by size, storing data within specific ranges in an array-like structure, where each slot is the maximum size of that range. Each array maintains a separate free list, grouping elements of similar size together. If an element is deleted, free slots become available for subsequent elements, mitigating the impact of data fragmentation.

[0063] In implementation, this application sets the slab boundary thresholds to 64B, 256B, 1024B, and 4096B, with each slab group capable of holding 1000 data records. Each slab group has one bitmap for idle management, one LRU cache for controlling data eviction within the slab, and one TTL-enabled counter. All three modules are DRAM memory modules and do not involve persistence; the persistence part only includes the persistent array of the slab group. When writing to the storage layer, data can be directly written to the log structure data page. If the storage layer update interface is called, it needs to check if there is a cache hit in the LRU cache. If the cache hits and the data slot has no snapshot reference, the data is updated in place in the array slot. If the cache hits but a snapshot reference exists, the data needs to be written to a new data slot, and the referenced slot is added to the recycling queue. When the snapshot is released, the slot is reclaimed. If the cache misses, the TTL counter is updated. When the count value exceeds 3, the slot corresponding to the evicted data in the Slab is replaced, and the evicted data is persisted in the log structure data page. The TTL counter records the number of accesses in the last minute, and the TTL is updated every time an access occurs.

[0064] In this embodiment of the application, as an optional embodiment, the steps executed by the interface layer are executed by the client thread, and the steps executed by the parallel layer and the steps executed by the processing layer are executed by the worker thread, wherein the client thread and the worker thread are different threads.

[0065] In the client thread, a promise and a future pair are created; the future is returned to the client and used to create an asynchronous callback chain or block and wait; the promise object is saved so that the result can be notified to the future object after the worker thread returns.

[0066] The call requests are arranged sequentially in the worker threads corresponding to the target data partition. The processing method corresponding to the target data partition processes the call requests sequentially according to the order in which they are arranged in the worker threads.

[0067] In implementing the above steps, this application employs thread separation. After the client initiates a request, the database client thread receives the request. To notify the client of the result, the system creates a promise / future pair. The future part is returned to the client for creating asynchronous callback chains or blocking waits, etc. The promise object is saved and used by the worker thread to notify the future object of the result after returning. The system then hashes the requested key and selects the first four bits of the hash value as the partition to which the key belongs. That is, all query, insert, update, and delete operations for this key are completed under this partition. The system then submits the requested key-value pair to the corresponding worker thread through the Seastar framework and obtains a cross-thread future object for obtaining the call result. To obtain the call result, the system binds a callback function to this future object and captures the previously created promise object in the closure of the callback function. When the worker thread returns the result, the callback function uses the promise object to notify the client of the result.

[0068] In this application, the data within each data partition is independent, and the storage system allocates corresponding background threads to process specific data. The processing of read / write requests in the storage system involves two types of threads: client threads that call the system interface and worker threads that are bound to the CPU. In the data flow of the storage system processing read / write requests, the request is mapped from the client thread to the corresponding data partition. At this point, the client thread forwards the request to the queue of the worker thread. The worker thread retrieves the request from the queue during its event loop. Based on the data in the request, it performs read / write processing in the data partition, and upon completion, notifies the client thread of the processing result via a callback function. This parallel model involves one data forwarding and thread switching between the interface call and data processing.

[0069] Specifically, such as Figure 4 As shown, the client thread execution steps in this application include: the caller invokes the system interface, encodes the parameters according to different interfaces, calculates the hash value of the key, selects the (data) partition according to the hash value, inserts the (call) request into the queue, obtains the future object, returns from the (storage) system interface, and executes the callback function once the future object is ready. The worker thread execution steps include: retrieving requests from the queue, determining the request type; if the request type is "put", writing to the storage layer and the index layer; if the request type is "get", searching in the index layer and accessing the storage layer; if the request type is "delete", searching and deleting in the index layer and deleting in the index layer.

[0070] Figure 5This illustration shows a schematic diagram of a data processing apparatus provided in an embodiment of this application. The apparatus resides in a storage system and includes:

[0071] The response module is used to respond to the interface call operation initiated by the client, obtain the call request generated by the client corresponding to the interface call operation, and send the call request to the analysis module;

[0072] The analysis module is used to analyze the call request, determine the target data partition corresponding to the call request from the candidate data partitions, and send the call request to the target data partition.

[0073] The processing module is used to process the call request using the processing method corresponding to the target data partition, and obtain the processing result.

[0074] The steps executed by the response module are performed by the client thread, while the steps executed by the analysis module and the steps executed by the processing module are performed by the worker thread, and the client thread and the worker thread are different threads.

[0075] A module is created to create promise and future pairs in the client thread; the future is returned to the client to create an asynchronous callback chain or to block and wait; the promise object is saved so that the result can be notified to the future object after the worker thread returns.

[0076] The processing module processes the call request using the processing method corresponding to the target data partition, including:

[0077] The call requests are arranged sequentially in the worker threads corresponding to the target data partition. The processing method corresponding to the target data partition processes the call requests sequentially according to the order in which they are arranged in the worker threads.

[0078] The call request contains key-value pairs. The analysis module analyzes the call request and determines the target data partition corresponding to the call request from the candidate data partitions included in the processing module, including:

[0079] A hash operation is performed on the key of the call request to obtain the hash value corresponding to the key, and the target data partition corresponding to the call request is determined based on the hash value corresponding to the key.

[0080] The processing method corresponding to the target data partition includes data storage, and the method processes the call request in the following ways:

[0081] Each stored record is checked using a checksum to determine whether it has been written.

[0082] The processing method corresponding to the target data partition includes data updating, and the method processes the call request in the following ways:

[0083] The method updates data by appending to the data.

[0084] like Figure 6 As shown, this application provides an electronic device for executing the data processing method described in this application. The device includes a memory, a processor, a bus, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the data processing method described above.

[0085] Specifically, the aforementioned memory and processor can be general-purpose memory and processor, without any specific limitations. When the processor runs the computer program stored in the memory, it can execute the aforementioned data processing methods.

[0086] Corresponding to the data processing method in this application, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the data processing method described above.

[0087] Specifically, the storage medium can be a general-purpose storage medium, such as a removable disk or hard disk, and when the computer program on the storage medium is run, it can perform the above-mentioned data processing methods.

[0088] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. The system embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between systems or units may be electrical, mechanical, or other forms.

[0089] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0090] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0091] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0092] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0093] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A data processing method, characterized in that, This method is applied to a storage system, which includes an interface layer, a parallel layer, and a processing layer. The interface layer receives call requests from clients to the storage system; these requests can be initiated directly locally or remotely via RPC. The processing layer includes an indexing layer and a storage layer. The parallel layer uses the Seastar framework to forward user requests to corresponding data partitions. The processing layer processes user requests in each data partition, retrieving key indexes from the HotTree index and reading or storing data in the storage. The processing layer includes multiple data partitions, each containing CPU cores and data. Each data partition also has corresponding DRAM and PMEM, where the DRAM and / or PMEM stores indexes, data block caches, and persistent files. Each persistent file contains a file header data block and multiple file data blocks. The method includes: In response to an interface call initiated by the client, the interface layer obtains the call request generated by the client corresponding to the interface call operation and sends the call request to the parallel layer; The parallel layer analyzes the call request, determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, and sends the call request to the target data partition. The processing layer arranges the call requests sequentially in the worker threads corresponding to the target data partition, and processes the call requests sequentially according to the order of the call requests in the worker threads; the target data partition processes the call requests, including data storage and data updating; the data storage organizes data writing in a log structure; the data updating is written sequentially in an append-only manner; and in addition to the log structure, the update is cached using a Slab data structure. The steps executed by the interface layer are executed by the client thread, while the steps executed by the parallel layer and the steps executed by the processing layer are executed by the worker thread, and the client thread and the worker thread are different threads; The method further includes: In the client thread, a promise and a future pair are created; the future is returned to the client and used to create an asynchronous callback chain or block and wait; the promise object is saved so that the result can be notified to the future object after the worker thread returns.

2. The method according to claim 1, characterized in that, The call request contains key-value pairs. The parallel layer analyzes the call request and determines the target data partition corresponding to the call request from the candidate data partitions included in the processing layer, including: A hash operation is performed on the key of the call request to obtain the hash value corresponding to the key, and the target data partition corresponding to the call request is determined based on the hash value corresponding to the key.

3. The method according to claim 1, characterized in that, The processing method corresponding to the target data partition includes data storage, and the method processes the call request in the following ways: Each stored record is checked using a checksum to determine whether it has been written.

4. The method according to claim 1, characterized in that, The processing method corresponding to the target data partition includes data updating, and the method processes the call request in the following ways: The method updates data by appending to the data.

5. A data processing apparatus, characterized in that, The device resides in a storage system, which includes an interface layer, a parallel layer, and a processing layer. The interface layer receives call requests from clients to the storage system; these call requests can be initiated directly locally or remotely via RPC. The processing layer includes an indexing layer and a storage layer. The parallel layer uses the Seastar framework to forward user requests to corresponding data partitions. The processing layer processes user requests in each data partition, retrieving key indexes from the HotTree index, reading data from storage, or storing user data. The processing layer includes multiple data partitions, each containing CPU cores and data. Each data partition also has corresponding DRAM and PMEM, where the DRAM and / or PMEM stores indexes, data block caches, and persistent files. Each persistent file contains a file header data block and multiple file data blocks. The device includes: The response module is used to respond to the interface call operation initiated by the client, obtain the call request generated by the client corresponding to the interface call operation, and send the call request to the analysis module; The analysis module is used to analyze the call request, determine the target data partition corresponding to the call request from the candidate data partitions, and send the call request to the target data partition. The processing module is used to arrange the call requests sequentially in the worker threads corresponding to the target data partition, and process the call requests sequentially according to the order of the call requests in the worker threads; the target data partition processes the call requests including data storage and data updating; the data storage organizes data writing in a log structure; the data updating is written sequentially in an append-only manner; and in addition to the log structure, the update is cached using a Slab data structure. The steps executed by the interface layer are executed by the client thread, while the steps executed by the parallel layer and the steps executed by the processing layer are executed by the worker thread, and the client thread and the worker thread are different threads; The analysis module is also used for: In the client thread, a promise and a future pair are created; the future is returned to the client and used to create an asynchronous callback chain or block and wait; the promise object is saved so that the result can be notified to the future object after the worker thread returns.

6. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is in operation, the processor communicates with the memory via the bus, and the machine-readable instructions, when executed by the processor, perform the steps of the data processing method as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the data processing method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Distributed data real-time synchronization method and system and data synchronization equipment

    CN114428820A