IO scheduling method, electronic device, storage medium, and program product

By identifying and splitting IO requests and using data management units as the smallest scheduling unit, the problem of low IO scheduling concurrency in distributed storage systems is solved, achieving more efficient IO request processing and data consistency, and improving overall performance.

WO2026017050A1PCT designated stage Publication Date: 2026-01-22JINAN INSPUR DATA TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/108685
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-07-18
Filing Date
2025-07-15
Publication Date
2026-01-22

AI Technical Summary

Technical Problem

In existing technologies, the IO scheduling methods of distributed storage systems cannot effectively improve the concurrency of IO scheduling, resulting in limited overall performance improvement in scenarios with high IO pressure. In particular, when there are a large number of read and write accesses to the same storage resource at the same time, the data consistency problem is difficult to solve.

Method used

By identifying the target request data of the IO request to be processed, as well as its location and amount in the storage device, the IO request is placed into the target IO request processing queue. The data management unit is used as the smallest scheduling unit to split large data requests and use processing threads for parallel scheduling to avoid overlapping operations and ensure data consistency.

Benefits of technology

It improves the overall IO request performance of the distributed storage system, reduces waiting time, avoids data inconsistency issues, and enhances IO concurrency and management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025108685_22012026_PF_FP_ABST
    Figure CN2025108685_22012026_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of input / output (IO) scheduling, and specifically relates to an IO scheduling method, an electronic device, a storage medium, and a program product. The method comprises: acquiring a current IO request to be processed; identifying said current IO request to determine target request data corresponding to said current IO request; determining a requested position of the target request data in a storage device and a requested data volume corresponding to the target request data; and on the basis of the requested position and the requested data volume, placing said current IO request into a target IO request processing queue to schedule said current IO request. IO requests to be processed in a plurality of IO request processing queues can be simultaneously processed, and there is no need to schedule the next IO request to be processed until the previous IO request to be processed is completed scheduling, thereby improving the overall IO request performance of a distributed storage system.
Need to check novelty before this filing date? Find Prior Art

Description

I / O scheduling methods, electronic devices, storage media and application products

[0001] Cross-references to related applications

[0002] This application claims priority to Chinese Patent Application No. 202410962881.9, filed on July 18, 2024, entitled "IO Scheduling Method, Electronic Device, Storage Medium and Program Product", the entire contents of which are incorporated herein by reference. Technical Field

[0003] This application relates to the field of I / O scheduling technology, specifically to I / O scheduling methods, electronic devices, storage media, and program products. Background Technology

[0004] In a distributed storage system, storage resources are shared by all clients. Therefore, a distributed storage system will receive I / O (Input / Output) requests from different clients. These I / O requests may be about the same byte range of the same LUN (Logical Unit Number), different byte ranges of the same LUN, or byte ranges of different LUNs.

[0005] To improve the management efficiency of distributed storage systems, OBJs (objects, the smallest data management unit in a distributed storage system) are typically used as the smallest management unit for storage resources, and a LUN consists of several OBJs. However, in related technologies, pending I / O requests are usually placed in the same I / O request processing queue and then scheduled sequentially. However, the I / O scheduling methods in these technologies do not significantly improve the concurrency of I / O scheduling. Summary of the Invention

[0006] In view of this, this application provides an I / O scheduling method, electronic device, storage medium, and program product to solve the I / O scheduling problem.

[0007] In a first aspect, this application provides an IO scheduling method, the method comprising: obtaining a currently pending IO request; identifying the currently pending IO request and determining the target request data corresponding to the currently pending IO request; determining the request location of the target request data in the storage device and the corresponding request data volume of the target request data; and, based on the request location and request data volume corresponding to the target request data, placing the currently pending IO request into a target IO request processing queue and scheduling the currently pending IO request.

[0008] The IO scheduling method provided in this application embodiment obtains the currently pending IO requests; identifies the currently pending IO requests and determines the target request data corresponding to them, ensuring the accuracy of the determined target request data. It determines the request location of the target request data in the storage device and the corresponding request data volume. Based on the request location and request data volume, the currently pending IO requests are placed into a target IO request processing queue, and then scheduled. This ensures the accuracy of placing the currently pending IO requests into the target IO request processing queue. Furthermore, the method schedules the currently pending IO requests from the target IO request processing queue, ensuring the accuracy of scheduling. This allows for the simultaneous processing of pending IO requests in multiple IO request processing queues, eliminating the need to wait for the previous pending IO requests to complete before scheduling the next pending IO request, thereby further improving the overall IO request performance of the distributed storage system.

[0009] In one optional implementation, based on the request location and request data volume corresponding to the target request data, the current pending IO request is placed into the target IO request processing queue, and the current pending IO request is scheduled, including: comparing the request data volume with a preset request data volume threshold; if the request data volume is less than or equal to the preset request data volume threshold, based on the request location, the current pending IO request is placed into the target IO request processing queue, and the current pending IO request is scheduled; if the request data volume is greater than the preset request data volume threshold, the current pending IO request is split into multiple sub-pending IO requests based on the target request data; based on the sub-request location corresponding to the sub-target data of each sub-pending IO request, each sub-pending IO request is placed into the target IO request processing queue corresponding to its respective sub-pending IO request, and the multiple sub-pending IO requests are scheduled.

[0010] In one optional implementation, the current pending IO request is placed into the target IO request processing queue according to the request location and request data volume corresponding to the target request data, including: determining the number of target data management units corresponding to the target request data according to the request location and request data volume corresponding to the target request data; if the number of target data management units is 1, then the current pending IO request is placed into the target IO request processing queue corresponding to the target data management unit according to the target data management unit.

[0011] The IO scheduling method provided in this application determines the number of target data management units corresponding to the target request data based on the request location and the amount of request data, ensuring the accuracy of the determined number of target data management units. If the number of target data management units is 1, the currently pending IO request is placed into the target IO request processing queue corresponding to the target data management unit, ensuring the accuracy of placing the currently pending IO request into the target IO request processing queue corresponding to the target data management unit.

[0012] In one optional implementation, determining the number of target data management units corresponding to the target request data based on the request location and the amount of request data includes: determining the target logical unit corresponding to the target request data and the offset of the request location within the target logical unit based on the request location corresponding to the target request data, thereby obtaining the data management unit corresponding to the start address of the target request data; determining the data management unit corresponding to the end address of the target request data based on the amount of request data; if the data management unit corresponding to the start address and the data management unit corresponding to the end address are the same data management unit, determining the number of target data management units to be 1; if the data management unit corresponding to the start address and the data management unit corresponding to the end address are different data management units, determining the number of target data management units to be greater than 1.

[0013] In one optional implementation, the current pending IO request is placed into the target IO request processing queue according to the request location and the amount of request data corresponding to the target request data. The method further includes: if the number of target data management units is greater than 1, the current pending IO request is split into multiple sub-pending IO requests according to the number of target data management units; the number of sub-pending IO requests is consistent with the number of target data management units; and each sub-pending IO request is placed into the corresponding target IO request processing queue according to the target data management unit corresponding to each sub-pending IO request, so as to schedule each sub-pending IO request.

[0014] The IO scheduling method provided in this application, if the number of target data management units is greater than 1, splits the current pending IO request into multiple sub-pending IO requests based on the number of target data management units, ensuring the accuracy of splitting the current pending IO request into multiple sub-pending IO requests. Based on the target data management unit corresponding to each sub-pending IO request, each sub-pending IO request is placed into the corresponding target IO request processing queue for scheduling, ensuring the accuracy of placing each sub-pending IO request into the corresponding target IO request processing queue, thereby further improving the overall IO request performance of the distributed storage system.

[0015] In one optional implementation, there are multiple IO request processing queues. Placing the currently pending IO request into a target IO request processing queue includes: obtaining the queue number corresponding to the IO request processing queue; obtaining the identification information of the target data management unit corresponding to the currently pending IO request; and placing the currently pending IO request into the target IO request processing queue according to the queue number and the identification information.

[0016] The IO scheduling method provided in this application embodiment obtains the queue number corresponding to the IO request processing queue; obtains the identification information of the target data management unit corresponding to the current IO request to be processed; and puts the current IO request to be processed into the target IO request processing queue according to the queue number and the identification information, thereby ensuring the accuracy of putting the current IO request to be processed into the target IO request processing queue.

[0017] In one optional implementation, obtaining the number of queues corresponding to the IO request processing queue includes: calculating the number of queues based on the number of logical units and the number of data management units included in each logical unit.

