Buffer management method, device and storage apparatus

By dividing the storage system into task-type buffer regions and dynamically adjusting the buffer allocation speed, the problem of unstable storage system performance caused by frequent changes in buffer usage status is solved, achieving intelligent and efficient buffer management and performance improvement.

CN116483260BActive Publication Date: 2026-11-20HANGZHOU HIKSTORAGE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310219137.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2026-11-20
Estimated Expiration
2043-03-08

AI Technical Summary

Technical Problem

In existing technologies, the frequent changes in the usage state of buffers lead to unstable storage system performance and make efficient management difficult.

Method used

By dividing the storage system into buffer regions corresponding to task types and dynamically adjusting the buffer allocation speed based on the task type's buffer allocation speed, a hardware-implemented buffer management component is used to manage the buffers.

Benefits of technology

It achieves intelligent and efficient management of the buffer, reduces the overhead of CPU management of the buffer, avoids sudden changes in storage performance, and improves the stability of the storage system and the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116483260B_ABST
    Figure CN116483260B_ABST
Patent Text Reader

Abstract

The application provides a Buffer management method and device and a storage device. The embodiment divides Buffer space in a storage system into Buffer areas corresponding to at least one task type, and allocates required available target Buffer blocks for each task from the Buffer area corresponding to the task type of each task based on real-time Buffer allocation speed of each task, thereby avoiding the defect of poor performance of the entire storage system caused by the constant change of Buffer usage state due to frequent reading and writing of Buffer cached data, achieving intelligent and efficient management of Buffer, and the embodiment implements intelligent and efficient management of Buffer based on a hardware-implemented Buffer management component, which can reduce the overhead of CPU managing Buffer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to storage technology, and in particular to buffer management methods, apparatus and storage devices. Background Technology

[0002] Buffers, acting as data caches, are crucial for the normal and efficient operation of storage. Taking solid-state drives (SSDs) as an example, common uses of buffers in SSDs include, but are not limited to, the following: Store mapping tables, such as L2P Table, P2L Table, and various Bitmap Tables; Cache read / write (I / O) data; Cache log data; Data cached in a buffer is frequently read and written, and the buffer's usage state constantly changes, directly impacting the performance of the entire storage system. Therefore, efficient buffer management is a pressing technical problem that needs to be solved. Summary of the Invention

[0003] This application provides a buffer management method, apparatus, and storage device to achieve buffer management.

[0004] The embodiments of this application provide the following technical solutions: A buffer management method for a storage system, wherein a hardware-based buffer management component is deployed in the storage system, the buffer management component accesses the memory in the storage system through the system bus of the storage system, and the method is applied to the buffer management component, comprising: If it is determined that a buffer needs to be allocated for the target task, based on the buffer allocation speed corresponding to the target task type, the available target buffer block required by the target task is obtained from the buffer area corresponding to the target task type, and the target task is executed based on the target buffer block; the specified buffer space in the storage system is divided into at least one buffer area corresponding to the task type, and each buffer area includes at least one buffer block; If, in the current adjustment period, it is determined that the current Buffer allocation speed corresponding to the target task type needs to be adjusted, and if, based on the number of available buffer blocks occupied in the Buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task, it is estimated that the number of available buffer blocks in the Buffer area corresponding to the target task type in the current adjustment period is insufficient, then the Buffer allocation speed is reduced. This is to suppress sudden changes in storage performance caused by insufficient available buffer blocks in the Buffer area corresponding to the target task type when performing Buffer allocation in the current adjustment period.

[0005] A buffer management device for a storage system, the device being applied to a hardware-based buffer management component deployed in the storage system, the buffer management component accessing the memory of the storage system via a system bus in the storage system, the device comprising: The buffer allocator, implemented in hardware, is used to, when it is determined that a buffer needs to be allocated for a target task, obtain the available target buffer block required by the target task from the buffer area corresponding to the target task type based on the current buffer allocation speed corresponding to the target task type, and execute the target task based on the target buffer block; the specified buffer space in the storage system is divided into at least one buffer area corresponding to the task type, and each buffer area includes at least one buffer block. The buffer allocation controller, implemented in hardware, is used to reduce the buffer allocation speed when it is determined in the current adjustment period that the current buffer allocation speed corresponding to the target task type needs to be adjusted. If, based on the number of available buffer blocks occupied in the buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task, it is estimated that the number of available buffer blocks in the buffer area corresponding to the target task type in the current adjustment period is insufficient, the buffer allocation speed is reduced. This is to suppress sudden changes in storage performance caused by insufficient available buffer blocks in the buffer area corresponding to the target task type when performing buffer allocation in the current adjustment period.

[0006] A storage device, the storage device comprising at least: a hardware-based buffer management component, a buffer, and a system bus; The buffer management component accesses the buffer through the system bus in the storage device; the buffer management component is used to execute any of the buffer management methods applied to the storage system provided in the embodiments of this application.

