Segmented multi-level data cache management method and device, computer equipment and storage medium

Through the segmented multi-level data cache management method, the problem of low cache hit rate in the existing technology is solved, and more efficient data access and system performance improvement is achieved.

CN120067159APending Publication Date: 2025-05-30SHENZHEN YILIAN INFORMATION SYST CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510145922.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The existing cache management methods cannot effectively handle data access units of different sizes, resulting in low cache hit rate and limited system performance improvement.

Method used

The segmented multi-level data cache management method is adopted, and the upper-level data management module is defined, and data is split according to the logical address relationship by defining the hierarchical data management module. The data communication and synchronization are carried out by defining the module status, queried, the cache hit management module status is marked, and the corresponding length is constructed according to the hit status.

Benefits of technology

It improves cache hit rate and system performance, can effectively adapt to different types of data access requirements, optimize data processing performance and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067159A_ABST
    Figure CN120067159A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data cache management, and discloses a segmented multi-level data cache management method and device, computer equipment and a storage medium. The method comprises the following steps: defining a hierarchical data management module, wherein the data management module comprises a first-level data interaction sub-module and a second-level cache hit management sub-module; receiving an upper-layer data access request, and performing data splitting according to the logic address relationship; querying the module state of the position according to the actual situation, and marking the cache hit management module state of the corresponding position; if the second-level cache hit management sub-modules to which the first-level data interaction sub-modules belong are all hit, realizing data communication with lower-layer storage equipment according to large granularity; and if part of data enters the cache, according to the continuity of the data hit state, respectively constructing commands with corresponding lengths to lower-layer storage equipment. By implementing the method provided by the invention, access requirements of different types of data can be effectively realized, the cache hit rate is improved, and better performance improvement is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to data cache management technology, and more specifically to a method, device, computer equipment and storage medium for segmented multi-level data cache management. Background Art

[0002] With the rapid development of information technology, data access speed and system response speed have become important indicators for measuring the performance of computer systems. Cache technology can quickly respond to data access requests and significantly improve system performance by establishing a cache layer to store copies of frequently accessed data. However, how to effectively manage data caches to meet different types of data access requirements has become a hot topic and a difficult problem in current research.

[0003] Most existing cache management methods adopt a single cache strategy and cannot flexibly handle data access units of different sizes, resulting in low cache hit rates and limited improvement in system performance. Summary of the Invention

[0004] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method, device, equipment and medium for segmented multi-level data cache management.

[0005] To solve the above technical problems, the present invention adopts the following technical solutions:

[0006] In a first aspect, a method for segmented multi-level data cache management is provided, including:

[0007] Defining a hierarchical data management module, the data management module including a first-level data interaction sub-module and a second-level cache hit management sub-module;

[0008] Receiving an upper-layer data access request, and splitting the data according to the logical address relationship to obtain the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module;

[0009] Querying the module status of the corresponding position according to the actual situation, and marking the status of the cache hit management module at the corresponding position for the data that needs to be included in cache management;

[0010] If all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, data communication with the lower-layer storage device is realized according to large granularity;

[0011] If some data enters the cache, commands of corresponding lengths are respectively constructed to the lower-layer storage device according to the continuity of the data hit status to achieve direct access and data synchronization.

[0012] In a second aspect, a device for segmented multi-level data cache management is provided, including:

[0013] A defining unit, which is used to define a hierarchical data management module, and the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module;

[0014] A receiving and splitting unit, which is used to receive an upper-layer data access request, split the data according to the logical address relationship, and obtain the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module;

[0015] An inquiry marking unit, which is used to inquire about the module status of the location according to the actual situation, and for the data that needs to be included in the cache management, mark the cache hit management module status of the corresponding location;

[0016] A communication unit, which is used to, if all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, implement data communication with the lower-layer storage device according to a large granularity;

[0017] A construction synchronization unit, which is used to, if some data enters the cache, respectively construct commands with corresponding lengths to the lower-layer storage device according to the continuity of the data hit status, so as to achieve direct access and data synchronization.

[0018] In a third aspect, a computer device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned segmented multi-level data cache management method are implemented.

[0019] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned segmented multi-level data cache management method are implemented.

[0020] For the above-mentioned segmented multi-level data cache management method, by defining a hierarchical data management module, receiving an upper-layer data access request, splitting the data according to the logical address relationship, obtaining the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module, then inquiring about the module status of the location according to the actual situation, for the data that needs to be included in the cache management, marking the cache hit management module status of the corresponding location, if all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, implementing data communication with the lower-layer storage device according to a large granularity, if some data enters the cache, respectively constructing commands with corresponding lengths to the lower-layer storage device according to the continuity of the data hit status, so as to achieve direct access and data synchronization, it can effectively meet the data access requirements of different types, organize the interaction with the lower-layer storage device, specifically improve the cache hit rate, and obtain better performance improvement.