[0018] In one optional implementation, the identification information of the target data management unit is the positional order identifier of the target data management unit in the corresponding logical unit. Based on the queue number and the identification information, the current IO request to be processed is placed into the target IO request processing queue, including: performing a modulo calculation on the queue number using the positional order identifier; determining the target IO request processing queue corresponding to the current IO request to be processed from each IO request processing queue based on the calculation result; and placing the current IO request to be processed into the target IO request processing queue.

[0019] The IO scheduling method provided in this application uses a positional order identifier to perform a modulo calculation on the number of queues. Based on the calculation result, the target IO request processing queue corresponding to the current IO request to be processed is determined from each IO request processing queue, ensuring the accuracy of the determined target IO request processing queue. The current IO request to be processed is then placed into the target IO request processing queue, ensuring the accuracy of placing the current IO request to be processed into the target IO request processing queue.

[0020] In one optional implementation, placing the current pending IO request into the target IO request processing queue includes: obtaining historical request data corresponding to each historical pending IO request in the target IO request processing queue; determining from the target IO request processing queue that the historical request data belongs to each first historical IO request to be compared in the target data management unit; comparing the target request data with the first historical request data corresponding to each first historical IO request to be compared; and placing the current pending IO request into the target IO request processing queue based on the comparison result.

[0021] The IO scheduling method provided in this application obtains historical request data corresponding to each historical IO request to be processed in the target IO request processing queue; determines each first historical IO request to be compared whose historical request data is located in the target data management unit from the target IO request processing queue, ensuring that the historical request data corresponding to each first historical IO request to be compared and the target request data are both located in the target data management unit, thereby ensuring that there may be overlapping data between the historical request data corresponding to each first historical IO request to be compared and the target request data. The target request data is compared with the first historical request data to be compared corresponding to each first historical IO request to be compared, ensuring the accuracy of the comparison result. Based on the comparison result, the current IO request to be processed is placed into the target IO request processing queue, ensuring the accuracy of placing the current IO request to be processed into the target IO request processing queue.

[0022] In one optional implementation, obtaining historical request data corresponding to each historical pending IO request in the target IO request processing queue includes: obtaining each historical pending IO request in the target IO request processing queue; identifying each historical pending IO request to obtain historical request data corresponding to each historical pending IO request and a historical data management unit corresponding to the historical request data.

[0023] In one optional implementation, the current IO request to be processed is placed into the target IO request processing queue according to the comparison result, including: if there is no overlapping data between the target request data and each of the first historical request data to be compared, then the current IO request to be processed is placed into the target IO request processing queue.

[0024] The IO scheduling method provided in this application embodiment, if there is no overlapping data between the target request data and each first historical request data to be compared, then the current IO request to be processed is placed in the target IO request processing queue, thereby ensuring that when processing each first historical request data to be compared, there is no IO request to be processed that overlaps with each first historical IO request to be compared, thus avoiding the problem of data inconsistency caused by the frequent occurrence of additional IO request operations for an address before the IO request for a certain address has been completed.

[0025] In one optional implementation, based on the comparison results, the current pending IO request is placed into the target IO request processing queue, and the method further includes: if there is overlapping data between the target request data and each of the first historical request data to be compared, the first historical IO request to be compared that has overlapping data with the target request data is determined as the target historical IO request; the current pending IO request is placed into the first target mutex list corresponding to the target historical IO request; when the target historical IO request is processed, the current pending IO request is placed into the target IO request processing queue.

[0026] The IO scheduling method provided in this application, if there is overlapping data between the target request data and each of the first historical request data to be compared, determines the first historical IO request to be compared that has overlapping data as the target historical IO request, thus ensuring the accuracy of the determined target historical IO request. The current IO request to be processed is placed in the first target mutex list corresponding to the target historical IO request, thereby avoiding data inconsistency caused by adding the current IO request to be processed while processing the target historical IO request. When the target historical IO request is processed, the current IO request to be processed is placed in the target IO request processing queue, thereby avoiding data inconsistency.

[0027] In one optional implementation, when the target historical IO request has been processed, the current pending IO request is placed into the target IO request processing queue, including: temporarily storing the first target mutex list using a temporary linked list head; removing the target historical IO request from the first target mutex list; removing the target historical IO request from the target IO request processing queue; traversing the temporarily stored first target mutex list through the temporary linked list head, and sequentially performing the following steps on each other pending IO request on the first target mutex list other than the target historical IO request: removing the other pending IO requests from the first target mutex list, and putting the other pending IO requests back into the target IO request processing queue.

[0028] In one optional implementation, after the target historical IO request is processed, the current pending IO request is placed into the target IO request processing queue, including: after the target historical IO request is processed, retrieving each second historical IO request to be compared from the target IO request processing queue; the historical request data corresponding to the second historical IO request to be compared is located in the target data management unit; comparing the target request data with the second historical request data corresponding to the second historical IO request to be compared; if there is no overlapping data between the target request data and each second historical request data to be compared, then placing the current pending IO request into the target IO request processing queue; if there is overlapping data between the target request data and each second historical request data to be compared, then placing the current pending IO request into a second target mutex list, wherein the second target mutex list is the mutex list corresponding to the second historical request data to be compared that has overlapping data with the target request data.

[0029] The IO scheduling method provided in this application, after the target historical IO request has been processed, retrieves each second historical IO request to be compared from the target IO request processing queue, ensuring that the second historical request data corresponding to each second historical IO request to be compared and the target request data are both in the target data management unit. The target request data is compared with the second historical request data corresponding to the second historical IO requests to be compared; if there is no overlapping data between the target request data and each second historical request data to be compared, the current IO request to be processed is placed in the target IO request processing queue. If there is overlapping data between the target request data and each second historical request data to be compared, the current IO request to be processed is placed in the second target mutex list. This avoids the problem of data inconsistency caused by frequent additional IO request operations for a certain address before an IO request for that address has been completed.

[0030] In one optional implementation, comparing the target request data with the first historical request data corresponding to each first historical IO request to be compared includes: determining the target position offset of the target request data in the target data management unit based on the request position corresponding to the target request data; obtaining the historical position offset and historical data volume of the first historical request data to be compared in the target data management unit; and comparing the target request data with the first historical request data corresponding to each first historical IO request to be compared based on the relationship between the target position offset, the request data volume, the historical position offset, and the historical data volume.

[0031] The IO scheduling method provided in this application determines the target position offset of the target request data in the target data management unit based on the request position corresponding to the target request data, ensuring the accuracy of the determined target position offset. It obtains the historical position offset and historical data volume of the first historical request data to be compared in the target data management unit; based on the relationship between the target position offset, request data volume, historical position offset, and historical data volume, it compares the target request data with the first historical request data corresponding to each first historical IO request to be compared, ensuring the accuracy of the obtained comparison results.

[0032] In one optional implementation, based on the relationship between the target position offset, the requested data volume, the historical position offset, and the historical data volume, the target requested data is compared with the first historical request data corresponding to each first historical IO request to be compared. This includes: calculating the sum of the historical position offset and the historical data volume to obtain a first total offset; calculating the sum of the target position offset and the requested data volume to obtain a second total offset; comparing the target position offset with the first total offset; comparing the historical position offset with the second total offset; if the target position offset is greater than the first total offset, or the historical position offset is greater than the second total offset, then it is determined that there is no overlapping data between the target requested data and each first historical request data to be compared.

[0033] The IO scheduling method provided in this application calculates the sum of historical position offsets and historical data volumes to obtain a first total offset, ensuring the accuracy of the calculated first total offset. It also calculates the sum of target position offsets and requested data volumes to obtain a second total offset, ensuring the accuracy of the calculated second total offset. The target position offset is compared with the first total offset; the historical position offset is compared with the second total offset. If the target position offset is greater than the first total offset, or if the historical position offset is greater than the second total offset, then it is determined that there is no overlapping data between the target requested data and each of the first historical requested data to be compared, ensuring the accuracy of the determined non-overlapping data between the target requested data and each of the first historical requested data to be compared.

[0034] In one alternative implementation, scheduling the currently pending I / O requests includes: scheduling the currently pending I / O requests in the target I / O request processing queue using a target processing thread; the target processing thread is any one of a plurality of processing threads.

[0035] The IO scheduling method provided in this application uses a target processing thread to schedule the current pending IO requests in the target IO request processing queue. The target processing thread can be any one of multiple processing threads, thereby ensuring the accuracy of scheduling the current pending IO requests and realizing the parallel scheduling of multiple pending IO requests, further improving the overall IO request performance of the distributed storage system.

[0036] Secondly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the IO scheduling method of the first aspect or any corresponding embodiment described above.