[0007] As can be seen from the above technical solutions, in this application, by reasonably dividing the buffer space in the storage system into at least one buffer area corresponding to a task type, and based on the real-time buffer allocation speed of each task, allocating the required available target buffer blocks from the buffer area corresponding to the task type of each task, the performance defects of the entire storage system caused by the continuous changes in the buffer usage state due to the frequent reading and writing of data cached by the buffer are avoided, and the intelligent and efficient management of the buffer is realized.

[0008] Furthermore, this embodiment achieves intelligent and efficient management of the buffer through a hardware-based buffer management component, which reduces the overhead of CPU management of the buffer. Attached Figure Description

[0009] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0010] Figure 1 A flowchart illustrating the method provided in this application embodiment; Figure 2 This is a network structure diagram provided for an embodiment of this application; Figure 3 This is a schematic diagram of task processing provided for an embodiment of this application; Figure 4 A schematic diagram of buffer allocation adjustment provided in an embodiment of this application; Figures 5a to 5c This is a schematic diagram of the buffer region division provided in an embodiment of this application; Figure 6 This is a schematic diagram of a sharing request provided in an embodiment of this application; Figure 7a This is a schematic diagram of a data brushing operation provided in an embodiment of this application; Figure 7b This is a schematic diagram of a data elimination operation provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of the device provided in the embodiments of this application; Figure 9 This is a structural diagram of a hard disk device provided in an embodiment of this application. Detailed Implementation

[0011] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0012] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0013] To enable those skilled in the art to better understand the technical solutions provided in the embodiments of this application, and to make the above-mentioned objectives, features and advantages of the embodiments of this application more apparent and understandable, the technical solutions in the embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0014] To avoid frequent reading and writing of buffered data and the continuous changes in buffer usage status, this application provides a hardware-based buffer management method. This method involves first dividing the buffer area and then dynamically sharing the divided buffer areas. An example is described below: See Figure 1 , Figure 1 This is a flowchart illustrating a method provided in an embodiment of this application. The method is applied to a newly deployed hardware-based buffer management component in a storage system. Figure 2 As shown, the buffer management component is connected to the system bus of the storage system. Optionally, the system bus here refers to the information transmission bus, such as the Advanced eXtensible Interface (AXI) bus. The buffer management component accesses the buffer space corresponding to memories such as Double Data Rate (DDR) Synchronous Dynamic Random Access Memory (SDRAM), Static Random-Access Memory (SRAM), and Host Memory Buffer (HMB) through the aforementioned system bus.

[0015] Based on the above description, then as Figure 1 As shown, the process may include the following steps: Step 101: If it is determined that a buffer needs to be allocated for the target task, based on the buffer allocation speed corresponding to the target task type, obtain the available target buffer block required by the target task from the buffer area corresponding to the target task type, and execute the target task based on the target buffer block.

[0016] In this embodiment, the specified buffer space in the storage system, such as all or part of the buffer space in the storage system, will be reasonably divided into at least one buffer region corresponding to the task type, and each buffer region includes at least one buffer block; the following will describe how to divide the above-mentioned specified buffer space with examples, which will not be elaborated here.

[0017] In this embodiment, for example, Figure 3 For each task to be processed (denoted as the target task), the system will determine whether to allocate a buffer based on the current system state. There are many ways to determine whether to allocate a buffer based on the current system state. For example, if the current system state includes at least the number of currently available buffer blocks in the buffer area corresponding to the target task type, then determining whether to allocate a buffer based on the current system state could be as follows: check if the number of currently available buffer blocks in the buffer area corresponding to the target task type is greater than or equal to the number of available target buffer blocks required by the target task. If so, determine whether to allocate a buffer for the target task; otherwise, determine whether to allocate a buffer for the target task.

[0018] As an example, when it is determined that no buffer should be allocated for the target task at present, the target task can be blocked directly (that is, no buffer should be allocated for the target task for the time being).

[0019] As an example, when it is determined that a Buffer is currently allocated for the target task, as described in step 101, the available target Buffer block required by the target task is obtained from the Buffer area corresponding to the target task type based on the current Buffer allocation speed of the target task type, so as to execute the target task based on the target Buffer block.

[0020] In this embodiment, the buffer allocation speed corresponding to the target task type will be described in step 102 below, and will not be repeated here.

[0021] Step 102: If it is determined in the current adjustment period that the current Buffer allocation speed corresponding to the target task type needs to be adjusted, and if it is estimated that the number of available Buffer blocks in the Buffer area corresponding to the target task type is insufficient in the current adjustment period based on the number of available buffer blocks occupied in the Buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task, then the Buffer allocation speed is reduced so as to suppress the sudden change in storage performance caused by the insufficient available buffer blocks in the Buffer area corresponding to the target task type when performing Buffer allocation in the current adjustment period.

[0022] In this embodiment, an adjustment period can be set for adjusting the buffer allocation speed corresponding to the target task type. Once the adjustment period is reached, it is determined that the current buffer allocation speed corresponding to the target task type needs to be adjusted.