[0021] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0023] Figure 1 It is a schematic flowchart of a method for segmented multi-level data cache management provided by an embodiment of the present invention;

[0024] Figure 2 It is a schematic block diagram of a device for segmented multi-level data cache management provided by an embodiment of the present invention;

[0025] Figure 3 It is a schematic structural diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0026] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.

[0027] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0028] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.

[0029] It should be further understood that the term " / and / " used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the related listed items, and includes these combinations.

[0030] Please refer to Figure 1 the specific embodiments shown. The present invention discloses a method for segmented multi-level data cache management, including the following steps:

[0031] S110. Define a hierarchical data management module, where the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module;

[0032] Specifically, the first-level data interaction sub-module is the interface between the data management module and external data sources or applications. It is responsible for receiving external data requests and returning the processed data to the requester. At the same time, this sub-module is also responsible for notifying external systems of internal data changes. Receive external data requests through methods such as API interfaces and message queues, perform format verification, cleaning, and conversion on the received data to meet internal processing requirements. Generate response data based on the processing results and return it to the requester through the corresponding channels. When internal data is updated, notify external systems through callbacks, pushes, etc.

[0033] The second-level cache hit management sub-module is responsible for managing and optimizing the data cache strategy to improve data access speed and system performance. It determines which data needs to be cached, as well as the cache update and invalidation strategies by analyzing the data access patterns and frequencies. Adopt algorithms such as LRU (Least Recently Used) and LFU (Least Frequently Used) to determine the data replacement strategy in the cache. When an external request arrives, first check if the required data exists in the cache. If it exists, directly return the cached data to avoid accessing the underlying database. When the underlying data changes, update the data in the cache and may trigger a cache invalidation mechanism (such as setting a cache expiration time), monitor the cache hit rate, size, and usage to dynamically adjust the cache strategy.

[0034] By defining a hierarchical data management module, the following benefits are obtained:

[0035] Improve data access speed: Through the efficient data preprocessing and response generation of the first-level data interaction sub-module, and the fast cache hit mechanism of the second-level cache hit management sub-module, the data access speed can be significantly improved, and the system response time can be reduced.

[0036] Optimize system performance: The cache hit management sub-module reduces the frequent access to the underlying database through an intelligent cache strategy, reduces the system load and energy consumption, and thus improves the overall system performance.

[0037] Enhance data consistency: The design of the first-level data interaction sub-module in data synchronization ensures that internal data changes can be notified to external systems in a timely manner, maintaining data consistency.

[0038] Improve system scalability: The hierarchical data management module design enables each sub-module to be optimized and extended relatively independently, facilitating adaptation to constantly changing data processing requirements.

[0039] In one embodiment, in step S110, it further includes: constructing segmented cache management ranges, that is, multiple data management modules, and each data management module has different first-level data interaction sub-modules and second-level cache hit management sub-modules.

[0040] Specifically, according to the characteristics and access patterns of the data, the entire data storage space is divided into multiple independent segments or ranges, and each segment corresponds to a data management module to achieve more refined data management and cache control. For each segment or range, different first-level data interaction sub-modules and second-level cache hit management sub-modules are configured according to their data characteristics and access requirements. For example, for frequently accessed small data blocks, smaller data interaction units and efficient cache hit management strategies can be configured; while for large files or less frequently accessed data, larger data interaction units and relatively loose cache policies can be configured. As the data access pattern changes, the system can dynamically adjust the configurations and strategies of each data management module. For example, when the data access frequency of a certain segment significantly increases, its cache capacity can be increased or its cache replacement algorithm can be optimized.

[0041] By constructing segmented cache management ranges, the following benefits are achieved:

[0042] Improve data access efficiency: Through segmented management and differential configuration of data management modules, the system can more accurately identify and process different types of data access requests, which helps reduce unnecessary disk I / O operations and improve the data access speed and response ability.

[0043] Optimize cache usage efficiency: Each data management module is configured according to its corresponding data characteristics and access requirements, which enables more reasonable allocation and utilization of cache resources. Through intelligent cache replacement algorithms and dynamic adjustment strategies, the system can ensure that the most frequently used and important data is always stored in the cache, thereby improving the cache hit rate and overall performance.