[0037] Thirdly, this application provides a computer non-transitory readable storage medium storing computer instructions, which are used to cause a computer to execute the IO scheduling method of the first aspect or any corresponding embodiment described above.

[0038] Fourthly, this application provides a computer program product, including computer instructions for causing a computer to execute the I / O scheduling method of the first aspect or any corresponding embodiment thereof. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the specific embodiments or related technologies of this application, the drawings used in the description of the specific embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0040] Figure 1 is a schematic diagram of the architecture of a distributed storage system according to an embodiment of this application;

[0041] Figure 2 is a flowchart illustrating a first IO scheduling method according to an embodiment of this application;

[0042] Figure 3 is a flowchart illustrating a second IO scheduling method according to an embodiment of this application;

[0043] Figure 4 is a flowchart illustrating a third IO scheduling method according to an embodiment of this application;

[0044] Figure 5 is a flowchart illustrating that there is no overlap between the first type of target request data and each first historical request data to be compared according to an embodiment of this application.

[0045] Figure 6 is a flowchart illustrating that there is no overlap between the second type of target request data and each of the first historical request data to be compared according to an embodiment of this application;

[0046] Figure 7 is a schematic diagram of placing the current pending IO request into the target IO request processing queue according to an embodiment of this application;

[0047] Figure 8 is a flowchart illustrating the overlapping data between the first type of target request data and each first historical request data to be compared according to an embodiment of this application.

[0048] Figure 9 is a flowchart illustrating the overlapping data between the second type of target request data and each of the first historical request data to be compared, according to an embodiment of this application.

[0049] Figure 10 is a flowchart of the mutex list addition logic according to an embodiment of this application;

[0050] Figure 11 is a flowchart of the mutex list removal logic according to an embodiment of this application;

[0051] Figure 12 is a schematic diagram showing that there is overlap between the current pending IO request and multiple target historical IO requests according to an embodiment of this application;

[0052] Figure 13 is a schematic diagram of splitting the current pending IO request according to an embodiment of this application;

[0053] Figure 14 is a schematic diagram of optimizing the IO request processing queue according to an embodiment of this application.

[0054] Figure 15 is a schematic diagram illustrating a fourth IO scheduling method according to an embodiment of this application;

[0055] Figure 16 is a structural block diagram of an IO scheduling device according to an embodiment of this application;

[0056] Figure 17 is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] For a hyperconverged server, all data reads and writes ultimately occur on the distributed storage system. Therefore, the performance of the distributed storage system is crucial to the overall performance of the hyperconverged server. The distributed storage system provides iSCSI (Internet Small Computer System Interface) target services, supporting multiple iSCSI clients to simultaneously initiate connection requests. This means that the storage resources of the distributed storage system are shared by all clients. Consequently, the distributed storage system receives IO requests from different clients. These IO requests may pertain to the same byte range within the same logical unit, different byte ranges within the same logical unit, or individual byte ranges within different logical units.

[0059] To improve the management efficiency of distributed storage systems, data management units (DMUs) are typically used as the smallest management unit for storage resources. A logical unit consists of several DMUs. The DMU in a distributed storage system is similar to the concept of a sector on a physical disk. Smaller DMUs result in finer granularity of storage resource management and higher I / O concurrency, but also higher disk loss (each DMU corresponds to metadata; for the same disk capacity, smaller DMUs result in more DMUs, more metadata, more disk space occupied, and less usable disk space), and lower management efficiency. Conversely, larger DMUs result in finer granularity of storage resource management, lower I / O concurrency, but lower disk loss and higher management efficiency. Currently, the industry typically sets the DMU to 4MB (Megabyte).

[0060] To improve the IO concurrency of a distributed storage system, IO requests from different logical units and IO requests from different regions of the same logical unit can be processed concurrently because the storage resources are independent of each other, thereby increasing IO concurrency.

[0061] However, for IO requests with overlapping storage resources, all IO requests are executed in the request processing queue in a FIFO (First In First Out) manner for the sake of data consistency. The IO request data block is used as the granularity of IO scheduling. This execution method does solve the data consistency problem at the IO scheduling level, but it is not friendly to the overall performance of the distributed storage system. This is because different IO requests of the same logical unit may not have read-write or write-write dependencies. These requests can be scheduled and executed earlier without waiting for the requests that arrived earlier to be executed.

[0062] With the increasing parallelism of I / O requests, new I / O requests for the same address often occur before the previous one is completed. To avoid data inconsistency, traditional solutions wait for the previous I / O request to finish before scheduling the next one. However, in scenarios with high I / O pressure, especially when there are numerous simultaneous read and write accesses to the same storage resource, the traditional I / O scheduling strategy can be further optimized. There is still room for improvement in I / O concurrency, and the overall I / O performance of the distributed storage system can be further enhanced.

[0063] Based on this, this application provides an IO scheduling method applied to a distributed storage system, as shown in Figure 1. The architecture of the distributed storage system, from top to bottom, consists of a protocol layer, an IO scheduling layer, a storage engine layer, a device driver layer, and physical disks. The protocol layer is used to receive and parse connection requests and IO requests initiated by various clients. Since mutual exclusion of storage resources is not involved, concurrency can be maximized here. The IO scheduling layer no longer uses the entire IO request as the smallest scheduling unit, but rather processes IO requests using a data management unit as the smallest scheduling unit.

[0064] In some embodiments, as shown in Figure 2, the processing flow of the IO scheduling method is as follows: Obtain the current pending IO request; identify the current pending IO request and determine the target request data corresponding to it, ensuring the accuracy of the determined target request data. Determine the request location of the target request data in the storage device and the corresponding request data volume. When the data length of an IO request is greater than the length of a data management unit or spans two adjacent data management units aligned to 4MB (the size of a data management unit), the requested data length is divided into multiple different data management units aligned to 4MB and processed concurrently. Specific implementation details are described later. When multiple IO requests exist simultaneously for data in the same data management unit, the granularity of concurrent IO scheduling is reduced based on the overlap of data intervals in each IO request, thereby increasing IO concurrency. The storage engine layer manages the physical disk (data from multiple logical units may be distributed across multiple disks). The device driver layer connects the physical disk and the software operating system. The physical disk stores user data.

[0065] It should be noted that the IO scheduling method provided in this application embodiment can be executed by an IO scheduling device. This IO scheduling device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. The electronic device can be a server or a terminal. In this application embodiment, the server can be a single server or a server cluster composed of multiple servers. The terminal in this application embodiment can be a smartphone, personal computer, tablet computer, wearable device, or other intelligent hardware device such as an intelligent robot. The following method embodiments will all use an electronic device as an example for explanation.

[0066] According to an embodiment of this application, an IO scheduling method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0067] This embodiment provides an I / O scheduling method that can be used in the aforementioned electronic device. Figure 3 is a flowchart of the I / O scheduling method according to an embodiment of this application. As shown in Figure 3, the process includes the following steps:

[0068] Step S101: Obtain the currently pending IO requests.

[0069] In some embodiments, the electronic device can receive currently pending I / O requests input by the user, or it can receive currently pending I / O requests sent by other devices. This application does not specifically limit the method by which the electronic device obtains currently pending I / O requests.

[0070] Step S102: Identify the current pending IO request and determine the target request data corresponding to the current pending IO request.

[0071] In some embodiments, the electronic device can identify the currently pending I / O request and determine the target request data corresponding to the currently pending I / O request.

[0072] Step S103: Determine the request location of the target request data in the storage device and the corresponding request data volume of the target request data.

[0073] In some embodiments, the electronic device identifies the target request data corresponding to the current pending IO request, determines the request location of the target request data in the storage device, and the corresponding request data volume of the target request data.

[0074] Step S104: Based on the request location and request data volume corresponding to the target request data, the current pending IO request is placed into the target IO request processing queue, and the current pending IO request is scheduled.

[0075] In some embodiments, the electronic device may compare the amount of request data corresponding to the target request data with a preset request data amount threshold.

[0076] If the amount of request data corresponding to the target request data is not greater than the preset request data amount threshold, then according to the request position corresponding to the target request data, the current pending IO request is placed into the target IO request processing queue, and the current pending IO request is scheduled.

[0077] If the amount of request data corresponding to the target request data is greater than a preset request data volume threshold, the current pending IO request is split into multiple sub-pending IO requests based on the target request data. Then, based on the sub-request position corresponding to the sub-target data of each sub-pending IO request, each sub-pending IO request is placed into its corresponding target IO request processing queue, and the multiple sub-pending IO requests are scheduled.