[0023] As an example, the adjustment of the buffer allocation speed corresponding to the target task type can be achieved through registers and timers. The registers store the adjustment period, and the timer is used for timing, specifically as follows: Figure 4 As shown. Once the timer reaches the aforementioned adjustment period, it is determined that the current buffer allocation speed corresponding to the target task type needs to be adjusted.

[0024] In this embodiment, the factors affecting the buffer allocation speed include at least one of the following: The execution speed of a task (indicating the level of demand on the buffer, i.e., the load pressure). Preset minimum speed for Tasks (different Tasks have different priorities and different minimum speed requirements); The number of available buffer blocks in the corresponding buffer region.

[0025] Based on this, in this embodiment, it is possible to estimate whether the number of available buffer blocks in the buffer area corresponding to the target task type in the current adjustment period meets the needs of the target task, based at least on the number of available buffer blocks occupied in the buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task. Based on this estimate, the buffer allocation speed corresponding to the target task type is adjusted.

[0026] For example, if it is estimated that the number of available buffer blocks in the buffer area corresponding to the target task type is insufficient (unable to meet the needs of the target task, determined based on the needs of the target task in the previous adjustment cycle), the buffer allocation speed is reduced. This is to suppress sudden changes in storage performance caused by insufficient available buffer blocks in the buffer area corresponding to the target task type during buffer allocation in the current adjustment cycle, allowing the storage system to maintain good performance, ensuring that the system has enough time to recover buffer resources, and improving the user experience. It should be noted that the reduction in buffer allocation speed described above in this embodiment is not limited to the magnitude of each reduction; it can be set according to actual needs.

[0027] For example, if it is estimated that there are enough available buffer blocks in the buffer area corresponding to the target task type, the buffer allocation speed can be increased, or the original buffer allocation speed can be maintained. The specific speed can be set according to the actual situation. Similarly, the increase in buffer allocation speed mentioned above is not limited to the magnitude of each increase, and can be set according to actual needs.

[0028] As can be seen, this embodiment dynamically adjusts the buffer allocation speed based on hardware, which can control the accuracy of allocating the required available target buffer blocks from the buffer area corresponding to the target task type to the target task, and reduce the CPU load, ensuring that the storage device has good performance.

[0029] This concludes the process. Figure 1 The process is shown below.

[0030] pass Figure 1 As can be seen from the process shown, in this embodiment, by reasonably dividing the buffer space in the storage system into at least one buffer area corresponding to a task type, and based on the real-time buffer allocation speed of each task, allocating the required available target buffer blocks from the buffer area corresponding to the task type of each task, the performance defects of the entire storage system caused by the continuous changes in the buffer usage state due to the frequent reading and writing of data cached by the buffer are avoided, and the intelligent and efficient management of the buffer is realized.

[0031] Furthermore, this embodiment achieves intelligent and efficient management of the buffer through a hardware-based buffer management component, which reduces the overhead of CPU management of the buffer.

[0032] The following describes the partitioning of the specified buffer space in the above storage system: In this embodiment, when partitioning a specified buffer space, at least the following three aspects can be considered: (1) The number and size of zones in Multi zone mode; (2) Size and uses of various types of memory (DDR, SRAM, HMB); (3) Buffer requirements for various types of tasks, including but not limited to Table, IO, and log.

[0033] Based on this, as an example, the specified buffer space is divided as follows: ① First, divide the buffer into zones to obtain the corresponding buffer subspaces for each zone. For example, if the SSD is divided into two zones with the same size and purpose, and each zone considers task types such as tables and data, the buffer partitioning would be as follows: Figure 5a As shown.

[0034] ② For each zone's corresponding Buffer subspace, the Buffer subspace of each zone is further divided into Buffer regions according to different task types to obtain the Buffer region corresponding to each task type.

[0035] Optionally, in a specific implementation, the buffer area corresponding to each task type shall include at least a dedicated buffer area for that task type.

[0036] As an example, for some task types, there may not be high performance requirements. In this case, the dedicated buffer area for this task type can be called the main buffer area for this task. For some task types, there may be high performance requirements. In this case, the dedicated buffer area for this task type can be further divided into a main buffer area and a backup buffer area. Figure 5b Examples are shown for the main buffer area (Data Buffer) and the spare buffer area (Spare Data Buffer) of Data, and the main buffer area (Table Buffer) and the spare buffer area (Spare Table Buffer) of Table.

[0037] In this embodiment, the backup buffer area is a reserve resource that is put into use when the main buffer area is insufficient or exhausted, so that the storage system can still maintain good performance when the main buffer area is in short supply, and the storage system has enough time to recover the resources of the main buffer area.

[0038] Based on the above description, the buffer area corresponding to the target task type includes at least a dedicated buffer area corresponding to the target task type; correspondingly, in step 101 above, obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type may include: If the number of available buffer blocks in the main buffer area of ​​the dedicated buffer area corresponding to the target task type meets the target buffer block required by the target task, then the target buffer block required by the target task is obtained from the main buffer area. If the number of available buffer blocks in the main buffer area is insufficient to meet the target buffer block required by the target task, then if there is a backup buffer area in the dedicated buffer area, the target buffer block required by the target task is obtained from the backup buffer area, or the first part of the buffer block required by the target task is obtained from the main buffer area, and the remaining part of the buffer block required by the target task is obtained from the backup buffer area; wherein, the sum of the number of the first part of the buffer block and the remaining part of the buffer block is the number of the target buffer block mentioned above.