[0044] Enhance the flexibility and scalability of the system: Segmented management and differential configuration enable the system to easily cope with the growth of data volume and changes in access patterns. By simply adding new data management modules or adjusting the configurations of existing modules, the system can meet the continuously changing data processing requirements.

[0045] Reduce system costs: By optimizing data access and cache management strategies, the system can reduce unnecessary hardware resource consumption and energy consumption, which helps reduce the system's operating costs and improve the overall economic efficiency.

[0046] In one embodiment, the first-level data interaction sub-module corresponds to a continuous memory area on the virtual address and serves as the target module for communicating with the lower-layer storage device; the second-level cache hit management sub-module divides the first-level data interaction sub-module into several small modules for receiving and storing IO data and recording the cache hit or miss status of the data.

[0047] Specifically, the first-level data interaction sub-module uses the memory mapping mechanism provided by the operating system to map a continuous memory area in the virtual address space to a specific location on the physical storage device. When the upper-layer application or system needs to access this data, it can directly access the data copy in the memory through the virtual address without performing disk I / O operations every time. To communicate effectively with the lower-layer storage device, the first-level data interaction sub-module needs to implement a set of data interaction protocols. This set of protocols defines the data format, transmission method, verification mechanism, etc. to ensure the accuracy and integrity of the data. To improve the concurrency of data access, the first-level data interaction sub-module may adopt technical means such as multi-threading or asynchronous I / O to handle multiple data access requests simultaneously.

[0048] The second-level cache hit management sub-module is a supplement and extension of the first-level data interaction sub-module. It divides the continuous memory area managed by the first-level data interaction sub-module into several smaller modules (i.e., cache entries or cache lines) for receiving and storing IO data and recording the cache hit or miss status of each cache entry. The second-level cache hit management sub-module divides the memory area managed by the first-level data interaction sub-module into multiple cache entries according to factors such as the access frequency and size of the data. Each cache entry contains the data itself and associated metadata (such as access timestamp, valid flag, etc.). When the upper-layer application or system initiates a data access request, the second-level cache hit management sub-module will first check whether the requested data already exists in the cache. If the data already exists (i.e., cache hit), the data is directly returned; if the data does not exist (i.e., cache miss), the data is read from the lower-layer storage device and stored in the cache, and the metadata of the cache entry is updated simultaneously. To maintain the effectiveness and utilization rate of the cache, the second-level cache hit management sub-module needs to implement a cache replacement strategy. When the cache is full and new data needs to be stored, this strategy will determine which cache entry should be replaced. Common cache replacement strategies include LRU (Least Recently Used), LFU (Least Frequently Used), etc.

[0049] By defining the functions and roles of the first-level data interaction sub-module and the second-level cache hit management sub-module, the following benefits are achieved:

[0050] Improve data access speed: Through the communication between the first-level data interaction sub-module and the lower-layer storage device and the caching mechanism of the second-level cache hit management sub-module, the system can significantly reduce the number and time of disk I / O operations, thereby improving the data access speed.

[0051] Optimize memory usage efficiency: By intelligently dividing cache entries and recording cache hit / miss status, the second-level cache hit management sub-module can ensure that the most frequently used and important data is always stored in the cache, which helps to optimize the memory usage efficiency and avoid unnecessary memory waste.

[0052] Enhance system stability: By implementing data interaction protocols and concurrent processing technical means, the first-level data interaction sub-module can ensure the accuracy and integrity of data and improve the system's concurrent processing ability. This helps to enhance the stability and reliability of the system.

[0053] Support flexible data management: The cache replacement strategy of the second-level cache hit management sub-module can be adjusted and optimized according to specific application scenarios, which enables the system to support more flexible data management strategies to meet the ever-changing data processing requirements.

[0054] In one embodiment, after step S110, it further includes: loading potential access objects into the cache in advance. When the target data is accessed, regardless of its size, the entire target data is read out completely from the lower-layer storage device and loaded into the cache.

[0055] Specifically, the system can record and analyze past data access records to identify the patterns and regularities of data access. For example, by analyzing metrics such as access frequency, access time interval, and data correlation, the system can predict which data may be accessed in the future. In addition to the analysis based on historical data, the system can also adopt heuristic algorithms to predict data access patterns. These algorithms may be based on principles such as spatial locality of data (i.e., the higher probability of adjacent data blocks being accessed) and temporal locality (i.e., the data recently accessed is likely to be accessed again in the future).