[0078] The IO scheduling method provided in this application embodiment obtains the currently pending IO requests; identifies the currently pending IO requests and determines the target request data corresponding to them, ensuring the accuracy of the determined target request data. It determines the request location of the target request data in the storage device and the corresponding request data volume. Based on the request location and request data volume, the currently pending IO requests are placed into a target IO request processing queue, and then scheduled. This ensures the accuracy of placing the currently pending IO requests into the target IO request processing queue. Furthermore, the method schedules the currently pending IO requests from the target IO request processing queue, ensuring the accuracy of scheduling. This allows for the simultaneous processing of pending IO requests in multiple IO request processing queues, eliminating the need to wait for the previous pending IO requests to complete before scheduling the next pending IO request, thereby further improving the overall IO request performance of the distributed storage system.

[0079] This embodiment provides an I / O scheduling method that can be used in the aforementioned electronic device. Figure 4 is a flowchart of the I / O scheduling method according to an embodiment of this application. As shown in Figure 4, the process includes the following steps:

[0080] Step S201: Obtain the current pending IO requests.

[0081] Please refer to Figure 3 for a description of step S101; it will not be repeated here.

[0082] Step S202: Identify the current pending IO request and determine the target request data corresponding to the current pending IO request.

[0083] Please refer to Figure 3 for a description of step S102; it will not be repeated here.

[0084] Step S203: Determine the request location of the target request data in the storage device and the corresponding request data volume of the target request data.

[0085] Please refer to Figure 3 for a description of step S103; it will not be repeated here.

[0086] Step S204: Based on the request location and request data volume corresponding to the target request data, the current pending IO request is placed into the target IO request processing queue, and the current pending IO request is scheduled.

[0087] In some embodiments, step S204 above, "placing the current pending IO request into the target IO request processing queue according to the request location and request data volume corresponding to the target request data," may include the following steps:

[0088] Step S2041: Determine the number of target data management units corresponding to the target request data based on the request location and the amount of request data.

[0089] In some embodiments, the electronic device may determine the number of target data management units corresponding to the target request data based on the request location and the amount of request data.

[0090] In this system, the target data management unit is the smallest data management unit, and each target data management unit has a unique identifier. The distributed storage system can include multiple logical units, and each logical unit includes multiple data management units. The data storage capacity corresponding to each data management unit can be 4MB, 3MB, or other storage capacities. This embodiment does not specifically limit the data storage capacity corresponding to each data management unit.

[0091] In some embodiments, the electronic device can determine the target logic unit corresponding to the target request data and the offset of the target request position within the target logic unit based on the request position corresponding to the target request data, thereby determining the data management unit corresponding to the start address of the target request data. Then, it determines the data management unit corresponding to the end address of the target request data based on the data volume corresponding to the target request data. If they correspond to the same data management unit, the number of target data management units is 1. If the start address and end address of the target request data correspond to different data management units, the number of target data management units is not 1.

[0092] Step S2042: If the number of target data management units is 1, then according to the target data management unit, the current unprocessed IO request is placed into the target IO request processing queue corresponding to the target data management unit.

[0093] In one optional embodiment of this application, there are multiple IO request processing queues, and step S2042 above may include the following steps:

[0094] Step a1: Obtain the number of queues corresponding to the IO request processing queue.

[0095] In some embodiments, the electronic device can receive the number of queues corresponding to the IO request processing queue set by the user, or it can receive the number of queues corresponding to the IO request processing queue sent by other devices. The electronic device can also calculate the number of queues corresponding to the IO request processing queue based on the number of logical units in the distributed storage system and the number of data management units included in each logical unit.

[0096] For example, for the same logical unit, the number of queues corresponding to the IO request processing queue is obtained by dividing the number of data management units included in each logical unit by 3.

[0097] Step a2: Obtain the identification information of the target data management unit corresponding to the current pending IO request.

[0098] In some embodiments, the electronic device can determine the target data management unit and its identification information based on the start and end addresses of the target request data.

[0099] Step a3: Based on the queue number and identification information, place the currently pending IO request into the target IO request processing queue.

[0100] In some embodiments, the identification information of the target data management unit is the positional identifier of the target data management unit in the corresponding logical unit, and step a3 above may include the following steps:

[0101] Step a31: Calculate the queue size using the positional order identifier modulo operation.

[0102] In some embodiments, the electronic device uses the positional sequence identifier to perform a modulo calculation on the queue size.

[0103] Step a32: Based on the calculation results, determine the target IO request processing queue corresponding to the current IO request to be processed from each IO request processing queue.

[0104] In some embodiments, the electronic device determines the target IO request processing queue corresponding to the current IO request to be processed from each IO request processing queue based on the calculation results.

[0105] For example, assuming the number of queues is 3, the electronic device divides the position sequence identifier of the target data management unit in the corresponding logical unit by 3 and takes the remainder. If the remainder is 0, the target IO request processing queue corresponding to the current IO request to be processed is determined as IO request processing queue 0; if the remainder is 1, the target IO request processing queue corresponding to the current IO request to be processed is determined as IO request processing queue 1; if the remainder is 2, the target IO request processing queue corresponding to the current IO request to be processed is determined as IO request processing queue 2.

[0106] Step a33: Place the currently pending IO request into the target IO request processing queue.

[0107] In some embodiments, after determining the target IO request processing queue corresponding to the current IO request to be processed, the current IO request to be processed can be placed into the target IO request processing queue.

[0108] In some embodiments, step a33 above may include the following steps:

[0109] Step a331: Obtain the historical request data corresponding to each historical pending IO request in the target IO request processing queue.

[0110] In some embodiments, the electronic device can obtain each historical pending IO request from the target IO request processing queue, identify each historical pending IO request, and determine the historical request data corresponding to each historical pending IO request and the historical data management unit corresponding to the historical request data.

[0111] Step a332: Determine from the target IO request processing queue each of the first historical IO requests to be compared in the target data management unit.

[0112] In some embodiments, the electronic device compares the historical data management unit corresponding to the historical request data of each historical pending IO request with the target data management unit. Then, it determines from the target IO request processing queue each first historical IO request to be compared whose historical request data is located in the target data management unit. That is, the historical data management unit corresponding to the historical request data of each first historical IO request to be compared is consistent with the target data management unit corresponding to the target request data.

[0113] Step a333: Compare the target request data with the first historical request data corresponding to each first historical IO request to be compared.

[0114] In some embodiments, step a333 above may include the following steps:

[0115] Step a3331: Determine the target position offset of the target request data in the target data management unit based on the request position corresponding to the target request data.

[0116] In some embodiments, the electronic device can determine the target position offset of the target request data in the target data management unit based on the request position corresponding to the target request data.

[0117] Step a3332: Obtain the historical position offset and historical data volume of the first historical request data to be compared in the target data management unit.

[0118] In some embodiments, the electronic device can identify the first historical request data to be compared corresponding to the first historical IO request to be compared, and determine the historical position offset and historical data volume of the first historical request data to be compared in the target data management unit.

[0119] Step a3333: Based on the relationship between the target position offset, the requested data volume, the historical position offset, and the historical data volume, compare the target requested data with the first historical request data corresponding to each first historical IO request to be compared.

[0120] In some embodiments, step a3333 described above may include the following steps:

[0121] Step a33331: Calculate the sum of the historical position offset and the historical data volume to obtain the first total offset.

[0122] In some embodiments, the electronic device calculates the sum of the historical location offset and the amount of historical data to obtain a first total offset.

[0123] Step a33332: Calculate the sum of the target position offset and the requested data amount to obtain the second total offset.

[0124] In some embodiments, the electronic device calculates the sum of the target position offset and the requested data volume to obtain a second total offset.

[0125] Step a33333: Compare the target position offset with the first total offset.

[0126] Step a33334: Compare the historical position offset with the second total offset.

[0127] Step a33335: If the target position offset is greater than the first total offset, or the historical position offset is greater than the second total offset, it is determined that there is no overlapping data between the target request data and each first historical request data to be compared.

[0128] In some embodiments, the electronic device compares the target position offset with the first total offset and compares the historical position offset with the second total offset.

[0129] If the target position offset is greater than the first total offset, or the historical position offset is greater than the second total offset, it is determined that there is no overlapping data between the target request data and each first historical request data to be compared.

[0130] Exemplarily, as shown in FIG. 5, it is a schematic diagram of the case where the historical position offset is greater than the second total offset. In FIG. 5, the upper part is the current IO request to be processed, and the lower part is the first historical IO request to be compared. Among them, the end position of the target data corresponding to the current IO request to be processed is smaller than the start position of the first historical request data of the first historical IO request to be compared, that is, a_offset + a_len < b_offset, then it is determined that there is no overlapping data between the target request data and each first historical request data to be compared.

