IO request processing method, device, equipment and medium
By allocating to the corresponding IO request queue according to the priority parameters of the IO request and distributing them in sequence, the problem of long response time in the prior art is solved, and the processing efficiency of IO requests is significantly improved.
Patent Information
- Application Number
- CN202411579317.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-11-06
AI Technical Summary
The IO scheduling algorithm used in the prior art causes the response time of the IO request to be long and cannot meet the fast processing requirements of the IO request.
By obtaining the priority parameters of the process corresponding to the IO request, the IO request is assigned to the target IO request queue corresponding to the priority parameters. The queue includes a number of queues with different dispatch methods. Each queue corresponds to a priority sorting queue group, and is distributed according to the order parameters of the IO request in the queue.
The efficiency of IO request processing has been greatly improved, especially in high load and single-process multi-IO request scenarios, the efficiency of IO request delivery of the operating system has been significantly improved.
Smart Images

Figure CN119088533B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure generally relates to the field of computer technology, and more particularly to a method, apparatus, device and medium for processing an IO request. Background Art
[0002] With the continuous development of computer technology, more and more applications are installed in computers, and the processes that need to be processed are also increasing accordingly.
[0003] The process of computer processing often involves the processing of IO requests. The faster the processing speed of IO requests is, the better the overall processing performance of the computer can be. The IO scheduling algorithm used in the relevant technology will make the response time of IO requests longer, and the demand for fast processing of IO requests cannot be met. Summary of the invention
[0004] In view of the above-mentioned defects or deficiencies in the related art, it is desired to provide a method, apparatus, device and medium for processing IO requests, which can solve the problem that the IO scheduling algorithm used in the related art will result in a long response time for IO requests and the demand for fast processing of IO requests cannot be met, thereby greatly improving the processing efficiency of IO requests.
[0005] In a first aspect, a method for processing an IO request is provided, the method comprising:
[0006] Obtaining the priority parameter of the process corresponding to the IO request;
[0007] According to the priority parameter, the IO request is allocated to a target IO request queue corresponding to the priority parameter, the target IO request queue includes at least two IO request queues, each of the at least two IO request queues has a different queue dispatching mode, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes a plurality of queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue;
[0008] The IO requests are dispatched according to the order parameters of the IO requests in the target IO request queue.
[0009] In the present application, the priority parameter of the process corresponding to the above-mentioned IO request is first obtained, and then, according to the priority parameter, the above-mentioned IO request is allocated to the target IO request queue corresponding to the priority parameter (the target IO request queue includes at least two IO request queues, and further, each IO request queue in the above-mentioned at least two IO request queues has a different queue dispatching method, and at the same time, each IO request queue in the above-mentioned at least two IO request queues corresponds to a priority sorting queue group, and each priority sorting queue group includes multiple IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue); thereafter, the IO request is dispatched according to the order parameter of the IO request in the target IO request queue. In this way, by obtaining the priority parameter of the process corresponding to the IO request, the IO request is assigned to the corresponding IO request queue according to its priority parameter in the process. That is, the IO request queue is also divided and arranged in advance according to the priority parameter of the process, and then on the basis of the dispatch order, the dispatch factor of the process priority is also added, thereby greatly improving the rationality and efficiency of the subsequent dispatch of IO requests. In particular, for the IO request dispatch under high load and the high throughput scenario requirements of multiple IO requests in a single process (for example, IO requests in a database environment), the IO request dispatch efficiency of the operating system is greatly improved.
[0010] In a second aspect, a resource access device is provided, the device comprising:
[0011] An acquisition unit, used to acquire a priority parameter of a process corresponding to the IO request;
[0012] an execution unit, configured to allocate the IO request to a target IO request queue corresponding to the priority parameter according to the priority parameter acquired by the acquisition unit, wherein the target IO request queue includes at least two IO request queues, each of the at least two IO request queues has a different queue dispatching mode, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes a plurality of IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue;
[0013] The execution unit is further configured to dispatch the IO request according to an order parameter of the IO request in the target IO request queue.
[0014] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect is implemented.
[0015] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, the method described in the first aspect is implemented.
[0016] In a fifth aspect, a computer program product is provided. The computer program product includes instructions, and the instructions are executed by a processor to implement the method described in the first aspect.
[0017] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0019] Figure 1 One of the flowcharts of the IO request processing method provided in the embodiment of the present application;
[0020] Figure 2 One of the flowcharts of the IO request processing method provided in the embodiment of the present application;
[0021] Figure 3 One of the flowcharts of the IO request processing method provided in the embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of an IO request processing device provided in an embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0025] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The following is a description of the usage scenarios of the embodiments of the present application.
[0026] With the continuous development of computers, the processing speed of computers is also increasing. IO request processing is a very important part of computer processing.
[0027] In related technologies, a multi-queue architecture is often used. Under the current multi-queue architecture, there are two mainstream IO scheduling algorithms: mq-deadline and bfq.
[0028] When the disk that processes IO requests in a computer is a mechanical disk, the IO performance of the mechanical disk will be limited by its physical characteristics. Specifically, different sectors of the mechanical disk are used to process different IO requests. It is necessary to rotate the disk to first find the specific processing position and then process the IO request. In this process, it will be limited by many factors, such as seek time and rotation delay, which will reduce the processing efficiency of IO requests.
[0029] Based on this, in the mq-deadline scheduling algorithm, priority is given to expiring IO requests, and adjacent IO requests are merged and sorted as much as possible to reduce the number of head movements and rotation waiting time, thereby optimizing the IO performance of the mechanical disk.
[0030] With the development of science and technology, new storage devices, such as solid-state drives (SSDs), have gradually replaced some mechanical disk devices. Since new storage does not need to consider issues such as seek time and rotation delay, the merging and sorting functions of the mq-deadline scheduling algorithm sometimes have a counterproductive effect, which will reduce the processing speed of IO requests in SSDs or similar solid-state drives. In addition, when there are many IO requests in the computer system, that is, when the load is high, if the mq-deadline scheduling algorithm is used, the IO request response time will be longer, especially for small IO requests.
[0031] On this basis, the bfq scheduling algorithm is used. The bfq scheduling algorithm is an improved version of the cfq scheduling algorithm. Its purpose is to treat the process corresponding to each IO request fairly. Specifically, the hardware corresponding to the bfq scheduling algorithm, that is, the IO request scheduler, will allocate a budget (budget) measured in the number of sectors to each process, so as to carry out the processing of IO requests. However, this is not very friendly for database services with a specific type of process, that is, a single process has a large number of IO requests.
[0032] Therefore, the IO scheduling algorithm used in the related art will make the response time of the IO request longer, and the demand for fast processing of the IO request cannot be met.
[0033] Based on this, the present application proposes a method, device, equipment and medium for processing IO requests, which can solve the problem that the IO scheduling algorithm used in the relevant technology will make the response time of IO requests long and the demand for fast processing of IO requests cannot be met, thereby greatly improving the processing efficiency of IO requests.
[0034] Figure 1 The present application provides a flowchart of a method for processing an IO request. The execution subject of the method may be a computer or an IO scheduling module (including an IO request scheduler) in the computer. The present application does not limit this. Figure 1 As shown, the method includes the following steps 301 to 303:
[0035] Step 301: Obtain the priority parameter of the process corresponding to the above IO request.
[0036] In the embodiment of the present application, one process may correspond to multiple IO requests, and accordingly, different IO requests may correspond to the same process.
[0037] Exemplarily, the above process may be an application program or other background program, which is not limited in the embodiments of the present application.
[0038] In the embodiment of the present application, a process may correspond to one priority parameter or multiple priority parameters.
[0039] Exemplarily, in the case where one process corresponds to multiple priority parameters, one process includes multiple sub-processes, and different sub-processes have different priority parameters. For example, when the process is an application, such as a communication application in a computer, the communication application includes multiple processes, such as a text communication sub-process, a video and voice communication sub-process, and a friend circle sharing sub-process. Among these three sub-processes, the priority parameter of the video and voice communication sub-process is greater than the priority parameter of the text communication sub-process, and the priority parameter of the text communication sub-process is greater than the priority parameter of the friend circle sharing sub-process, that is, the priority of the video and voice communication sub-process is higher than the priority of the text communication sub-process, and the priority of the text communication sub-process is higher than the priority of the friend circle sharing sub-process (in this example, the larger the priority parameter, the higher the priority).
[0040] In the embodiment of the present application, the above-mentioned priority parameters can be used from large to small to represent the priority from high to low. Correspondingly, the above-mentioned priority parameters can also be used from low to high to represent the priority from high to low. The embodiment of the present application does not limit this.
[0041] In the embodiment of the present application, the priority parameter is preset in advance in the request information corresponding to the IO request. After the IO request is obtained, the priority parameter can be obtained from the request information corresponding to the IO request.
[0042] It can be understood that since different processes are pre-set with their own priority parameters, when each process issues an IO request, the priority parameter of the process itself can be set in the IO request as part of the request information corresponding to the IO request, so that the IO scheduling module can obtain the priority parameter of the process corresponding to the IO request.
[0043] Step 302: According to the priority parameter, the IO request is allocated to a target IO request queue corresponding to the priority parameter.
[0044] In an embodiment of the present application, the target IO request queue includes at least two IO request queues, and each of the at least two IO request queues has a different queue dispatching mode.
[0045] It can be understood that, in the embodiment of the present application, the reason why each IO request can be assigned to at least two IO request queues and different IO request queues have different dispatching methods is that different dispatching methods have different final dispatching orders for the same IO request. By assigning each IO request to different IO request queues at the same time, the superiority of different IO request queues in dispatching methods can be fully utilized. For example, the first queue will not perform any recognition on the IO requests, but simply receive and sort them in order, while the second queue will perform a certain degree of recognition on the IO requests. Assuming that there are IO requests with the same process in the queue, the latest IO request obtained may be merged with the IO request that was previously received and not yet dispatched, and sent together. In this way, assuming that the obtained IO requests are assigned to queues with these two different dispatching methods, it is possible that the second queue will send the newly received IO request first, which is to take advantage of the superiority of the merge sorting of the second queue. At the same time, through the simple sorting of the first queue, it can also be guaranteed to the greatest extent that the IO requests assigned in the first queue will not be excessively delayed in dispatch. In other words, it can be imagined that at least the assigned IO requests can be dispatched in the order in which they were accepted.
[0046] In an embodiment of the present application, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes multiple IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue.
[0047] Exemplarily, different IO request queues in each priority sorting queue group correspond to at least one IO request process, and the priority parameters of different IO request processes are different.
[0048] Exemplarily, for each IO request queue, it actually belongs to a priority sorting queue group, and the dispatching method of the priority sorting queue group is the same, but the priority parameters of different IO request queues in each priority sorting queue group are different. For example, for the above-mentioned first queue and second queue, the first queue belongs to an IO request queue in the first priority sorting queue group, and the second queue belongs to an IO request queue in the second priority sorting queue group, wherein the first priority sorting queue group is provided with a plurality of IO request queues with different priorities, for example, IO request queues with 10 priorities are provided, and correspondingly, the second priority sorting queue group is also provided with a plurality of IO request queues with different priorities, for example, IO request queues with 10 priorities are provided.
[0049] It is understandable that, in order to ensure the consistency of the above-mentioned IO request allocation process, the priorities of different IO request queues in the above-mentioned priority sorting queue group are divided in advance with reference to the priority parameters of the processes corresponding to the IO requests. In this way, each IO request queue in the priority sorting queue group can be matched with the priority parameters of the IO requests.
[0050] Optionally, in an embodiment of the present application, the IO request queue dispatching method includes: first-in-first-out dispatching, and dispatching based on priority and same type merging.
[0051] Exemplarily, when the dispatching mode of the IO request queue is first-in-first-out dispatching, the IO request queue is a first-in-first-out (FIFO) queue.
[0052] Exemplarily, when the dispatching method of the IO request queue is dispatching based on priority and merging of the same type, the IO request queue is a red-black tree queue.
[0053] It can be understood that, in the embodiment of the present application, the at least two IO request queues included in the target request queue include at least: a first-in-first-out queue and a red-black tree queue.
[0054] Furthermore, the priority sorting queue group corresponding to the above-mentioned first-in-first-out queue includes multiple first-in-first-out queues with different priorities; correspondingly, the priority sorting queue group corresponding to the above-mentioned red-black tree queue includes multiple red-black tree queues with different priorities.
[0055] Furthermore, the number of multiple first-in-first-out queues with different priorities in the priority sorting queue group is the same as the number of multiple red-black tree queues with different priorities in the priority sorting queue group; accordingly, the priority setting method of multiple first-in-first-out queues with different priorities is the same as the priority setting method in multiple red-black tree queues with different priorities.
[0056] It is understandable that the priority setting method of multiple FIFO queues with different priorities depends on the setting method of the priority parameters of the processes corresponding to the possible IO requests, and correspondingly, the priority setting method of multiple red-black tree queues with different priorities depends on the setting method of the priority parameters of the processes corresponding to the possible IO requests. That is, for the FIFO queue and the red-black tree queue, their priorities are pre-set in advance according to the setting method of the priority parameters of the processes corresponding to the IO requests.
[0057] Furthermore, the priority setting method of the process corresponding to the IO request can be customized by the user, or it can be pre-set by default for the device that issues the IO request, and the embodiments of the present application are not limited to this.
[0058] Step 303: dispatching the IO request according to the order parameter of the IO request in the target IO request queue.
[0059] In the embodiment of the present application, the above-mentioned sequence parameter corresponds to the allocation method of the above-mentioned IO request in the above-mentioned target IO request queue.
[0060] As described above, the target IO request queue includes more than two IO request queues, and different IO request queues place IO requests in different ways. Therefore, after the IO requests enter the two or more IO request queues in the target IO request queue respectively, the order parameters in each IO request queue are determined by the allocation method of the IO request queue itself. For example, for a first-in-first-out queue, it will be sorted in the order in which the IO requests are received, while for a red-black tree queue, it will be classified and merged according to the process corresponding to the IO request, that is, there may be a situation where the order parameters of the IO requests in the red-black tree queue are different from the order in which the IO requests are received by the red-black tree queue.
[0061] It is understandable that after an IO request is dispatched by any one of the target IO request queues, the other IO request queues will clear the IO request.
[0062] In the method provided in the embodiment of the present application, the priority parameter of the process corresponding to the above-mentioned IO request is first obtained, and then, according to the priority parameter, the above-mentioned IO request is allocated to the target IO request queue corresponding to the priority parameter (the target IO request queue includes at least two IO request queues, and further, each IO request queue in the above-mentioned at least two IO request queues has a different queue dispatch mode, and at the same time, each IO request queue in the above-mentioned at least two IO request queues corresponds to a priority sorting queue group, and each priority sorting queue group includes multiple IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue); thereafter, the IO request is dispatched according to the order parameter of the IO request in the target IO request queue. In this way, by obtaining the priority parameter of the process corresponding to the IO request, the IO request is assigned to the corresponding IO request queue according to its priority parameter in the process. That is, the IO request queue is also divided and arranged in advance according to the priority parameter of the process, and then on the basis of the dispatch order, the dispatch factor of the process priority is also added, thereby greatly improving the rationality and efficiency of the subsequent dispatch of IO requests. In particular, for the IO request dispatch under high load and the high throughput scenario requirements of multiple IO requests in a single process (for example, IO requests in a database environment), the IO request dispatch efficiency of the operating system is greatly improved.
[0063] In another embodiment of the present application, a specific implementation method for allocating IO requests is also provided. Exemplarily, the specific implementation of "allocating the IO request to the target IO request queue corresponding to the priority parameter according to the priority parameter" mentioned above includes: according to the priority parameter, selecting IO request queues matching the priority parameter from at least two priority sorting queue groups as target IO request queues; and allocating the IO request to the target IO request queue corresponding to the priority parameter according to the sorting method of different IO request queues in the target IO request queue.
[0064] Exemplarily, the different IO request queues allocate the IO requests in different order.
[0065] It can be understood that, from the foregoing content, the division method of different IO request queues in each priority sorting queue group of different priority sorting queue groups is based on priority, and the division method of IO request queues in different priority sorting queue groups is the same. Specifically, the priority of the IO request queue corresponds to the priority of all processes that generate IO requests.
[0066] That is, the priorities of all processes that generate IO requests can be sorted first, and these priorities can be used as priority parameters of IO requests. Then, according to the priorities of all processes, several IO request queues can be set accordingly. In this way, IO requests with different priority parameters generated by all processes can be matched with the IO request queues.
[0067] Exemplarily, as can be seen from the above content, the above sorting method is that different IO request queues have different ways of processing IO requests. For example, the first-in-first-out queue simply sorts the IO requests in order, and the red-black tree queue classifies the IO requests according to their corresponding processes. Therefore, in different IO request queues, the sorting method of IO requests is different.
[0068] Exemplarily, the IO request may be allocated to an IO request queue that matches the priority of the IO request process according to the sorting mode of different IO request queues in the target IO request queue, and the IO request may be sorted according to the sorting mode of the IO request queue.
[0069] In another embodiment of the present application, a specific implementation method for rationally allocating IO requests is also provided. Exemplarily, the above-mentioned IO request queue also includes a priority dispatch queue, and the above-mentioned priority dispatch queue is other queues other than the above-mentioned priority sorting queue group. When the above-mentioned target IO request queue is full, the above-mentioned "allocating the above-mentioned IO request to the target IO request queue corresponding to the above-mentioned priority parameter" includes: screening out the first IO request from the above-mentioned target IO request queue; adding the above-mentioned first IO request to the above-mentioned priority dispatch queue, and removing the above-mentioned first IO request from the above-mentioned target IO request queue.
[0070] Exemplarily, the first IO request is an IO request in the target IO request queue whose dispatching time is closest to the current time.
[0071] It is understandable that when there are many IO requests and the system generating the IO requests is under high load, the target IO request queue is likely to be full. The target IO request queue is full means that any IO request queue in the target IO request queue has no space for placing new IO requests.
[0072] Exemplarily, the priority dispatch queue is a queue that sends IO requests with priority over any other queue.
[0073] In an example, the priority dispatch queue may be: first_dispatch queue.
[0074] It is understandable that the priority delivery queue is an alternative queue, not a regular queue.
[0075] Exemplarily, the function of the priority dispatch queue is: when any regular queue is full and needs to add new IO requests, some IO requests in the full regular queue are processed first to make room for the new IO requests.
[0076] Exemplarily, when there are IO requests in the priority dispatch queue, the IO requests in the priority dispatch queue are dispatched first. That is, the dispatch priority of the priority dispatch queue is the highest among all IO request queues.
[0077] Exemplarily, the target IO request queue being full means that any one of the at least two IO request queues in the target IO request queue is full.
[0078] Furthermore, since the process of allocating IO requests in at least two IO request queues in the target IO request queue is synchronized, that is, assuming that there are a first queue and a second queue, if IO requests are allocated in the first queue, then IO requests will definitely be allocated in the second queue. Based on this, the first queue is full, which may mean that the second queue is full.
[0079] Exemplarily, the dispatch time means that in the IO request queue, each IO request has its corresponding dispatch time. For example, for any IO request, there will be a maximum waiting time for sending. The time from when the IO request is set in the IO request queue to when the IO request is finally dispatched cannot exceed the maximum waiting time for sending, otherwise it will be considered that the IO request dispatch timed out. Therefore, the time generated by adding the maximum waiting time for sending from the time when the IO request is set in the IO request queue is equal to the dispatch time.
[0080] Furthermore, when the IO requests in the target request queue are full and there are new IO requests waiting to be allocated, the IO requests whose dispatching time in the target request queue is closest to the current time can be screened out, that is, the IO request waiting to be processed most recently in the target request queue is taken as the first IO request, which is added to the priority dispatch queue for dispatch first, and the first IO request is removed from the originally set target IO request.
[0081] In this way, when the target IO request is fully loaded and there are new IO requests waiting for allocation, the target IO request can be processed first through the priority dispatch queue, and space can be made for the new IO request. The IO request can be reasonably allocated to meet the allocation requirements in the IO request allocation, and the rationality of IO request allocation can be greatly improved without delaying the IO request dispatch.
[0082] In another embodiment of the present application, a specific implementation method for determining timed-out IO requests is also provided. Before the aforementioned "dispatching the IO requests according to the order parameters of the IO requests in the target IO request queue", the method further includes: obtaining the dispatch waiting time of each IO request among all IO requests in the target IO request queue; comparing the dispatch waiting time with the preset dispatch time to determine the existence of a timed-out queue in the target IO request queue.
[0083] Exemplarily, the above-mentioned dispatch waiting time refers to the time from the current time to the dispatch time for each IO request.
[0084] Exemplarily, the delivery time can refer to the above content, which will not be repeated here.
[0085] Exemplarily, the above-mentioned preset dispatching duration is used to indicate: the duration for determining whether the dispatching of an IO request has timed out.
[0086] It is understandable that in the embodiment of the present application, the above-mentioned timeout queue includes: a timed-out queue and a queue that is about to timeout. This means that, assuming that for a certain IO request, the duration from the current moment to the dispatch moment, that is, the dispatch waiting time is greater than 0, the IO request may have timed out. In other words, in order to ensure that each IO request will not be dispatched overtime as much as possible or not at all, when the dispatch waiting time of each IO request is less than the preset dispatch time, it indicates that there is a risk of dispatch timeout. At this time, it will be judged as an IO request that has timed out, and the IO request queue corresponding to the IO request belongs to the timeout queue.
[0087] Exemplarily, after determining whether there is a timed IO request in the process of adding a new IO request to the target IO request, the following two solutions are provided according to whether there is a timed-out queue in the target IO request queue or not.
[0088] Solution 1: A timeout queue exists in the target IO request queue.
[0089] Optionally, in an embodiment of the present application, the IO request queue includes a priority dispatch queue, and the priority dispatch queue is a queue other than the priority sorting queue group. In the case that a timeout queue exists in the target IO request queue, the IO request is dispatched according to the order parameter of the IO request in the target IO request queue. The IO request processing method provided in the embodiment of the present application includes: in the case that a timeout queue exists in the target IO request queue, the timeout queue is added to the priority dispatch queue, and the timeout queue is removed from the target IO request queue; the timeout queue in the priority dispatch queue is dispatched.
[0090] Exemplarily, the function of the priority dispatch queue also includes: when there are timed IO requests in the regular IO request queue, which causes the IO request queue to belong to the timeout queue, the timed IO requests in the timeout queue are added to the priority dispatch queue for first processing.
[0091] It is understandable that, in the case where a timeout queue exists, the timeout IO request is added to the priority dispatch queue and removed from the timeout queue.
[0092] It should be noted that, in the process of adding the timed-out IO request to the priority dispatch queue and removing it from the timed-out queue, the timed-out IO request is removed from each IO request queue in the target IO request queue.
[0093] Solution 2: There is no timeout queue in the target IO request queue.
[0094] Optionally, in an embodiment of the present application, when there is no timed-out IO in the target IO request queue, the IO request is dispatched according to the order parameters of the IO request in the target IO request queue, including: obtaining the IO request information in the priority dispatch queue; when the queue information indicates that there are IO requests to be dispatched in the queue, dispatching the IO requests to be dispatched; dispatching the IO request according to the order parameters of the IO request in the target IO request queue.
[0095] It is understandable that in the embodiment of the present application, when the above-mentioned target IO request queue includes a timed-out IO request, a timed-out queue will appear in the target IO request queue. Correspondingly, when there is no timed-out IO request in the above-mentioned target IO request queue, when there is no timed-out queue in the target IO request queue, first check whether there is any IO request in the priority dispatch queue. When there is an IO request in the priority dispatch queue, first dispatch the IO request in the priority dispatch queue. When the priority dispatch queue is empty, dispatch the IO request according to the order parameter of the IO request in the above-mentioned target IO request queue.
[0096] The following two examples, namely Example 1 and Example 2, illustrate the process of adding IO requests to the target IO request queue and dispatching IO requests.
[0097] In Example 1 and Example 2, there are two types of IO request queues, that is, two types of priority sorting queue groups, namely, FIFO priority sorting queue group and red-black tree priority sorting queue group, each priority sorting queue group includes 10 IO request queues with different priorities, that is, the FIFO priority sorting queue group includes 10 FIFO-IO request queues with different priorities, and the red-black tree priority sorting queue group includes 10 red-black tree IO request queues with different priorities. The 10 priorities match the priority classification of the processes corresponding to the IO requests that may enter the priority sorting queue group. In the process of a computer process generating an IO request, the IO request will have the priority parameter of the process to which it belongs, and each priority sorting queue group will assign a specific IO request queue to it according to the priority parameter of the process to which it belongs attached to the IO request. The priority dispatch queue is the first_dispatch queue.
[0098] Example 1: A new IO request needs to be queued in the algorithm queue.
[0099] S101: Obtaining a process policy of an IO request, wherein the process policy includes a priority parameter of a process corresponding to the IO request.
[0100] S102: Determine the target IO request queue corresponding to the process strategy. The target IO request queue is: the red-black tree priority sorting queue with the third priority in the red-black tree priority sorting queue group, and the FIFO priority sorting queue with the third priority in the FIFO priority sorting queue group.
[0101] S103: Determine whether the target IO request queue is fully loaded, that is, determine whether the queue length of the target IO request queue reaches a preset queue length threshold, which may be preset by the system and is used to indicate the length of the fully loaded IO request queue.
[0102] According to the IO request queue being full, the following two execution steps are divided into S104a1 and S104b1
[0103] S104a1: When the target IO request queue is not fully loaded, the IO request is directly added to the target IO request queue and waits for dispatch.
[0104] S104b1: When the target IO request queue is fully loaded, whether there is a timed-out IO request in the FIFO queue.
[0105] Depending on whether there is a timed IO request in the IO request queue, the following steps are performed: S104c1 and S104c2
[0106] S104c1: In the case where there is no timed IO request, since the queue is already full, the smallest IO request in the red-black tree IO request queue is added to the first_dispatch queue to make room for the new IO request. The smallest IO request is the IO request to be dispatched.
[0107] S104c2: In the case of a timed IO request, the timed IO request in the IO request queue is directly added to the first_dispatch queue.
[0108] S104c3: After the IO request in the IO request queue is added to the first_dispatch queue, the IO request added to the first_dispatch queue may be removed.
[0109] Example 2: The following describes dispatching an IO request that is already in the target IO request queue.
[0110] S201: First determine whether there is a timed IO request in the FIFO-IO request queue in the target request queue.
[0111] Depending on whether there is a timed IO request in the target IO request queue, the process is divided into the following steps S202a1-S202a5 and steps S202b1-S202b5.
[0112] S202a1: When there is no timed IO request in the FIFO-IO request queue, first determine whether the first_dispatch queue is empty.
[0113] S202a2: Whether the red-black tree IO request queue is empty.
[0114] S202a3: Is the FIFO-IO request queue empty?
[0115] S202a4: When both the red-black tree IO request queue and the FIFO-IO request queue have IO requests, that is, when both the empty and unempty conditions are negative, the minimum IO request in the red-black tree IO request queue is dispatched.
[0116] S202a5: Remove the dispatched IO requests in the FIFO-IO request queue and the red-black tree IO request queue in the target IO request queue.
[0117] S202b1: When there is a timed IO request in the FIFO-IO request queue, add the timed IO request to the first_dispatch queue.
[0118] S202b2: Remove the dispatched IO requests in the FIFO-IO request queue and the red-black tree IO request queue in the target IO request queue.
[0119] S202b3: Dispatching IO requests in the first_dispatch queue
[0120] S202b4: Remove the dispatched IO requests in the first_dispatch queue.
[0121] The present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the training rule determination method described in the present application is implemented. For example, the following can be executed: Figure 1 The individual steps of the method are shown.
[0122] The present invention provides a computer program product, which includes instructions that are executed by a processor when the processor executes the instructions. Figure 1 The individual steps of the method are shown.
[0123] It should be noted that although the operations of the method of the present invention are described in a particular order in the drawings, this does not require or imply that the operations must be performed in this particular order or that all illustrated operations must be performed to achieve desired results.
[0124] Figure 4 This is a block diagram of an IO request processing device according to an embodiment of the present application. The device can be deployed in a computer or an IO controller or an IO control module. Figure 4 The device includes an acquisition unit 601 and an execution unit 602.
[0125] An acquisition unit 601 is used to acquire a priority parameter of a process corresponding to the IO request;
[0126] An execution unit 602 is used to allocate the IO request to a target IO request queue corresponding to the priority parameter according to the priority parameter obtained by the acquisition unit 601, wherein the target IO request queue includes at least two IO request queues, each of the at least two IO request queues has a different queue dispatching mode, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes a plurality of IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue;
[0127] The execution unit is further configured to dispatch the IO request according to an order parameter of the IO request in the target IO request queue.
[0128] In one embodiment, the execution unit 602 is specifically configured to, according to the priority parameter, select IO request queues matching the priority parameter from at least two priority sorting queue groups as target IO request queues;
[0129] According to the ordering of different IO request queues in the target IO request queue, the IO request is allocated to the target IO request queue corresponding to the priority parameter.
[0130] In one embodiment, the IO request queue dispatching method includes: first-in-first-out dispatching, and dispatching based on priority and same type merging.
[0131] In one embodiment, the IO request queue also includes a priority dispatch queue, which is a queue other than the priority sorting queue group. The execution unit 602 is specifically used to: filter out a first IO request from the target IO request queue, where the first IO request is an IO request in the target IO request queue whose dispatch time is closest to the current time; add the first IO request to the priority dispatch queue, and remove the first IO request from the target IO request queue.
[0132] In one embodiment, the execution unit 602 is specifically used to obtain the dispatch waiting time of each IO request among all IO requests in the target IO request queue; compare the dispatch waiting time with the preset dispatch time to determine the existence of a timeout queue in the target IO request queue.
[0133] In one embodiment, the IO request queue includes a priority dispatch queue, which is a queue other than the priority queue group. The execution unit 602 is specifically configured to add the timeout queue to the priority dispatch queue and remove the timeout queue from the target IO request queue if there is a timeout queue in the target IO request queue; dispatch the timeout queue in the priority dispatch queue
[0134] It should be understood that the units recorded in the IO request processing device correspond to the various steps in the method described in the accompanying drawings. Therefore, the operations and features described above for the method are also applicable to the IO request processing device and the units contained therein, and will not be repeated here. The IO request processing device can be pre-implemented in the browser or other security application of the computer device, and can also be loaded into the browser or its security application of the computer device by downloading or other means. The corresponding units in the IO request processing device can cooperate with the units in the computer device to implement the solution of the embodiment of the present application.
[0135] For the several modules or units mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0136] It should be noted that for details not disclosed in the IO request processing device in the embodiment of the present application, please refer to the details disclosed in the above embodiments of the present application, which will not be repeated here.
[0137] Reference below Figure 5 , Figure 5 FIG. 1 is a schematic diagram showing a structure of a computer device suitable for implementing an embodiment of the present application. Figure 5 As shown, the computer system 1700 includes a central processing unit (CPU) 1701, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1702 or the program loaded from the storage part 1708 to the random access memory (RAM) 1703. In the RAM 1703, various programs and data required for the operation instructions of the system are also stored. The CPU 1701, the ROM 1702, and the RAM 1703 are connected to each other through a bus 1704. An input / output (I / O) interface 1705 is also connected to the bus 1704.
[0138] The following components are connected to the I / O interface 1705: an input section 1706 including a keyboard, a mouse, etc.; an output section 1707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1708 including a hard disk, etc.; and a communication section 1709 including a network interface card such as a LAN card, a modem, etc. The communication section 1709 performs communication processing via a network such as the Internet. A drive 1710 is also connected to the I / O interface 1705 as needed. A removable medium 1711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1710 as needed, so that a computer program read therefrom is installed into the storage section 1708 as needed.
[0139] In particular, according to an embodiment of the present application, the above reference flow chart Figure 1The described process can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1709, and / or installed from a removable medium 1711. When the computer program is executed by the central processing unit (CPU) 1701, the above-mentioned functions defined in the system of the present application are executed.
[0140] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium such as a computer-readable storage medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0141] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operating instructions of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the aforementioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, the boxes represented by two connections can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operating instruction, or can be implemented with a combination of dedicated hardware and computer instructions.
[0142] The units or modules involved in the embodiments described in the present application may be implemented by software or hardware. The units or modules described may also be set in a processor. For example, it may be described as: a processor includes a first receiving module, a second receiving module, and a sending module. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.
[0143] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device. The above computer-readable storage medium stores one or more programs, and when the above programs are used by one or more processors to execute the IO request processing method described in the present application.
[0144] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present application (but not limited to) by each other to form a technical solution.
Claims
1. A method for processing an IO request, characterized in that: include: Get the priority parameter of the process corresponding to the IO request; According to the priority parameter, IO request queues matching the priority parameter are respectively selected from at least two priority sorting queue groups as target IO request queues; according to the sorting mode of different IO request queues in the target IO request queue, the IO request is allocated to the target IO request queue corresponding to the priority parameter; the target IO request queue includes at least two IO request queues, each of the at least two IO request queues has a different queue dispatching mode, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes a plurality of IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue; the dispatching modes of the at least two IO request queues include first-in-first-out dispatching, and dispatching based on priority and same type merging; The IO requests are dispatched according to the order parameters of the IO requests in the target IO request queue.
2. The method according to claim 1, characterized in that The IO request queue further includes a priority dispatch queue, which is another queue other than the priority sorting queue group. When the target IO request queue is full, the IO request is allocated to the target IO request queue corresponding to the priority parameter, including: Filtering out a first IO request from the target IO request queue, where the first IO request is an IO request in the target IO request queue whose dispatching time is closest to the current time; The first IO request is added to the priority dispatch queue, and the first IO request is removed from the target IO request queue.
3. The method according to claim 1, characterized in that Before dispatching the IO request according to the order parameter of the IO request in the target IO request queue, the method further includes: Obtain the dispatch waiting time of each IO request among all IO requests in the target IO request queue; The dispatch waiting time is compared with a preset dispatch time to determine whether a timeout queue exists in the target IO request queue.
4. The method according to claim 3, characterized in that The IO request queue includes a priority dispatch queue, which is another queue other than the priority sorting queue group. When a timeout queue exists in the target IO request queue, dispatching the IO request according to the order parameter of the IO request in the target IO request queue includes: In the case where a timeout queue exists in the target IO request queue, the timeout queue is added to the priority dispatch queue, and the timeout queue is removed from the target IO request queue; The timeout queue in the priority dispatch queue is dispatched.
5. The method according to claim 3, characterized in that: In the case that there is no timeout queue in the target IO request queue, dispatching the IO request according to the order parameter of the IO request in the target IO request queue includes: Get IO request information in the priority dispatch queue; When the queue information of the priority dispatch queue indicates that there is an IO request to be dispatched in the queue, dispatching the IO request to be dispatched; The IO requests are dispatched according to the order parameters of the IO requests in the target IO request queue.
6. A device for processing IO requests, characterized in that: The device comprises: An acquisition unit, used to obtain the priority parameter of the process corresponding to the IO request; An execution unit is used to select, according to the priority parameter, IO request queues matching the priority parameter from at least two priority sorting queue groups as target IO request queues; according to the sorting mode of different IO request queues in the target IO request queue, the IO request is allocated to the target IO request queue corresponding to the priority parameter; the target IO request queue includes at least two IO request queues, each of the at least two IO request queues has a different queue dispatching mode, each of the at least two IO request queues corresponds to a priority sorting queue group, each priority sorting queue group includes a plurality of IO request queues with different priorities, and the priority parameter of the IO request corresponds to the priority of the IO request queue; the dispatching modes of the at least two IO request queues include at least first-in-first-out dispatching and dispatching based on priority and same type merging; The execution unit is further configured to dispatch the IO request according to an order parameter of the IO request in the target IO request queue.
7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
9. A computer program product, comprising instructions, characterized in that: When the instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Assigning and scheduling threads for multiple prioritized queues
CN105474175A
Service resource allocation method and device, electronic equipment and storage medium
CN115454616A
Short duration serialization express queue
US20180341459A1