[0056] Based on the predicted data access patterns, the system can formulate prefetching strategies. These strategies may include which data to prefetch, how much data to prefetch, when to perform prefetching, etc. For example, the system can decide to prefetch data during idle time or low - load periods to avoid affecting normal business operations. To accommodate the prefetched data, the system needs to appropriately adjust and manage the cache. This may include reserving cache space for the prefetched data, adjusting the cache replacement policy to adapt to the characteristics of the prefetched data, etc. When the target data is accessed, regardless of its size, the system will read the entire target data completely from the underlying storage device and load it into the cache. This strategy aims to reduce the number of multiple disk I / O operations caused by partial reads and improve the continuity and efficiency of data access. When reading data from the underlying storage device and loading it into the cache, the system needs to ensure the consistency and integrity of the data. This may include using mechanisms such as checksum, CRC, etc. to detect errors in the data during transmission and perform error correction if necessary.

[0057] By loading potential access objects into the cache in advance, the following benefits are achieved:

[0058] Improve data access speed: By loading potential access objects into the cache in advance, the system can significantly reduce the number and time of disk I / O operations, thus improving the data access speed. Especially when the target data is completely read and loaded into the cache, the system can respond to data access requests faster.

[0059] Optimize cache utilization: By predicting data access patterns and formulating corresponding prefetching strategies, the system can manage cache resources more intelligently. This helps to optimize cache utilization, avoid unnecessary cache waste, and improve the cache hit rate.

[0060] Reduce disk wear: By reducing the number of disk I / O operations, the system can reduce the degree of disk wear and extend the service life of the disk, which is particularly important for data centers and high - performance computing environments that rely on disk storage.

[0061] Enhance user experience: For applications that rely on fast data access (such as databases, real - time analysis systems, etc.), loading potential access objects into the cache in advance can significantly enhance the user experience. Users can obtain the required data faster, thereby improving work efficiency and satisfaction.

[0062] S120, receive the upper - layer data access request, split the data according to the logical address relationship, and obtain the positions of the first - level data interaction sub - module and the second - level cache hit management sub - module;

[0063] Specifically, data access requests from upper-layer applications or systems are received through defined interfaces or communication protocols. These requests may include operations such as data reading, writing, updating, or deleting. After receiving a data access request, the system first parses it to extract key information in the request, such as logical addresses, data sizes, operation types, etc. The system maintains a mapping relationship between logical addresses and physical addresses, and this mapping relationship may be static or dynamic, depending on the specific implementation and design of the system. According to the logical address mapping relationship, the system splits the data in the upper-layer data access request according to the logical address. The purpose of splitting is to disperse the data into different storage units or cache entries for parallel processing or optimized access efficiency. The granularity of data splitting can be adjusted according to actual needs. For example, data can be split into data blocks of a fixed size or according to the logical structure of the data (such as records, fields, etc.). After the data splitting is completed, the system uses a specific algorithm or lookup table to determine the locations of the first-level data interaction sub-module and the second-level cache hit management sub-module where they should be stored or accessed according to the logical addresses of the split data blocks or entries. To improve the efficiency of data access and cache hit rate, the system may need to dynamically adjust the storage locations of data blocks or entries according to the actual situation. For example, when a certain data block is frequently accessed, the system can promote it from the second-level cache to the first-level cache.

[0064] By receiving upper-layer data access requests and splitting the data according to the logical address relationship, the following benefits are achieved:

[0065] Improve data access efficiency: By splitting the data according to the logical address relationship and dispersing the data into different storage units or cache entries, the system can process multiple data access requests in parallel, thus improving the efficiency of data access.

[0066] Optimize cache utilization: The system can dynamically adjust the storage locations of data blocks or entries according to the access frequency and pattern of the data, thus optimizing the utilization of the cache, which helps to reduce cache waste and increase the cache hit rate.

[0067] Enhance system scalability: By defining a clear logical address mapping relationship and data splitting strategy, the system can more easily expand the storage capacity and processing power, which helps to meet the growing data processing requirements.

[0068] Improve system stability and reliability: Through reasonable data splitting and cache management strategies, the system can reduce the number of data access conflicts and disk I / O operations, thus improving the stability and reliability of the system.

[0069] S130, querying the module status of the corresponding position according to the actual situation, and marking the cache hit management module status of the corresponding position for the data that needs to be included in the cache management;