[0131] As shown in FIG. 6, it is a schematic diagram of the case where the target position offset is greater than the first total offset. In FIG. 6, the upper part is the current IO request to be processed, and the lower part is the first historical IO request to be compared. Among them, the start position of the target data corresponding to the current IO request to be processed is greater than the end position of the first historical request data of the first historical IO request to be compared, that is, a_offset > b_offset + b_len, then it is determined that there is no overlapping data between the target request data and each first historical request data to be compared.

[0132] Step a334: According to the comparison result, put the current IO request to be processed into the target IO request processing queue.

[0133] In some embodiments, the above step a334 may include the following steps:

[0134] Step a3341: If there is no overlapping data between the target request data and each of the first historical request data to be compared, then the current IO request to be processed is placed into the target IO request processing queue.

[0135] In some embodiments, if there is no overlapping data between the target request data and each of the first historical request data to be compared, the current IO request to be processed is placed in the target IO request processing queue.

[0136] For example, as shown in Figure 7, if there is no overlap between the target request data and each of the first historical request data to be compared, then the current IO request to be processed is placed into the target IO request processing queue.

[0137] Step a3342: If there is overlapping data between the target request data and each of the first historical request data to be compared, then the first historical IO request to be compared that has overlapping data with the target request data is determined as the target historical IO request.

[0138] In some embodiments, if there is overlapping data between the target request data and each of the first historical request data to be compared, then the first historical IO request to be compared that has overlapping data with the target request data is determined as the target historical IO request.

[0139] Step a3343: Place the current pending IO request into the first target mutex linked list corresponding to the target historical IO request.

[0140] In some embodiments, the electronic device places the current pending IO request into the first target mutex list corresponding to the target historical IO request based on the identification information corresponding to the target historical IO request.

[0141] As shown in Figure 8, obj_1c is the current pending IO request, and obj_1a is the target historical IO request. Since the target request data of the current pending IO request overlaps with the data range of the first historical IO request to be compared in the target data management unit in the target IO request processing queue, i.e., there is storage resource contention and mutual exclusion, it is necessary to first add the current pending IO request to the mutex list of the first historical IO request to be compared with the overlapping data range. After that is processed, the current pending IO request on the mutex list is then re-attempted to be added to the target IO request processing queue.

[0142] As shown in Figure 9, obj_1c is the current pending IO request, and obj_1b is the target historical IO request. Since the target request data of the current pending IO request overlaps with the data range of the first first historical IO request to be compared in the target data management unit within the target IO request processing queue, meaning there is no storage resource contention, the two can be processed concurrently. However, the data range of the second first historical IO request to be compared in the target data management unit within the target IO request processing queue overlaps, meaning there is storage resource contention. Therefore, the current pending IO request needs to be added to the mutex list of the second first historical IO request with overlapping data ranges. After that second request is processed, the current pending IO request on the mutex list can be re-added to the target IO request processing queue.

[0143] In one optional implementation of this application, as shown in Figure 10, a flowchart of the logic for adding a mutex list is presented. First, the type of the OBJ request is determined. If the OBJ request is not a read / write IO request, the process ends directly, as other IO requests such as management or query IO requests do not require actual IO read / write processing and therefore do not need to execute the relevant logic involved in this method. If the OBJ request is a read / write IO request, it is determined whether the target IO request processing queue is empty. If the target IO request processing queue is empty, it is directly added to the tail of the queue and the process ends. If the target IO request processing queue is not empty, it needs to be traversed from the head to the tail. If a target historical IO request with the same oid (Object Identifier) ​​as the currently pending IO request (i.e., both are in the target data management unit) and overlapping data ranges is found in the target IO request processing queue, it is determined whether the linked list of the target historical IO request has been initialized. If the linked list of the target historical IO request has not been initialized, it is initialized and used as the head of the mutex list. Then, the currently pending IO request is added to the tail of the mutex list, and the process ends. If no target historical IO request with the same OID and overlapping data range as the current pending IO request is found in the target IO request processing queue, the current pending IO request is added to the tail of the IO request processing queue, and the process ends.

[0144] The mutex linked list supports multiple pending requests to be attached simultaneously. Requests must be attached to the tail of the list in chronological order, and requests cannot be inserted in the middle of the list.

[0145] Step a3344: Once the target historical IO requests have been processed, place the current pending IO requests into the target IO request processing queue.

[0146] In one optional implementation of this application, when a target historical IO request is processed, it needs to be removed from the target IO request processing queue. Simultaneously, the currently pending IO requests with overlapping data ranges are removed from the mutex list corresponding to the target historical IO request and attempted to be re-added to the target IO request processing queue. The specific implementation logic is shown in Figure 11. Figure 11 is a flowchart of the mutex list removal logic. For a target historical IO request about to be dequeued, it is first determined whether the mutex list of the target historical IO request has been initialized and is not empty. If the mutex list on the target historical IO request is not initialized, it means that the target historical IO request has never had a history of overlapping data regions, and the target historical IO request can be directly removed from the target IO request processing queue. If the mutex list on the target historical IO request has been initialized but the list is empty, it means that the target historical IO request has had a history of overlapping data regions, but currently there is no storage resource mutual exclusion, and it can be directly removed from the target IO request processing queue. If the mutex list on the target historical IO request has been initialized and is not empty, the following processing is required. First, a temporary linked list head is used to temporarily store the mutex list on the target historical IO request (to prevent the loss of IO mutex list information on the target historical IO request). Then, the target historical IO request is removed from the mutex list and then removed from the target IO request processing queue. Then, the previously stored mutex list is traversed through the temporary linked list head, and the following operations are performed on other pending IO requests on the mutex list in order: the other pending IO requests are removed from the mutex list, and the mutex list addition logic described above is used to try to add them back to the target IO request processing queue.

[0147] In some embodiments, step a3344 above may include the following steps:

[0148] Step a33441: After the target historical IO request is processed, retrieve each second historical IO request to be compared from the target IO request processing queue again.

[0149] Among them, the historical request data corresponding to the second historical IO request to be compared is located in the target data management unit.

[0150] In some embodiments, once the target historical IO request has been processed, each second historical IO request to be compared is retrieved again from the target IO request processing queue.

[0151] Step a33442: Compare the target request data with the second historical request data corresponding to the second historical IO request to be compared.

[0152] In some embodiments, the electronic device compares the target request data with the second historical request data corresponding to the second historical IO request to be compared.

[0153] Step a33443: If there is no overlapping data between the target request data and each of the second historical request data to be compared, then the current IO request to be processed is placed into the target IO request processing queue.

[0154] In some embodiments, if there is no overlapping data between the target request data and each of the second historical request data to be compared, the electronic device places the current pending IO request into the target IO request processing queue.

[0155] Step a33444: If there is overlapping data between the target request data and each of the second historical request data to be compared, then the current IO request to be processed is placed into the second target mutex list.

[0156] The second target mutex list is the mutex list corresponding to the second historical request data to be compared that has overlapping data with the target request data.

[0157] In some embodiments, if there is overlapping data between the target request data and each of the second historical request data to be compared, the current IO request to be processed is placed into the second target mutex list.

[0158] For example, as shown in Figure 12, this diagram illustrates overlapping data between the current pending IO request and multiple target historical IO requests. Since the target request data of the current pending IO request overlaps with the data range of the first historical IO request to be compared in the target data management unit within the target IO request processing queue, meaning there is storage resource contention and mutual exclusion, the current pending IO request needs to be added to the mutex list of the first historical IO request to be compared with overlapping data ranges. After that request is processed, the current pending IO request on the mutex list is then re-added to the target IO request processing queue. The reason for choosing to add it to the first historical IO request to be compared is that when traversing the target IO request processing queue, following the traversal order from beginning to end, if overlap is found, there is no need to continue traversing, thus improving performance.

[0159] Then, once the target historical I / O requests have been processed, each second historical I / O request to be compared is retrieved from the target I / O request processing queue. The target request data is compared with the second historical I / O request data corresponding to the second historical I / O requests to be compared. If there is overlapping data between the target request data and each of the second historical I / O requests to be compared, the current I / O request to be processed is placed into the second target mutex list.

[0160] Step S2043: If the number of target data management units is greater than 1, then the current pending IO request is split according to the number of target data management units to obtain multiple sub-pending IO requests.

[0161] The number of sub-IO requests to be processed is consistent with the number of target data management units.

[0162] For example, as shown in Figure 13, a logical unit consists of several data management units. If the target request data is a data block with an offset of offset and length of len on this logical unit, and this data block is divided according to 4MB alignment and falls on 3 data management units, then the current pending IO request is split into requests to 3 different data management units, which can participate in the IO scheduling strategy of the distributed storage system respectively. Therefore, the number of target data management units is 3.