[0039] As an example, in this embodiment, in addition to dividing the buffer subspace corresponding to at least one zone into a dedicated buffer area for each task type, a first shared buffer area is also divided. Each task type corresponding to the dedicated buffer area within the buffer subspace of the same zone shares this first shared buffer area.

[0040] Based on this, the Buffer region corresponding to the aforementioned target task type includes at least: a dedicated Buffer region for the target task type and a first shared Buffer region within the target Buffer subspace; the target Buffer subspace refers to the Buffer subspace where the dedicated Buffer region for the target task type is located. Correspondingly, in step 101 above, obtaining the available target Buffer block required by the target task from the Buffer region corresponding to the target task type may include: If the dedicated buffer area corresponding to the target task type does not meet the target buffer block requirements of the target task. Based on the priority of the target task, obtain the target buffer block required by the target task from the first shared buffer region in the target buffer subspace; or, The first portion of the buffer blocks required by the target task are obtained from the dedicated buffer area corresponding to the target task type. The portion of the buffer blocks includes at least one available buffer block in the main buffer area of ​​the dedicated buffer area and / or at least one available buffer block in the backup buffer area of ​​the dedicated buffer area. The remaining portion of the buffer blocks required by the target task are obtained from the first shared buffer area of ​​the target buffer subspace according to the priority of the target task. The sum of the number of the first portion of the buffer blocks and the remaining portion of the buffer blocks is the number of target buffer blocks.

[0041] In this embodiment, each Task stores its corresponding weight information in a hardware register. When multiple Tasks request the first shared Buffer area, the priority of each Task is calculated based on the corresponding scheduling algorithm (such as RR, WFQ, etc.) and the Task's weight information. The allocation quantity and order of Buffers for each Task are then determined according to the priority of each Task. That is, in this embodiment, the priority of the target task is calculated based on the weight value corresponding to the target task type. The priority of the target task indicates the order in which the target task obtains Buffer blocks from the first shared Buffer area and the number of Buffer blocks obtained.

[0042] It should be noted that in this embodiment, the weight information of each Task will be adjusted in real time according to the system status to optimize system storage performance.

[0043] In this embodiment, the specified buffer space further includes a shared buffer subspace, which corresponds to at least one zone in the SSD. This shared buffer subspace can be shared by all the aforementioned buffer subspaces, specifically as follows: Figure 5c As shown, the shared buffer subspace is divided into at least one second shared buffer region, and each buffer subspace shares the second shared buffer region.

[0044] Therefore, in this embodiment, the Buffer region corresponding to the target task type includes at least the available Buffer region and the second shared Buffer region in the target Buffer subspace. The available Buffer region in the target Buffer subspace includes at least the dedicated Buffer region corresponding to the target task type and the first shared Buffer region in the target Buffer subspace.

[0045] Correspondingly, step 101 above, obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type, includes: when the available buffer area in the target buffer subspace does not meet the target buffer block required by the target task, The target buffer blocks required by the target task are obtained from the second shared buffer region according to the priority of the target buffer subspace; the priority of the target buffer subspace indicates the order and number of buffer blocks obtained from the second shared buffer region; or, The first portion of the buffer blocks required by the target task are obtained from the target Buffer subspace. The portion of the buffer blocks includes at least one available buffer block in the dedicated buffer area corresponding to the target task type in the target Buffer subspace and / or at least one available buffer block in the first shared Buffer area. The remaining portion of the buffer blocks required by the target task are obtained from the second shared Buffer area according to the priority of the target Buffer subspace. The sum of the number of the first portion of the buffer blocks and the remaining portion of the buffer blocks is the number of target buffer blocks.

[0046] In this embodiment, when multiple buffer subspaces request the second shared buffer area, the priority of each buffer subspace is calculated according to the corresponding scheduling algorithm (such as RR, WFQ, etc.). The allocation quantity and order of each buffer subspace are then determined based on its priority. It can be seen that in this embodiment, the second shared buffer area can be shared by all buffer subspaces, improving buffer utilization efficiency when buffer subspace resources are scarce. Furthermore, since the buffer subspaces include dedicated buffer areas for different task types, this indirectly enables dedicated buffer areas for different task types to share the second shared buffer area, as well as different buffer subspaces to share the second shared buffer area. Figure 6 A diagram illustrating the sharing mechanism is provided.

[0047] It should be noted that in this embodiment, when the zone division changes, the buffer area division method will also be updated in real time. The specific update method can be referred to the buffer area division method described above, and will not be repeated here.