[0070] Specifically, the system first establishes a status monitoring mechanism to query the status information of data management modules at all levels (including the first-level data interaction submodule, the second-level cache hit management submodule, etc.) in real time or periodically. This status information may include the module load, cache hit rate, data access frequency, etc. When receiving a data access request or performing data processing, the system needs to determine the data management module to which it belongs based on the logical address or physical location of the data, which usually involves parsing the address information in the data access request and using a mapping table or algorithm to determine the specific module location. Once the location to which the data belongs is determined, the system will query the status of the data management module corresponding to the location, which may involve communicating with the module, sending a status query request, and receiving returned status information.

[0071] The system decides which data needs to be included in cache management based on predefined cache management strategies. These strategies may be based on factors such as the access frequency, size, and importance of the data. For data that needs to be included in cache management, the system will mark its status in the corresponding cache hit management module. This usually involves updating the data structure inside the module (such as cache tables, hash tables, etc.) to record information such as the cache location, validity period, and access count of the data. In order to ensure the consistency and accuracy of the data status, the system may need to synchronously update the status of the cache hit management module when the data is accessed, updated, or deleted. In addition, the system may also use periodic synchronization or event-triggered synchronization to maintain the consistency of the status.

[0072] By marking the cache hit management module status at the corresponding location, the following benefits are achieved:

[0073] Improve cache hit rate: By monitoring the status of the data management module in real time and marking the data status according to the cache management policy, the system can use cache resources more effectively, thereby improving the cache hit rate, which helps reduce the number of disk I / O operations and improve data access speed.

[0074] Optimize data processing performance: The system can dynamically adjust data processing strategies according to actual conditions, such as giving priority to data in the cache and delaying the processing of non-cached data. This helps to optimize data processing performance and improve the overall throughput of the system.

[0075] Enhanced system flexibility: By defining clear module states and cache management strategies, the system can more easily adapt to different application scenarios and data access patterns, which helps to enhance the flexibility and scalability of the system.

[0076] Improving System Stability and Reliability: By real-time monitoring of module status and synchronous updating of data status, the system can promptly detect and handle potential problems such as cache invalidation and data loss. This helps improve the system's stability and reliability, ensuring data integrity and consistency.

[0077] S140, if all hits occur in the second-level cache hit management sub-module to which the first-level data interaction sub-module belongs, data communication with the lower-level storage device is implemented in large granularity.

[0078] Specifically, when the system receives a data access request, it first attempts to find the data in the second-level cache hit management sub-module. If all the requested data can be found in the cache (i.e., all hits occur), the system confirms a cache hit. To improve data communication efficiency, the system divides the data into larger granularities (such as data blocks, data segments, etc.). This large-granularity data division helps reduce the number and overhead of data communication. When it is confirmed that all hits occur in the second-level cache hit management sub-module, the system communicates with the lower-level storage device (such as disk arrays, SSDs, etc.) in a large-granularity manner. This may involve strategies such as reading or writing large chunks of data and using batch operations to optimize data communication performance. After large-granularity data communication, the system needs to update the status information of the cache hit management sub-module to reflect the latest location and status of the data, which helps ensure the accuracy and efficiency of subsequent data access. To ensure data consistency, the system may need to perform data consistency synchronization with the lower-level storage device after data communication is completed, which typically involves verifying data, updating metadata, or performing other synchronization operations.

[0079] Implementing data communication with the lower-level storage device in large granularity has the following benefits:

[0080] Improving Data Communication Efficiency: By implementing data communication with the lower-level storage device in large granularity, the system can significantly reduce the number and overhead of data communication, thereby improving data communication efficiency. This helps speed up data access and enhance the overall performance of the system.

[0081] Optimizing Cache Utilization: When all hits occur in the second-level cache hit management sub-module, the system can make full use of the data resources in the cache, reducing the number of accesses to the lower-level storage device. This helps optimize cache utilization and improve the cache hit rate and performance.

[0082] Reducing System Overhead: Large-granularity data communication reduces the number and overhead of data communication, thereby reducing the overall system overhead. This helps save system resources and improve the energy efficiency and sustainability of the system.

[0083] Enhance system stability and reliability: By optimizing data communication and cache management strategies, the system can process data access requests more stably, reducing the risk of data loss and errors. This helps enhance the system's stability and reliability, ensuring data integrity and consistency.

[0084] S150, if some data enters the cache, according to the continuity of the data hit status, construct commands of corresponding lengths to the lower-level storage device respectively to achieve direct access and data synchronization.