[0163] Step S2044: Based on the target data management unit corresponding to each sub-IO request to be processed, place each sub-IO request to be processed into the corresponding target IO request processing queue in order to schedule each sub-IO request to be processed.

[0164] In some embodiments, the process of placing each sub-IO request to be processed into the corresponding target IO request processing queue can be referred to in the above embodiment of "if the number of target data management units is 1, then according to the target data management unit, the current IO request to be processed is placed into the target IO request processing queue corresponding to the target data management unit", which will not be elaborated here.

[0165] In some embodiments, the "scheduling of the current pending IO requests" in step S204 above may include the following steps:

[0166] Step S2045: Use the target processing thread to schedule the currently pending IO requests in the target IO request processing queue.

[0167] The target processing thread can be any one of multiple processing threads.

[0168] For example, Figure 14 illustrates the optimization of the IO request processing queue. Each IO request processing queue is managed by a single thread (not a worker thread in the thread pool), primarily responsible for traversing the IO request processing queue, enqueuing and dequeuing data management unit requests, and managing the mutex linked list. When a new data management unit request arrives at the IO scheduling layer, its OID is moduloed (i.e., the remainder when the OID is divided by 3). If the result is 0, the data management unit request is placed in the first IO request processing queue; if the result is 1, it is placed in the second IO request processing queue; and if the result is 2, it is placed in the third IO request processing queue. This splits the IO request processing queue from one to three, shortening the queue length and reducing the time spent traversing the queue, thereby improving the efficiency of IO request processing queue management. The management method for each IO request processing queue is consistent, as described above.

[0169] By default, worker threads in the thread pool are evenly distributed across various I / O request processing queues to handle data management unit requests. When the load on the I / O request processing queues is uneven, the worker threads in the thread pool can dynamically balance the load across multiple I / O request processing queues to maximize the concurrent processing capacity of the thread pool and ensure the processing speed of each queue as much as possible.

[0170] The IO scheduling method provided in this application determines the number of target data management units corresponding to the target request data based on the request location and request data volume, ensuring the accuracy of the determined number of target data management units. If the number of target data management units is 1, the method obtains the queue number corresponding to the IO request processing queue; obtains the identification information of the target data management unit corresponding to the currently pending IO request; calculates the queue number modulo using the position order identifier; and determines the target IO request processing queue corresponding to the currently pending IO request from each IO request processing queue based on the calculation result, ensuring the accuracy of the determined target IO request processing queue.

[0171] The process involves: acquiring historical request data corresponding to each historical pending IO request in the target IO request processing queue; determining the first comparison historical IO requests whose historical request data is located in the target data management unit, ensuring that both the historical request data and the target request data for each of the first comparison historical IO requests are located in the target data management unit, thus preventing potential overlap between the historical request data and the target request data; determining the target position offset of the target request data in the target data management unit based on the request position corresponding to the target request data, ensuring the accuracy of the determined target position offset; acquiring the historical position offset and historical data volume of the first comparison historical request data in the target data management unit; calculating the sum of the historical position offset and the historical data volume to obtain the first total offset, ensuring the accuracy of the calculated first total offset; and calculating the sum of the target position offset and the request data volume to obtain the second total offset, ensuring the accuracy of the calculated second total offset. The target position offset is compared with the first total offset; the historical position offset is compared with the second total offset; if the target position offset is greater than the first total offset, or the historical position offset is greater than the second total offset, then it is determined that there is no overlapping data between the target request data and each of the first historical request data to be compared, thus ensuring the accuracy of the determination that there is no overlapping data between the target request data and each of the first historical request data to be compared.

[0172] If there is no overlapping data between the target request data and each of the first historical request data to be compared, the current pending IO request is placed in the target IO request processing queue. This ensures that when processing each of the first historical request data to be compared, there are no pending IO requests with overlapping data with each of the first historical IO requests to be compared. This avoids the problem of data inconsistency caused by IO requests to a certain address being added before the IO request to that address has been completed.

[0173] If there is overlap between the target request data and each of the first historical request data to be compared, the first historical IO request with overlapping data is identified as the target historical IO request, ensuring the accuracy of the identified target historical IO request. The current pending IO request is placed in the first target mutex linked list corresponding to the target historical IO request, thus preventing data inconsistency caused by adding the current pending IO request while processing the target historical IO request. Once the target historical IO request is processed, the current pending IO request is placed in the target IO request processing queue, further preventing data inconsistency.

[0174] Once the target historical I / O request is processed, the second historical I / O requests to be compared are retrieved from the target I / O request processing queue. This ensures that the second historical request data corresponding to each retrieved second historical I / O request to be compared, along with the target request data, are both within the target data management unit. The target request data is compared with the second historical request data corresponding to the second historical I / O requests to be compared. If there is no overlapping data between the target request data and the second historical request data to be compared, the current I / O request to be processed is placed in the target I / O request processing queue. If there is overlapping data between the target request data and the second historical request data to be compared, the current I / O request to be processed is placed in the second target mutex list. This avoids the problem of data inconsistency caused by additional I / O requests to a certain address occurring before an I / O request to that address has been completed.

[0175] If the number of target data management units is greater than one, the current pending IO request is split into multiple sub-pending IO requests based on the number of target data management units. This ensures the accuracy of splitting the current pending IO request into multiple sub-pending IO requests. Each sub-pending IO request is then placed into its corresponding target IO request processing queue based on the target data management unit it corresponds to, enabling scheduling of each sub-pending IO request. This ensures the accuracy of placing each sub-pending IO request into its corresponding target IO request processing queue, thereby further improving the overall IO request performance of the distributed storage system.

[0176] The target processing thread is used to schedule the currently pending IO requests in the target IO request processing queue. The target processing thread can be any one of multiple processing threads, which ensures the accuracy of scheduling the currently pending IO requests and enables the parallel scheduling of multiple pending IO requests, thereby further improving the overall IO request performance of the distributed storage system.

[0177] To better illustrate the IO scheduling method described in the embodiments of this application, this application provides a specific implementation method for a concurrent IO scheduling method based on data interval mutual exclusion. Taking Figure 15 as an example, the implementation of the technology of this application is explained in detail.

[0178] Assume the total capacity of the target logical unit to be accessed is 12MB, consisting of three 4MB (obj_size) data management units (numbered sequentially from 0), namely obj_0, obj_1, and obj_2, with corresponding OIDs of 0x0000123400000000, 0x0000123400000001, and 0x0000123400000002, respectively. Two consecutive IO read / write requests, IO_req1 and IO_req2, are made. The offset_1 of IO_req1 is 3MB and the length len_1 is 3MB. The offset_2 of IO_req2 is 5MB and the length len_2 is 4MB.

[0179] During the initialization of the distributed storage system, the first threshold `worker_num` is configured to be 3, meaning the maximum number of worker threads in the thread pool is 3, numbered starting from 0. The multi-IO request processing queue feature is enabled, and the second threshold `queue_num` is configured to be 3, meaning there are 3 IO request processing queues simultaneously, numbered starting from 0. Thread pool load balancing is also enabled by default, meaning the 3 worker threads (`worker_num`) are evenly distributed across the 3 IO request processing queues to handle IO requests.

[0180] First, the distributed storage system receives the IO write request IO_req1. Upon inspection, it finds that the requested data range spans two data management units and needs to be split. The inspection and splitting methods are as follows:

[0181] (1) Calculate which data management unit the starting address of the requested data block is located in; offset_1 / obj_size = 3 / 4 = 0...3;

[0182] That is, the starting address is located in the 0th data management unit, i.e., obj_0.

[0183] (2) Calculate which data management unit the end address of the requested data block is located in; (offset_1+len_1) / obj_size=(3+3) / 4=1……2;

[0184] The end address is located in the first data management unit, namely obj_1.

[0185] (3) Determine whether the IO request needs to be split;

[0186] Since the data management unit where the starting address is located and the data management unit where the ending address is located are not in the same data management unit, it is necessary to align according to obj_size and split the IO request into two data management unit requests for IO scheduling respectively.

[0187] The first sub-IO_req1 request is obj_0a_p1, which requests an offset_a_p1 of 3MB and a length len_a_p1 of 1MB in obj_0.

[0188] The second sub-IO_req1 request is obj_1a_p2, which requests that the offset_a_p2 in obj_1 is 0 and the length len_a_p2 is 2MB;