[0048] In this embodiment, after the target task is executed, the buffer block can be released and added to certain dedicated buffer areas, a first shared buffer area, or a second shared buffer area. For example, after the target task is executed, the target buffer block can be further released; the released target buffer block can be added to the main buffer area or backup buffer area of ​​the dedicated buffer area corresponding to the target task type; or, the released target buffer block can be added to the first shared buffer area in the target buffer subspace; or, the released target buffer block can be added to the second shared buffer area.

[0049] It should be noted that, regardless of whether the target buffer block is added to the dedicated buffer area, the first shared buffer area, or the second shared buffer area, it is necessary to ensure that the total number of buffer blocks in any buffer area that has been added to the target buffer block is less than or equal to the set buffer block number threshold for that buffer area.

[0050] In this embodiment, it is also necessary to further monitor the status of each Buffer subspace in real time. Once the Buffer subspace is found to be idle, the Buffer area in the Buffer subspace is temporarily added to the existing second shared Buffer area. The total number of Buffer blocks in any of the added second shared Buffer areas is less than or equal to the set threshold number of Buffer blocks in the second shared Buffer area.

[0051] Of course, if it is found that the state of any Buffer subspace changes from the previous idle state to the working state, the working state indicates that there is a task that needs to be executed based on the Buffer area in the Buffer subspace, then the Buffer area in the Buffer subspace is separated from the second shared Buffer area to ensure the storage system.

[0052] In this embodiment, in order to improve system performance and ensure system data security, a reasonable buffer flushing and eviction mechanism needs to be adopted.

[0053] For example, a data flush operation can be performed on the dirty buffer area storing dirty data to flush the dirty data in the dirty buffer area to the corresponding hard drive. Dirty data refers to data in the dirty buffer area that has been updated. Specifically, performing a data flush operation on the dirty buffer area storing dirty data includes: locating the corresponding dirty buffer area based on the header and offset of the dirty buffer area in the buffer linked list; determining the priority of the located dirty buffer area based on the data information in the dirty buffer area; the data information includes at least: the time the data exists and the update frequency; determining the target dirty buffer area to be flushed (e.g., the dirty buffer area with the highest priority) based on the priority of each dirty buffer area; and performing the data flush operation on the target dirty buffer area. This can achieve flushing of data in the dirty buffer at an appropriate time, increase the number of available buffers in the system, and ensure that data is written to disk in a timely manner to prevent data loss due to power failure. Figure 7a An example is shown illustrating a data flushing operation.

[0054] For example, a data eviction operation can be performed on a clean buffer area storing clean data to delete clean data from the clean buffer area. Clean data refers to data in the clean buffer area that has not been updated within a specified time period. Specifically, performing a data eviction operation on a clean buffer area storing clean data includes: locating the corresponding clean buffer area based on the header and offset of the clean buffer area in the buffer linked list; determining the priority of the located clean buffer area based on the data information in the located clean buffer area; the data information includes at least: the time the data exists and its update frequency; determining the target clean buffer area to be evicted based on the priority of each clean buffer area; and performing the data eviction operation on the target clean buffer area. This allows for the eviction of data with the lowest access probability based on the different likelihoods of future access, thus improving system performance. Figure 7b An example is given of the data eviction operation.

[0055] The methods provided in the embodiments of this application have been described above. The apparatus provided in the embodiments of this application is described below: See Figure 8 , Figure 8 This is a structural diagram of a device provided in an embodiment of this application. The device is applied to a hardware-based buffer management component deployed in the storage system. The buffer management component accesses the memory in the storage system via the system bus. The device includes: The buffer allocator, implemented in hardware, is used to, when it is determined that a buffer needs to be allocated for a target task, obtain the available target buffer block required by the target task from the buffer area corresponding to the target task type based on the current buffer allocation speed corresponding to the target task type, and execute the target task based on the target buffer block; the specified buffer space in the storage system is divided into at least one buffer area corresponding to the task type, and each buffer area includes at least one buffer block. The buffer allocation controller, implemented in hardware, is used to reduce the buffer allocation speed when it is determined in the current adjustment period that the current buffer allocation speed corresponding to the target task type needs to be adjusted. If, based on the number of available buffer blocks occupied in the buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task, it is estimated that the number of available buffer blocks in the buffer area corresponding to the target task type in the current adjustment period is insufficient, the buffer allocation speed is reduced. This is to suppress sudden changes in storage performance caused by insufficient available buffer blocks in the buffer area corresponding to the target task type when performing buffer allocation in the current adjustment period.

[0056] Optionally, the buffer area corresponding to any task type includes at least: a dedicated buffer area; the dedicated buffer area includes a main buffer area, or a main buffer area and a backup buffer area; The buffer area corresponding to the target task type includes at least a dedicated buffer area corresponding to the target task type. The step of obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: If the number of available buffer blocks in the main buffer area of ​​the dedicated buffer area corresponding to the target task type meets the target buffer block required by the target task, then the target buffer block required by the target task is obtained from the main buffer area. If the number of available buffer blocks in the main buffer area is insufficient to meet the target buffer block required by the target task, then if a backup buffer area exists in the dedicated buffer area, the target buffer block required by the target task is obtained from the backup buffer area, or the first part of the buffer block required by the target task is obtained from the main buffer area, and the remaining part of the buffer block required by the target task is obtained from the backup buffer area; the sum of the number of the first part of the buffer block and the remaining part of the buffer block is the number of the target buffer block.