[0085] Specifically, the system maintains a hit status flag for each data item to record whether the data item is cached and the number of times it has been cached. This helps the system understand the cache situation and hit frequency of the data. The system adopts a continuity analysis algorithm to analyze the continuity of the data hit status. This algorithm can identify which data items are continuously hit in the cache and which data items show intermittent hits or misses. To determine the degree of data continuity, the system sets a continuity threshold. When the number of hits of a data item exceeds this threshold, the system considers that the data item has a continuous hit status.

[0086] According to the continuity of the data hit status, the system constructs commands of corresponding lengths respectively. For data items with continuous hits, the system can construct a longer command to access or synchronize multiple data items at once. For data items with intermittent hits or misses, the system constructs shorter commands or multiple commands separately. The system sends the constructed commands to the lower-level storage device through the interface or communication protocol of the lower-level storage device. These commands may include operations such as reading, writing, updating, or deleting, depending on the type of data access request. When the lower-level storage device receives the command, it directly accesses the corresponding data item according to the content of the command. For data items with continuous hits, the system can improve the access efficiency by accessing multiple data items at once. During the direct access process, the system also ensures that the data in the cache is consistent with the data in the lower-level storage device. This usually involves data verification, updating metadata, or performing other synchronization operations.

[0087] By constructing commands of corresponding lengths to the lower-level storage device respectively, the following benefits are achieved:

[0088] Improve access efficiency: By constructing commands of corresponding lengths according to the continuity of the data hit status, the system can reduce the number of data accesses and overheads, thereby improving access efficiency. Especially for data items with continuous hits, the system can significantly improve the access speed by accessing multiple data items at once.

[0089] Optimize cache utilization: The system can more accurately understand which data items are frequently accessed, thereby optimizing the allocation and use of the cache. This helps reduce cache waste and improve cache utilization.

[0090] Enhanced data consistency: Through direct access and data synchronization mechanisms, the system can ensure that the data in the cache is consistent with the data in the underlying storage device. This helps reduce the risk of data inconsistency and improve the reliability and integrity of the data.

[0091] Reduced system overhead: By reducing the number of data accesses and optimizing the cache management strategy, the system can reduce the overall overhead, which helps save system resources and improve the energy efficiency and sustainability of the system.

[0092] Specifically, when encountering sequential small command IO accesses or random small command IO accesses that accumulate over a certain period of time, a state where all hits occur in the second-level cache hit management sub-module can be formed, which is equivalent to the above situation and enables large command hard disk interaction. Another example is in the case of composite applications, where a state of partial hits in the second-level cache hit management sub-module is formed. At this time, the concept of the first-level data interaction sub-module can be ignored, and based on the continuity of the second-level cache hit management sub-module, the command size for hard disk interaction can be constructed, resulting in two access methods:

[0093] 1. Direct data access: For data that is partially in the cache, if there is an upper-layer read command, it is directly obtained from the cache; when data synchronization with the disk side is required, according to the data continuity, interaction commands with the disk side are flexibly constructed, such as executing four commands (cmd1 - 4) of 4N, 2N, 1N, and 2N and directly writing to the disk side. If an unhit blank data segment is accessed, it is read back from the disk side to the cache and simultaneously returned to the upper-layer application (cmd5) to obtain the most direct disk-side data access.

[0094] 2. Prefetch access: In some scenarios, it is highly likely that adjacent data will be accessed. Therefore, based on the hierarchical data management module, the data of the entire first-level data interaction sub-module can be prefetched in advance to avoid data holes in the cache, that is, synchronize the cache and the disk side data in advance. Subsequently, accesses can be directly executed in the cache, avoiding disk-side interaction caused by read data merging, which can greatly improve the response speed and performance.

[0095] Taking the application of establishing cache management in the operating system as an example, in the system device driver layer, DDR space can be used as the cache physical device, and the idle memory space can be utilized to accelerate the read and write performance.

[0096] Specifically, a storage device can be partitioned and stores the file system data itself and user data. The file system implements file management and organization on the storage device or partition, and manages the logical and physical structure identifiers of operating system files and user files by converting them into data logical units such as sectors or logical block addresses (LBAs). The data of these file systems themselves is also stored. Taking the NTFS file system as an example, there is system data in the first and middle segments of the partition logical address, including the boot data BPB, the master file table MFT, the backup MFT, etc. starting from the partition start address. For file system data, as records such as system information and file indexes, its data access unit is relatively small; while for user data, different applications have different access unit requirements, which may be relatively large. According to the composition of the file system and user data, segmenting the cache object for management can be executed using different data management units respectively. For example, for file system data, the first-level data interaction sub-module and the second-level cache hit management sub-module are unified to the size of the LBA; while for user data, a larger first-level data interaction sub-module is adopted and divided into smaller second-level cache hit management sub-modules, so as to meet their respective different access requirements and improve the effectiveness and response of the interaction with the hard disk.