[0189] Then, the two sub-IO requests, obj_0a_p1 and obj_1a_p2, are placed on the IO request processing queue for scheduling. Here's a supplementary explanation of the naming: "obj_0" indicates the target data management unit is obj_0, "a" indicates the first concurrent IO request, and "p1" and "p2" indicate that the IO request is split into two data management unit requests.

[0190] (1) Perform a modulo operation on the oid of the data management unit that the first data management unit requests obj_0a_p1 to access: oid%queue_num=0x0000123400000000 / 3=0;

[0191] The first sub-IO_req1 request, obj_0a_p1, should be placed in the 0th IO request processing queue. Since this sub-IO_req1 is a read / write IO request and the IO request processing queue 0 is currently empty, it can be directly enqueued.

[0192] (2) Perform a modulo operation on the oid of the data management unit that the second data management unit requests obj_1a_p2 to access: oid%queue_num=0x0000123400000001 / 3=1;

[0193] The second sub-IO_req1obj_1a_p2 should be placed in the first IO request processing queue. Since this sub-IO_req1 request is a read / write IO request and the IO request processing queue 1 is currently empty, it can be directly enqueued.

[0194] Immediately afterwards, the sub-IO_req1 request is scheduled by IO, and the worker threads in the thread pool begin to process the IO.

[0195] Before the IO write request IO_req1 is completed, the distributed storage system concurrently receives the IO read request IO_req2. Upon inspection, it is found that the requested data range spans two data management units and needs to be split. The inspection and splitting methods are as follows:

[0196] (1) Calculate which data management unit the starting address of the requested data block is located in; offset_2 / obj_size = 5 / 4 = 1...1;

[0197] That is, the starting address is located in the first data management unit, namely obj_1.

[0198] (2) Calculate which data management unit the end address of the requested data block is located in; (offset_1+len_1) / obj_size=(5+4) / 4=2……1;

[0199] The end address is located in the second data management unit, namely obj_2.

[0200] (3) Determine whether the IO request needs to be split;

[0201] Since the data management unit where the starting address is located and the data management unit where the ending address is located are not in the same data management unit, it is necessary to align according to obj_size and split the IO request into two data management unit requests for IO scheduling respectively.

[0202] The first sub-IO_req2 request is obj_1b_p1, which requests an offset_b_p1 of 1MB and a length len_b_p1 of 3MB in obj_1.

[0203] The second sub-IO_req2 request is obj_2b_p2, which requests an offset_b_p2 of 0 and a length len_b_p2 of 1MB in obj_2.

[0204] Then, these two sub-IO_req2 requests, obj_1b_p1 and obj_2b_p2, are placed on the IO request processing queue for scheduling.

[0205] (1) Perform a modulo operation on the oid of the data management unit that the first sub-IO_req2 request obj_1b_p1 wants to access: oid%queue_num=0x0000123400000001%3=1;

[0206] The first data management unit request, obj_1b_p1, should be placed in the first IO request processing queue. This data management unit request is a read-write IO request. Since IO request processing queue 1 is not empty, it's necessary to first traverse IO request processing queue 1 to check if there is already a data management unit request in the target IO request processing queue that overlaps with the data range of the new data management unit request. It is found that both the existing data management unit request obj_1a_p2 and the new data management unit request obj_1b_p1 need to access the storage resource obj_1 with oid 0x0000123400000001. Therefore, it is necessary to determine whether the data ranges of these two data management unit requests overlap, i.e., to determine the size of the start and end addresses of the data ranges requested by the two data management unit requests within obj_1.

[0207] The starting address of the data in obj_1a_p2 is: offset_a_p2 = 0 (MB);

[0208] The end address of the data in obj_1a_p2 in obj_1: offset_a_p2 + len_a_p2 = 0 + 2 = 2 (MB);

[0209] That is, the data range of obj_1a_p2 in obj_1 is [0,2] MB;

[0210] The starting address of the data in obj_1b_p1: offset_b_p1 = 1 (MB);

[0211] The end address of the data in obj_1b_p1: offset_b_p2 + len_b_p2 = 1 + 3 = 4 (MB);

[0212] That is, the data range of obj_1b_p1 in obj_1 is [1,4] MB;

[0213] The data range [0,2]MB and the data range [1,4]MB overlap, so obj_1b_p1 needs to be added to the IO mutex list first. The specific operation is as follows:

[0214] If the check reveals that the linked list of obj_1a_p2 is not initialized, then the linked list is initialized and used as the head of the IO mutex linked list. Then, the new data management unit request obj_1b_p1 is added to the tail of the IO mutex linked list. At this time, the new data management unit request obj_1b_p1 does not participate in IO scheduling. It needs to wait for the data management unit request obj_1a_p2 to complete before attempting to add the new data management unit request obj_1b_p1 to the IO request processing queue for scheduling.

[0215] (2) Perform a modulo operation on the oid of the data management unit that the second data management unit requests obj_2b_p2 to access: oid%queue_num=0x0000123400000002%3=2;

[0216] The second data management unit request, obj_2b_p2, should be placed in the second IO request processing queue. Since this data management unit request is a read / write IO request and IO request processing queue 2 is currently empty, it can be directly enqueued.

[0217] At this point, each of the three IO request processing queues has one data management unit request being concurrently processed by worker threads in the thread pool, and there is one more data management unit request waiting to be scheduled on IO request processing queue 1.

[0218] Once the data management unit request obj_0a_p1 on IO request processing queue 0 has been processed, it needs to be removed from the IO request processing queue. The specific process is as follows: Upon inspection, it is found that the linked list on the data management unit request has not been initialized, so the data management unit request can be directly removed from the IO request processing queue.

[0219] After the data management unit request obj_1a_p2 on IO request processing queue 1 is processed, it needs to be removed from IO request processing queue 1. The specific process is as follows: Upon inspection, it is found that the linked list for the data management unit request has been initialized and is not empty. A temporary linked list head is used to temporarily store the data management unit request. Then, the data management unit request is removed from the IO mutex list. Next, the data management unit request is removed from IO request processing queue 1. Then, the IO mutex list is traversed through the temporary linked list head to retrieve the data management unit request obj_1b_p1 (i.e., the data management unit request is removed from the IO mutex list). Then, an attempt is made to add it back to IO request processing queue 1. At this point, IO request processing queue 1 is empty, so it is simply added to the tail of the queue. The IO mutex list traversal is now complete, and the process ends. At this point, the two data management unit requests obj_0a_p1 and obj_1a_p2, split from the IO write request IO_req1, have both been processed. The results are merged and returned to the user.

[0220] Once the data management unit request obj_2a_p2 on IO request processing queue 2 has been processed, it needs to be removed from the IO request processing queue. The specific process is as follows: Upon inspection, it is found that the linked list on the data management unit request has not been initialized, so the data management unit request can be directly removed from the IO request processing queue.

[0221] At this point, the IO request list only contains the data management unit request obj_1b_p1. After the data management unit request is completed, the two data management unit requests obj_1b_p1 and obj_2b_p2, which were split from the IO read request IO_req2, have been processed. The results are then merged and returned to the user.

[0222] This embodiment also provides an I / O scheduling device configured to implement the above embodiments and optional implementations, details of which will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0223] This embodiment provides an IO scheduling device, as shown in FIG16, including: an acquisition module 501, configured to acquire a currently pending IO request; a first determination module 502, configured to identify the currently pending IO request and determine the target request data corresponding to the currently pending IO request; a second determination module 503, configured to determine the request location of the target request data in the storage device and the corresponding request data volume of the target request data; and a scheduling module 504, configured to place the currently pending IO request into a target IO request processing queue according to the request location and request data volume corresponding to the target request data, and schedule the currently pending IO request.

[0224] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.

[0225] In this embodiment, the IO scheduling device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0226] This application also provides an electronic device having the IO scheduling device shown in FIG16 above.

[0227] Please refer to Figure 17, which is a schematic diagram of an electronic device provided in an optional embodiment of this application. As shown in Figure 17, the electronic device includes: one or more processors 10, a memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components communicate with each other using different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor can process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, multiple processors and / or multiple buses can be used with multiple memories and multiple memory sets, if desired. Similarly, multiple electronic devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 17 uses one processor 10 as an example.

[0228] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include hardware chips. These hardware chips may be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The programmable logic devices may be complex programmable logic devices (CLPs), field-programmable gate arrays (FPGAs), general-purpose array logic (GDAs), or any combination thereof.

[0229] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0230] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the electronic device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the electronic device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0231] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0232] The electronic device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30 and output device 20 can be connected via a bus or other means, as shown in Figure 17, which illustrates a bus connection.

[0233] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the electronic device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs (Light Emitting Diodes)), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, LEDs, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.

[0234] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; optionally, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0235] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0236] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.