[0057] Optionally, the designated buffer space includes the buffer subspaces corresponding to each zone of the solid-state drive (SSD) in the storage system; at least one zone's buffer subspace is divided into a first shared buffer area in addition to a dedicated buffer area for the task type. The buffer area corresponding to the target task type includes at least: a dedicated buffer area corresponding to the target task type and a first shared buffer area in the target buffer subspace; the target buffer subspace refers to the buffer subspace where the dedicated buffer area corresponding to the target task type is located. Obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: when the dedicated buffer area corresponding to the target task type does not meet the requirements for the target buffer block required by the target task. Based on the priority of the target task, the target buffer blocks required by the target task are obtained from the first shared buffer region in the target buffer subspace; the priority of the target task is calculated based on the weight value corresponding to the target task type, and the priority of the target task indicates the order in which the target task obtains buffer blocks from the first shared buffer region and the number of buffer blocks obtained; or, The first portion of the buffer blocks required by the target task are obtained from the dedicated buffer area corresponding to the target task type. The first portion of the buffer blocks includes at least one available buffer block in the main buffer area of ​​the dedicated buffer area and / or at least one available buffer block in the backup buffer area of ​​the dedicated buffer area. The remaining portion of the buffer blocks required by the target task are obtained from the first shared buffer area of ​​the target buffer subspace according to the priority of the target task. The sum of the number of the first portion of the buffer blocks and the remaining portion of the buffer blocks is the number of the target buffer blocks.

[0058] Optionally, the designated Buffer space further includes a shared Buffer subspace; the shared Buffer subspace is divided into at least one second shared Buffer region, and each Buffer subspace shares the second shared Buffer region; The buffer area corresponding to the target task type includes at least the available buffer area and the second shared buffer area in the target buffer subspace; the available buffer area in the target buffer subspace includes at least the dedicated buffer area corresponding to the target task type and the first shared buffer area. The step of obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: If the available buffer area in the target buffer subspace does not meet the target buffer block required by the target task. The target buffer blocks required by the target task are obtained from the second shared buffer region according to the priority of the target buffer subspace; the priority of the target buffer subspace indicates the order and number of buffer blocks obtained from the second shared buffer region; or, The first portion of the buffer blocks required by the target task are obtained from the target Buffer subspace, the first portion of the buffer blocks including at least one available buffer block in the dedicated Buffer area corresponding to the target task type in the target Buffer subspace and / or at least one available buffer block in the first shared Buffer area; and the remaining portion of the buffer blocks required by the target task are obtained from the second shared Buffer area according to the priority of the target Buffer subspace; the sum of the first portion of the buffer blocks and the remaining portion of the buffer blocks is the number of target buffer blocks.

[0059] Optionally, after the target task is completed, the buffer allocator further releases the target buffer block; The released target Buffer block is added to the main Buffer area or backup Buffer area of ​​the dedicated Buffer area corresponding to the target task type; or, the released target Buffer block is added to the first shared Buffer area in the target Buffer subspace; or, the released target Buffer block is added to the second shared Buffer area; wherein, the total number of Buffer blocks in any Buffer area that has been added to the target Buffer block is less than or equal to the set threshold number of Buffer blocks for that Buffer area.

[0060] Optionally, when at least one buffer subspace is idle, the buffer area in the buffer subspace is temporarily added to the existing second shared buffer area; wherein the total number of buffer blocks in any of the added second shared buffer areas is less than or equal to the set buffer block number threshold of the second shared buffer area.

[0061] Optionally, when the state of any Buffer subspace switches from an idle state to a working state, the working state indicates that a task needs to be executed based on the Buffer area in that Buffer subspace, and then the Buffer area in that Buffer subspace is stripped from the second shared Buffer area.

[0062] Optionally, the buffer allocator further performs a data flush operation on the dirty buffer area storing dirty data, so as to flush the dirty data in the dirty buffer area to the corresponding hard disk based on the data flush operation; the dirty data refers to the data in the dirty buffer area that has been updated.

[0063] Optionally, the buffer allocator further performs a data eviction operation based on the clean buffer area storing clean data, to delete the clean data in the clean buffer area based on the data eviction operation; the clean data refers to data in the clean buffer area that has not been updated within a set time period.

[0064] Optionally, performing a data flush operation on the dirty buffer area storing dirty data includes: locating the corresponding dirty buffer area based on the header and offset of the dirty buffer area in the buffer linked list; determining the priority of the dirty buffer area based on the data information in the located dirty buffer area; the data information includes at least: the time the data exists and the update frequency; determining the target dirty buffer area to be flushed based on the priority of each dirty buffer area; and performing the data flush operation on the target dirty buffer area. Optionally, performing a data eviction operation based on the clean buffer area storing clean data includes: locating the corresponding clean buffer area according to the header and offset of the clean buffer area in the buffer linked list; determining the priority of the clean buffer area based on the data information in the located clean buffer area; the data information includes at least: the time the data exists and the update frequency; determining the target clean buffer area for which a data eviction operation needs to be performed based on the priority of each clean buffer area; and performing a data eviction operation on the target clean buffer area.