[0097] The above method of segmented multi-level data cache management, after receiving an upper-layer data access request, splits the data according to the logical address relationship and quickly locates the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module. This mechanism reduces the data search time and improves the response speed of data access. In addition, querying the module status of the location according to the actual situation and marking the data that needs to be incorporated into cache management ensure the effective utilization of cache resources. This dynamic management strategy can flexibly adjust the cache content according to the actual situation of data access, improve the cache hit rate, and reduce cache redundancy. When all hits occur in the second-level cache hit management sub-module to which the first-level data interaction sub-module belongs, data communication with the lower-layer storage device is implemented at a large granularity, reducing the number of data communication times and the data transmission volume, and further improving the overall efficiency of data access. For the case where some data enters the cache, according to the continuity of the data hit status, commands of corresponding lengths are respectively constructed to the lower-layer storage device. This approach not only realizes the direct access to the data, but also ensures the consistency of the data between different-level storage devices, enhancing the data synchronization ability and access flexibility of the system. That is to say, the present invention can effectively reduce the system overhead and improve the overall performance while ensuring the data access efficiency and accuracy, which has significant practical application value for application scenarios that need to process a large number of data access requests, such as database management, big data analysis, etc.

[0098] Figure 2It is a schematic block diagram of a device 300 for segmented multi-level data cache management provided by an embodiment of the present invention. As Figure 2 shown, corresponding to the above method for segmented multi-level data cache management, the present invention also provides a device 300 for segmented multi-level data cache management. The device 300 for segmented multi-level data cache management includes units for executing the above method for segmented multi-level data cache management, and the device can be configured in a server. Specifically, please refer to Figure 2 and the device 300 for segmented multi-level data cache management includes a definition unit 301, a receiving and splitting obtaining unit 302, a query and marking unit 303, a communication unit 304, and a construction and synchronization unit 305;

[0099] The definition unit 301 is used to define a hierarchical data management module, and the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module;

[0100] The receiving and splitting obtaining unit 302 is used to receive an upper-layer data access request, split the data according to the logical address relationship, and obtain the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module;

[0101] The query and marking unit 303 is used to query the module status of the location according to the actual situation, and for the data that needs to be included in the cache management, mark the cache hit management module status of the corresponding location;

[0102] The communication unit 304 is used to, if all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, implement data communication with the lower-layer storage device according to a large granularity;

[0103] The construction and synchronization unit 305 is used to, if part of the data enters the cache, respectively construct commands with corresponding lengths to the lower-layer storage device according to the continuity of the data hit status, so as to implement direct access and data synchronization.

[0104] In an embodiment, the device further includes: a loading unit, which is used to pre-load potential access objects into the cache. When the target data is accessed, regardless of its size, the entire target data is read out completely from the lower-layer storage device and loaded into the cache.

[0105] In an embodiment, in the definition unit 301, it is further used to construct segmented cache management intervals, that is, multiple data management modules, and each data management module has different first-level data interaction sub-modules and second-level cache hit management sub-modules.

[0106] In one embodiment, the first-level data interaction sub-module corresponds to a continuous memory area on the virtual address and serves as the target module for communicating with the lower-layer storage device; the second-level cache hit management sub-module divides the first-level data interaction sub-module into several small modules for receiving and storing IO data and recording the cache hit or miss status of the data.

[0107] It should be noted that those skilled in the art can clearly understand the specific implementation processes of the above-described segmented multi-level data cache management device 300 and each unit, which can refer to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity of description, they will not be elaborated herein.

[0108] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 3 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it realizes the functions or steps on the server side of a method for segmented multi-level data cache management.

[0109] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0110] Define a hierarchical data management module, where the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module; receive an upper-layer data access request, split the data according to the logical address relationship to obtain the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module; query the module status of the corresponding position according to the actual situation, and mark the cache hit management module status of the corresponding position for the data that needs to be included in the cache management; if all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, communicate with the lower-layer storage device in a large granularity; if some data enters the cache, construct commands of corresponding lengths to the lower-layer storage device respectively according to the continuity of the data hit status to achieve direct access and data synchronization.

[0111] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:

[0112] Define a hierarchical data management module, where the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module; receive an upper-layer data access request, and perform data splitting according to the logical address relationship to obtain the positions of the first-level data interaction sub-module and the second-level cache hit management sub-module; query the module status of the corresponding position according to the actual situation, and for the data that needs to be included in the cache management, mark the cache hit management module status of the corresponding position; if all the second-level cache hit management sub-modules to which the first-level data interaction sub-module belongs are hit, perform data communication with the lower-layer storage device according to a large granularity; if some data enters the cache, construct commands of corresponding lengths to the lower-layer storage device respectively according to the continuity of the data hit status to achieve direct access and data synchronization.

[0113] It should be noted that for the functions or steps that the above computer-readable storage medium or computer device can achieve, reference can be made to the relevant descriptions on the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described in detail here.

[0114] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0115] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0116] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements 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 the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for managing segmented multi-level data cache, characterized in that: include: Defining a hierarchical data management module, the data management module includes a first-level data interaction submodule and a second-level cache hit management submodule; Receive upper-layer data access requests, split data according to logical address relationships, and obtain the locations of the first-level data interaction submodule and the second-level cache hit management submodule; Query the module status of the corresponding location according to the actual situation, and mark the cache hit management module status of the corresponding location for the data that needs to be included in the cache management; If all the second-level cache hit management submodules to which the first-level data interaction submodule belongs are hit, data communication with the lower-level storage device is realized in a large granularity; If part of the data enters the cache, commands of corresponding lengths are constructed to the lower-level storage device according to the continuity of the data hit status to achieve direct access and data synchronization.

2. The method for managing segmented multi-level data cache according to claim 1, characterized in that: The hierarchical data management module is defined, and after the data management module includes the first-level data interaction submodule and the second-level cache hit management submodule steps, it also includes: loading potential access objects into the cache in advance, and when the target data is accessed, regardless of its size, the entire target data is read out from the lower-level storage device and loaded into the cache.

3. The method for managing segmented multi-level data cache according to claim 1, characterized in that: The hierarchical data management module is defined, and the data management module includes a first-level data interaction sub-module and a second-level cache hit management sub-module step, and also includes: constructing a segmented cache management interval, that is, multiple data management modules, each data management module has a different first-level data interaction sub-module and a second-level cache hit management sub-module.

4. The method for managing segmented multi-level data cache according to claim 1, characterized in that: The first-level data interaction submodule corresponds to the continuous memory area on the virtual address and serves as the target module for communicating with the lower-level storage device; the second-level cache hit management submodule divides the first-level data interaction submodule into several small modules for receiving IO data storage and recording the cache hit or miss status of the data.

5. A device for segmented multi-level data cache management, characterized in that: include: A definition unit, used to define a hierarchical data management module, wherein the data management module includes a first-level data interaction submodule and a second-level cache hit management submodule; A receiving splitting obtaining unit is used to receive an upper layer data access request, split the data according to the logical address relationship, and obtain the positions of the first-level data interaction submodule and the second-level cache hit management submodule; A query marking unit is used to query the module status of the corresponding position according to the actual situation, and mark the cache hit management module status of the corresponding position for the data that needs to be included in the cache management; A communication unit, configured to implement data communication with a lower-level storage device at a large granularity if all second-level cache hit management submodules to which the first-level data interaction submodules belong have hits; A synchronization unit is constructed to construct commands of corresponding lengths to the lower storage device according to the continuity of the data hit status if part of the data enters the cache, so as to achieve direct access and data synchronization.

6. The device for managing segmented multi-level data cache according to claim 5, characterized in that: The device also includes: a loading unit, which is used to load potential access objects into the cache in advance. When the target data is accessed, regardless of its size, the entire target data is completely read out from the lower storage device and loaded into the cache.

7. The device for managing segmented multi-level data cache according to claim 5, characterized in that: The definition unit is also used to construct segmented cache management intervals, that is, multiple data management modules, each of which has a different first-level data interaction submodule and a second-level cache hit management submodule.

8. The device for managing segmented multi-level data cache according to claim 5, characterized in that: The first-level data interaction submodule corresponds to the continuous memory area on the virtual address and serves as the target module for communicating with the lower-level storage device; the second-level cache hit management submodule divides the first-level data interaction submodule into several small modules for receiving IO data storage and recording the cache hit or miss status of the data.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method for managing segmented multi-level data cache as claimed in any one of claims 1 to 4 are implemented.

10. A storage medium, wherein the computer-readable storage medium stores a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method for managing segmented multi-level data cache as claimed in any one of claims 1 to 4 are implemented.

Citation Information

Cited By

  • Cache strategy configuration method, electronic equipment and storage medium

    CN121210515A

  • Data reading method, cache management system and electronic equipment

    CN121478676A