Claims

1. An input / output (IO) scheduling method, the method comprising: The method comprises: acquiring a current IO request to be processed; identifying the current IO request to be processed, and determining target request data corresponding to the current IO request to be processed; determining a request position of the target request data in a storage device and a corresponding request data amount of the target request data; placing the current IO request to be processed into a target IO request processing queue according to the request position and the request data amount of the target request data, and scheduling the current IO request to be processed.

2. The method of claim 1, wherein, The placing of the current IO request to be processed into the target IO request processing queue according to the request position and the request data amount of the target request data, and the scheduling of the current IO request to be processed, comprise: comparing the request data amount with a preset request data amount threshold; in a case where the request data amount is less than or equal to the preset request data amount threshold, placing the current IO request to be processed into the target IO request processing queue according to the request position, and scheduling the current IO request to be processed; in a case where the request data amount is greater than the preset request data amount threshold, splitting the current IO request to be processed according to the target request data to obtain a plurality of sub IO requests to be processed; and placing each of the sub IO requests to be processed into the target IO request processing queue corresponding to each of the sub IO requests to be processed according to a sub request position corresponding to sub target data corresponding to each of the sub IO requests to be processed, and scheduling the plurality of sub IO requests to be processed.

3. The method of claim 1, wherein, The placing of the current IO request to be processed into the target IO request processing queue according to the request position and the request data amount of the target request data, comprises: determining a number of target data management units corresponding to the target request data according to the request position and the request data amount of the target request data; if the number of target data management units is 1, placing the current IO request to be processed into the target IO request processing queue corresponding to the target data management unit according to the target data management unit.

4. The method of claim 3, wherein, The determination of the number of target data management units corresponding to the target request data according to the request position and the request data amount of the target request data, comprises: determining a target logical unit corresponding to the target request data and an offset amount of the request position of the target request data in the target logical unit according to the request position of the target request data, to obtain a data management unit corresponding to a start address of the target request data; determining a data management unit corresponding to an end address of the target request data according to the request data amount; in a case where the data management unit corresponding to the start address and the data management unit corresponding to the end address are the same data management unit, determining that the number of target data management units is 1; In a case where the data management unit corresponding to the start address and the data management unit corresponding to the end address are different data management units, it is determined that the number of target data management units is greater than 1.

5. The method of claim 3, wherein, The method further includes: placing the current IO request into a target IO request processing queue according to the target request position and the request data amount of the target request data. In a case where the number of target data management units is greater than 1, the current IO request is split according to the number of target data management units to obtain a plurality of sub IO requests; the number of sub IO requests is consistent with the number of target data management units. Each sub IO request is placed into a corresponding target IO request processing queue according to the target data management unit corresponding to the sub IO request, so as to schedule each sub IO request.

6. The method of claim 3, wherein, The IO request processing queue is a plurality of IO request processing queues, and the current IO request is placed into a target IO request processing queue corresponding to the target data management unit according to the target data management unit, which includes: obtaining a queue number corresponding to the IO request processing queue; obtaining identification information of the target data management unit corresponding to the current IO request; placing the current IO request into the target IO request processing queue according to the queue number and the identification information.

7. The method of claim 6, wherein, The method of obtaining the queue number corresponding to the IO request processing queue includes: calculating the queue number according to the number of logical units and the number of data management units included in each logical unit.

8. The method of claim 6, wherein, The identification information of the target data management unit is a position sequence identifier of the target data management unit in a corresponding logical unit, and the current IO request is placed into the target IO request processing queue according to the queue number and the identification information, which includes: performing modulo calculation on the queue number by using the position sequence identifier; determining the target IO request processing queue corresponding to the current IO request from each IO request processing queue according to a calculation result; placing the current IO request into the target IO request processing queue.

9. The method of claim 8, wherein, The method of placing the current IO request into the target IO request processing queue includes: obtaining historical request data corresponding to each historical IO request in the target IO request processing queue; determining each first historical IO request in which the historical request data is in the target data management unit from the target IO request processing queue; comparing the target request data with first historical request data corresponding to each first historical IO request to be compared; placing the current IO request into the target IO request processing queue according to a comparison result.

10. The method of claim 9, wherein, The method of obtaining historical request data corresponding to each historical IO request in the target IO request processing queue includes: acquiring each historical pending IO request in the target IO request processing queue from the target IO request processing queue; identifying each historical pending IO request to obtain the historical request data corresponding to each historical pending IO request and the historical data management unit corresponding to the historical request data.

11. The method of claim 9, wherein, the current pending IO request is put into the target IO request processing queue according to the comparison result, including: if there is no overlapping data between the target request data and each first historical request data to be compared, the current pending IO request is put into the target IO request processing queue.

12. The method of claim 9, wherein, the current pending IO request is put into the target IO request processing queue according to the comparison result, further including: if there is overlapping data between the target request data and each first historical request data to be compared, the first historical IO request to be compared with the target request data is determined as a target historical IO request; the current pending IO request is put into the first target mutex linked list corresponding to the target historical IO request; when the target historical IO request is processed, the current pending IO request is put into the target IO request processing queue.

13. The method of claim 12, wherein, the current pending IO request is put into the target IO request processing queue when the target historical IO request is processed, including: temporarily storing the first target mutex linked list using a temporary linked list head; removing the target historical IO request from the first target mutex linked list; removing the target historical IO request from the target IO request processing queue; traversing the temporarily stored first target mutex linked list through the temporary linked list head, and sequentially performing the following steps on each other pending IO request on the first target mutex linked list except the target historical IO request in order: removing the other pending IO request from the first target mutex linked list, and putting the other pending IO request into the target IO request processing queue again.

14. The method of claim 12, wherein, the current pending IO request is put into the target IO request processing queue when the target historical IO request is processed, including: when the target historical IO request is processed, each second historical IO request to be compared is acquired from the target IO request processing queue again; the historical request data corresponding to the second historical IO request to be compared is in the target data management unit; comparing the target request data with the second historical request data to be compared corresponding to the second historical IO request to be compared; if there is no overlapping data between the target request data and each second historical request data to be compared, the current pending IO request is put into the target IO request processing queue; If there is overlapping data between the target request data and each second to-be-compared historical request data, the current to-be-processed IO request is put into a second target mutual exclusion linked list, wherein the second target mutual exclusion linked list is a mutual exclusion linked list corresponding to the second to-be-compared historical request data having overlapping data with the target request data.

15. The method of claim 9, wherein, The comparing the target request data with each first to-be-compared historical request data corresponding to the first to-be-compared historical IO request comprises: determining a target position offset of the target request data in the target data management unit according to the request position corresponding to the target request data; obtaining a historical position offset and a historical data amount of the first to-be-compared historical request data in the target data management unit; comparing the target request data with each first to-be-compared historical request data corresponding to the first to-be-compared historical IO request according to a relationship between the target position offset, the request data amount, the historical position offset and the historical data amount.

16. The method of claim 15, wherein, The comparing the target request data with each first to-be-compared historical request data corresponding to the first to-be-compared historical IO request according to a relationship between the target position offset, the request data amount, the historical position offset and the historical data amount comprises: calculating a sum of the historical position offset and the historical data amount to obtain a first total offset; calculating a sum of the target position offset and the request data amount to obtain a second total offset; comparing the target position offset with the first total offset; comparing the historical position offset with the second total offset; if the target position offset is greater than the first total offset, or the historical position offset is greater than the second total offset, it is determined that there is no overlapping data between the target request data and each first to-be-compared historical request data.

17. The method of claim 1, wherein, The scheduling the current to-be-processed IO request comprises: scheduling the current to-be-processed IO request in the target IO request processing queue by a target processing thread; the target processing thread is any one of a plurality of processing threads.

18. An electronic device, comprising: comprise: a memory and a processor, which are communicatively connected with each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the input / output (IO) scheduling method in any one of claims 1 to 17.

19. A computer non-transitory readable storage medium characterized in that, The computer non-transitory readable storage medium stores computer instructions, and the computer instructions are used to make a computer execute the input / output (IO) scheduling method in any one of claims 1 to 17.

20. A computer program product, characterised in that, comprise computer instructions, which are used to make a computer execute the input / output (IO) scheduling method in any one of claims 1 to 17.

Citation Information

Patent Citations

  • Resource access control method and system

    CN101005486A

  • Task scheduling method and device, computer equipment and computer readable storage medium

    CN115292025A

  • Request processing method and device, equipment and readable storage medium

    CN117311619A

  • Request processing method and system, electronic equipment and storage medium

    CN117492963A

  • IO request processing method and device, storage equipment and storage medium

    CN118312102A