[0065] This concludes the device structure diagram provided in the example provided in this application.

[0066] Correspondingly, embodiments of this application also provide a storage device, specifically as follows: Figure 9 As shown, the storage device includes at least: a hardware-based buffer management component, a buffer, and a system bus; The buffer management component accesses the buffer via the system bus in the storage device; the buffer management component is used to perform actions such as... Figure 1 The steps in the method shown.

[0067] Based on the same application concept as the above method, this application embodiment also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the method disclosed in the above examples of this application.

[0068] For example, the aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, etc. For instance, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.

[0069] The systems, devices, modules, or units described in the above embodiments can be implemented by a computer entity or by a product with a certain function. A typical implementation device is a computer, which can be a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email sending and receiving device, game console, tablet computer, wearable device, or any combination of these devices.

[0070] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.

[0071] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0072] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0073] Furthermore, these computer program instructions can also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in the process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0074] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0075] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A buffer management method applied to a storage system, characterized in that, A hardware-based buffer management component is deployed in the storage system. This buffer management component accesses the memory in the storage system via the system bus. The method applied to the buffer management component includes: If it is determined that a buffer needs to be allocated for the target task, based on the buffer allocation speed corresponding to the target task type, the available target buffer block required by the target task is obtained from the buffer area corresponding to the target task type, and the target task is executed based on the target buffer block; the specified buffer space in the storage system is divided into at least one buffer area corresponding to the task type, and each buffer area includes at least one buffer block; When the current adjustment period arrives, if it is determined that the current buffer allocation speed corresponding to the target task type needs to be adjusted, and if the number of available buffer blocks in the buffer area corresponding to the target task type is estimated to be insufficient in the current adjustment period based on the number of available buffer blocks occupied in the previous adjustment period and / or the execution speed of the target task, then the buffer allocation speed is reduced, so as to suppress the sudden change in storage performance caused by the insufficient available buffer blocks in the buffer area corresponding to the target task type when performing buffer allocation in the current adjustment period.

2. The method according to claim 1, characterized in that, The buffer area corresponding to any task type shall include at least: a dedicated buffer area; the dedicated buffer area includes a main buffer area, or a main buffer area and a backup buffer area; The buffer area corresponding to the target task type includes at least a dedicated buffer area corresponding to the target task type. The step of obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: If the number of available buffer blocks in the main buffer area of ​​the dedicated buffer area corresponding to the target task type meets the target buffer block required by the target task, then the target buffer block required by the target task is obtained from the main buffer area. If the number of available buffer blocks in the main buffer area is insufficient to meet the target buffer block required by the target task, then if a backup buffer area exists in the dedicated buffer area, the target buffer block required by the target task is obtained from the backup buffer area, or the first part of the buffer block required by the target task is obtained from the main buffer area, and the remaining part of the buffer block required by the target task is obtained from the backup buffer area; the sum of the number of the first part of the buffer block and the remaining part of the buffer block is the number of the target buffer block.

3. The method according to claim 2, characterized in that, The designated buffer space includes the buffer subspaces corresponding to each zone of the solid-state drive (SSD) in the storage system; at least one zone's buffer subspace is divided into a dedicated buffer area for task types and a first shared buffer area. The buffer area corresponding to the target task type includes at least: a dedicated buffer area corresponding to the target task type and a first shared buffer area in the target buffer subspace; the target buffer subspace refers to the buffer subspace where the dedicated buffer area corresponding to the target task type is located. Obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: when the dedicated buffer area corresponding to the target task type does not meet the requirements for the target buffer block required by the target task. Based on the priority of the target task, the target buffer blocks required by the target task are obtained from the first shared buffer region in the target buffer subspace; the priority of the target task is calculated based on the weight value corresponding to the target task type, and the priority of the target task indicates the order in which the target task obtains buffer blocks from the first shared buffer region and the number of buffer blocks obtained; or, The first portion of the buffer blocks required by the target task are obtained from the dedicated buffer area corresponding to the target task type. The first portion of the buffer blocks includes at least one available buffer block in the main buffer area of ​​the dedicated buffer area and / or at least one available buffer block in the backup buffer area of ​​the dedicated buffer area. The remaining portion of the buffer blocks required by the target task are obtained from the first shared buffer area of ​​the target buffer subspace according to the priority of the target task. The sum of the number of the first portion of the buffer blocks and the remaining portion of the buffer blocks is the number of the target buffer blocks.

4. The method according to claim 3, characterized in that, The designated Buffer space also includes a shared Buffer subspace; the shared Buffer subspace is divided into at least one second shared Buffer region, and each Buffer subspace shares the second shared Buffer region. The buffer area corresponding to the target task type includes at least the available buffer area and the second shared buffer area in the target buffer subspace; the available buffer area in the target buffer subspace includes at least the dedicated buffer area corresponding to the target task type and the first shared buffer area. The step of obtaining the available target buffer block required by the target task from the buffer area corresponding to the target task type includes: If the available buffer area in the target buffer subspace does not meet the target buffer block required by the target task. The target buffer blocks required by the target task are obtained from the second shared buffer region according to the priority of the target buffer subspace; the priority of the target buffer subspace indicates the order and number of buffer blocks obtained from the second shared buffer region; or, The first portion of the buffer block required by the target task is obtained from the target buffer subspace. The first portion of the buffer block includes at least one available buffer block in the dedicated buffer area corresponding to the target task type in the target buffer subspace and / or at least one available buffer block in the first shared buffer area. And obtain the remaining Buffer blocks required by the target task from the second shared Buffer area according to the priority of the target Buffer subspace; the sum of the first Buffer blocks and the remaining Buffer blocks is the number of target Buffer blocks.

5. The method according to claim 4, characterized in that, After the target task is completed, the method further includes: Release the target buffer block; The released target Buffer block is added to the main Buffer area or backup Buffer area of ​​the dedicated Buffer area corresponding to the target task type; or, the released target Buffer block is added to the first shared Buffer area in the target Buffer subspace; or, the released target Buffer block is added to the second shared Buffer area; wherein, the total number of Buffer blocks in any Buffer area that has been added to the target Buffer block is less than or equal to the set threshold number of Buffer blocks for that Buffer area.

6. The method according to claim 4 or 5, characterized in that, The method further includes: When at least one Buffer subspace is idle, the Buffer area in that Buffer subspace is temporarily added to the existing second shared Buffer area; wherein the total number of Buffer blocks in any of the added second shared Buffer areas is less than or equal to the set threshold number of Buffer blocks in that second shared Buffer area. When the state of any Buffer subspace switches from idle to working, the working state indicates that a task needs to be executed based on the Buffer area in that Buffer subspace, and the Buffer area of ​​that Buffer subspace is then removed from the second shared Buffer area.

7. The method according to claim 1, characterized in that, The method further includes: A data flush operation is performed on the dirty buffer area storing dirty data to flush the dirty data in the dirty buffer area to the corresponding hard disk based on the data flush operation; the dirty data refers to the data in the dirty buffer area that has been updated; A data eviction operation is performed on the clean buffer area where clean data is stored, to delete the clean data in the clean buffer area based on the data eviction operation; the clean data refers to data in the clean buffer area that has not been updated within a set time period.

8. The method according to claim 7, characterized in that, The data flushing operation performed on the dirty buffer area storing dirty data includes: locating the corresponding dirty buffer area based on the header and offset of the dirty buffer area in the buffer linked list; determining the priority of the dirty buffer area based on the data information in the located dirty buffer area; the data information includes at least: the time the data exists and the update frequency; determining the target dirty buffer area to be flushed based on the priority of each dirty buffer area; and performing the data flushing operation on the target dirty buffer area. The data eviction operation performed based on the clean buffer area storing clean data includes: Based on the header and offset of the clean buffer region in the Buffer linked list, the corresponding clean buffer region is located. The priority of the located clean buffer region is determined based on the data information in the clean buffer region. The data information includes at least: the time the data exists and the update frequency. Based on the priority of each clean buffer region, the target clean buffer region for which data eviction operation needs to be performed is determined, and the data eviction operation is performed on the target clean buffer region.

9. A buffer management device for use in a storage system, characterized in that, This device is applied to a hardware-based buffer management component deployed in the storage system, the buffer management component accessing the memory in the storage system via the system bus of the storage system, and the device includes: The buffer allocator, implemented in hardware, is used to, when it is determined that a buffer needs to be allocated for a target task, obtain the available target buffer block required by the target task from the buffer area corresponding to the target task type based on the current buffer allocation speed corresponding to the target task type, and execute the target task based on the target buffer block; the specified buffer space in the storage system is divided into at least one buffer area corresponding to the task type, and each buffer area includes at least one buffer block. The buffer allocation controller, implemented in hardware, determines when the current adjustment period arrives whether the current buffer allocation speed corresponding to the target task type needs to be adjusted. If, based on the number of available buffer blocks occupied in the buffer area corresponding to the target task type in the previous adjustment period and / or the execution speed of the target task, it is estimated that the number of available buffer blocks in the buffer area corresponding to the target task type in the current adjustment period is insufficient, the buffer allocation speed is reduced to suppress sudden changes in storage performance caused by insufficient available buffer blocks in the buffer area corresponding to the target task type when performing buffer allocation in the current adjustment period.

10. A storage device, characterized in that, The storage device includes at least: a hardware-based buffer management component, a buffer, and a system bus; The Buffer management component accesses the Buffer via the system bus in the storage device; the Buffer management component is used to perform the steps in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method for dynamically allocating cache

    CN101364948A

  • Buffer space availability for different packet classes

    US10735331B1