Resource Scheduling Method, Apparatus, Electronic Device, and Storage Medium
By introducing the calculation of event value factors and total requested resources into the resource scheduling method, combined with the update mechanism of random difference results, the resource allocation priority is dynamically adjusted, and the problem of insufficient resource scheduling accuracy caused by static priority in the priorities in the existing technology is solved, and more efficient and flexible resource allocation is achieved.
Patent Information
- Application Number
- CN202111608662.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2041-12-24
AI Technical Summary
In the prior art, the priority set in the resource scheduling method is a static fixed value, which is difficult to match the dynamic resource scheduling scenario, resulting in poor accuracy of the resource scheduling scheme.
By calculating the resource normalized request value of the business request based on the event value factor and the total amount of requested resources, and updating the resource allocation priority using the random difference results to dynamically adjust resource allocation.
The accuracy and dynamic adaptability of the resource scheduling scheme are improved, so that the priority of resource allocation is better matched with the changes in actual scenarios.
Smart Images

Figure CN114675947B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of resource scheduling, and in particular, to a resource scheduling method, apparatus, electronic device, and computer-readable storage medium. Background Art
[0002] In various hardware systems and software systems, the scheduler is a widely existing concept. Basically, it allocates resources for excessive requests in the case of limited resources (resource allocation includes allocation in the physical distribution of resources and allocation in the time distribution). During the allocation process, priority is a common concept, that is, for different requests, a certain priority attribute is first assigned to the requests, and then resources can be allocated according to the priority level during specific allocation. In the existing scheduling methods, fixed priorities are set based on requirements or user experience, and then based on the fixed priorities, resource scheduling schemes for different requests are determined. However, when using the existing scheduling methods, the accuracy of obtaining the resource scheduling scheme is relatively poor. Summary of the Invention
[0003] An embodiment of the present invention provides a resource scheduling method. By obtaining the resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources; obtaining the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request; the obtained random difference result is also a dynamic value, enabling the random difference result to better fit the actual scenario and making the obtained resource scheduling scheme more accurate.
[0004] In a first aspect, an embodiment of the present invention provides a resource scheduling method, the method comprising:
[0005] When receiving multiple service requests in the current round, obtain the request item information carried in each service request, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request;
[0006] For each service request in the current round, determine the selected execution result corresponding to the service request, where the selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed;
[0007] Based on the event value factor and the total amount of requested resources, obtain the resource-normalized request value corresponding to the service request;
[0008] Based on the resource-normalized request value corresponding to the service request, obtain the random difference result corresponding to the service request;
[0009] Update and adjust the resource allocation priority of the service request in the next round using the random difference result corresponding to the service request.
[0010] Optionally, the step of determining the selected execution results corresponding to the multiple service requests includes:
[0011] Execute the multiple service requests to obtain multiple execution results, with one service request corresponding to one execution result;
[0012] Determine a preset time window, and / or determine the execution times of the multiple execution results, with one execution result corresponding to one execution time;
[0013] Filter the multiple execution results using the preset time window, and / or the multiple execution times to obtain the selected execution results.
[0014] Optionally, each selected execution result corresponds to multiple event value factors; the step of obtaining the resource-normalized request value corresponding to the service request based on the event value factors and the total amount of requested resources includes:
[0015] Calculate the sum of the value factors corresponding to each selected service request using the multiple event value factors of the selected execution result corresponding to each selected service request;
[0016] Obtain the resource-normalized request value based on the sum of the value factors corresponding to each selected service request and the total amount of requested resources for each selected service request. The resource-normalized request value has a positive correlation with the sum of the value factors and a negative correlation with the total amount of requested resources.
[0017] Optionally, the step of obtaining the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request includes:
[0018] Perform a sorting operation on the service request according to the resource-normalized request value corresponding to the service request to obtain the current sorting result;
[0019] Obtain the historical sorting result, which is generated by performing a sorting operation on the service request based on the resource-normalized request value of the service request at a historical moment;
[0020] Obtain a difference result based on the current sorting result and the historical sorting result;
[0021] Obtain a random difference result based on the difference result and a target random factor.
[0022] Optionally, before the step of obtaining a random difference result based on the difference result and the target random factor, the method further includes:
[0023] Determine the execution status of the service request in the current period, where the execution status includes executed in the current period or not executed in the current period;
[0024] If the current execution status is that the service request has been executed in the current period, determine the first preset random factor as the target random factor, or, if the current execution status is that the service request has not been executed in the current period, determine the second preset random factor as the target random factor.
[0025] Optionally, each of the selected service requests corresponds to a difference result; the step of obtaining a random difference result based on the difference result and the target random factor includes:
[0026] Use a preset random function to determine a random coefficient;
[0027] Based on the random coefficient, the target random factor, and the difference result of each selected service request, obtain the random difference result of each selected service request.
[0028] Optionally, each of the resource allocation priorities includes an initial priority information and an initial priority interval; before the step of adjusting the priorities of multiple service requests using the random difference result, the method further includes:
[0029] Use the random difference result of each selected service request and the initial priority interval of each selected service request to calculate the result priority interval of each selected service request;
[0030] Based on the result priority interval of each selected service request, obtain the result priority information of each selected service request;
[0031] Based on the result priority information of each selected service request and the initial priority information of each selected service request, obtain a priority difference;
[0032] The step of adjusting the priorities of multiple service requests using the random difference result includes:
[0033] Use the result priority information of each selected service request and the result priority interval of each selected service request to adjust the priorities of multiple service requests.
[0034] In a second aspect, an embodiment of the present invention provides a resource scheduling device, where the device includes:
[0035] A receiving module, configured to obtain the request item information carried in each of the multiple service requests in the current round when receiving the multiple service requests, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request;
[0036] A determining module, configured to determine, for each service request in the current round, a selected execution result corresponding to the service request, where the selected execution result includes an event value factor corresponding to an execution event generated when the service request is executed;
[0037] A value obtaining module, configured to obtain a resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources;
[0038] A difference obtaining module, configured to obtain a random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request;
[0039] An adjustment module, configured to update and adjust the resource allocation priority of the service request in the next round by using the random difference result corresponding to the service request.
[0040] In a third aspect, an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the steps in the resource scheduling method provided by the embodiment of the present invention are implemented.
[0041] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the resource scheduling method provided by the embodiment of the invention are implemented.
[0042] In the embodiment of the present invention, when receiving multiple service requests in the current round, the request item information carried in each service request is obtained, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request; for each service request in the current round, a selected execution result corresponding to the service request is determined, where the selected execution result includes an event value factor corresponding to an execution event generated when the service request is executed; a resource-normalized request value corresponding to the service request is obtained based on the event value factor and the total amount of requested resources; a random difference result corresponding to the service request is obtained based on the resource-normalized request value corresponding to the service request; and the resource allocation priority of the service request in the next round is updated and adjusted by using the random difference result corresponding to the service request.
[0043] In the existing methods, the set priority is a static fixed value. During the process of resource scheduling, this value usually remains unchanged. However, the resource scheduling itself is variable. Using a fixed priority makes it difficult for resource scheduling to fit the actual scenario, resulting in a poor accuracy of the obtained resource scheduling scheme. By using the method of the present application, based on the event value factor and the total amount of requested resources, a final random difference result is obtained, and the random difference result is used to adjust the priority of resource allocation. The obtained random difference result is also a dynamic value, which enables the priority of resource allocation adjusted by the random difference result to better fit the changes in the actual scenario, resulting in a higher accuracy and dynamic adaptability of the obtained resource scheduling scheme. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0045] Figure 1 is a flowchart of a resource scheduling method provided by an embodiment of the present invention;
[0046] Figure 2 is a schematic structural diagram of a request Hash set of the present invention;
[0047] Figure 3 is a schematic structural diagram of the resource allocation priority of a service request of the present invention;
[0048] Figure 4 is a schematic structural diagram of an execution result corresponding to a service request of the present invention;
[0049] Figure 5 is a schematic structural diagram of a resource scheduling device provided by an embodiment of the present invention;
[0050] Figure 6 is a schematic structural diagram of a determination module provided by an embodiment of the present invention;
[0051] Figure 7 is a schematic structural diagram of a value acquisition module provided by an embodiment of the present invention;
[0052] Figure 8 is a schematic structural diagram of a difference acquisition module provided by an embodiment of the present invention;
[0053] Figure 9 is a schematic structural diagram of another resource scheduling device provided by an embodiment of the present invention;
[0054] Figure 10 It is a schematic structural diagram of another resource scheduling device provided by an embodiment of the present invention;
[0055] Figure 11 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Specific embodiments
[0056] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.
[0057] Please refer to Figure 1 , Figure 1 which is a flowchart of a resource scheduling method provided by an embodiment of the present invention. As Figure 1 shown, the resource scheduling method includes the following steps:
[0058] 101. When receiving multiple service requests in the current round, obtain the request item information carried in each service request. The request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request.
[0059] In the present invention, the execution entity is an electronic device. The electronic device is installed with a resource scheduling program. When the electronic device executes the resource scheduling program, the steps of the resource scheduling method of the present invention are realized.
[0060] The user sets an initial service request based on the demand, then determines multiple service requests from the initial service request based on the demand, and then the electronic device receives the multiple service requests determined by the user. Then, the electronic device executes the multiple service requests to obtain a selected execution result.
[0061] In the present invention, the service request may be a request corresponding to task scheduling or resource scheduling. The service request is a HaspMap data structure - a request Hash set. Each storage in the request Hash set contains a service request, that is, multiple service requests are stored in the form of a request Hash set.
[0062] Refer to Figure 2 , Figure 2This is a schematic structural diagram of the request Hash set of the present invention; the request Hash set includes multiple service requests (Request(n) represents the nth service request), and each service request in the request Hash set includes the resource allocation priority of the request (including the initial priority information and the initial priority interval. The initial priority information refers to the level information, and the initial priority interval is the interval description information corresponding to the initial priority information. For example, if the initial priority information is for employees at level 3, the corresponding initial priority interval is a salary range of 3,500 yuan to 4,000 yuan) and the total amount of requested resources. Among them, one initial priority information corresponds to one initial priority interval.
[0063] Referring to Figure 3 , Figure 3 This is a schematic structural diagram of the resource allocation priority of the service request of the present invention; different resource allocation priorities form a two-way chained structure for two-way backtracking during adjustment. Referring to Figure 3 , each resource allocation priority has initial priority information (RankValue), and the larger the priority value, the higher the priority; each resource allocation priority also includes an initial priority interval (constituted by RankQuantum(min) and RankQuantum(max)) for cumulative adjustment during priority adjustment.
[0064] It can be understood that in the present invention, when a service request needs to be adjusted (the obtained random difference result is not 0), after the service request is adjusted, the adjusted service request still needs to be executed, and then according to the method of the present invention, it is continued to determine whether the service request needs to be adjusted until the service request does not need to be adjusted (the obtained random difference result is 0 or the random difference result is small). Therefore, the service requests are executed in rounds and cycles until the service requests do not need to be adjusted and then end.
[0065] 102: For each service request in the current round, determine the selected execution result corresponding to the service request. The selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed.
[0066] Among them, 102 specifically includes: executing multiple service requests to obtain multiple execution results, one service request corresponding to one execution result; determining a preset time window, and / or determining the execution times of multiple execution results, one execution result corresponding to one execution time; using the preset time window, and / or multiple execution times to filter multiple execution results to obtain the selected execution result.
[0067] It should be noted that multiple service requests are executed according to the resource allocation priority of the requests to obtain execution results, and then a time window is set (in actual operation, the scheduling period or several consecutive scheduling periods, or other durations defined by the user can be used to determine the time window), and the set time window is the preset time window. Then, using the preset time window as a filtering condition, all the execution results corresponding to all the multiple service requests included in the request Hash set are filtered to obtain a filtered result set, and the filtered execution results are the selected execution results. In addition, the service request corresponding to the selected execution result is the selected service request below. Since one execution result corresponds to one service request, one selected execution result also corresponds to one selected service request.
[0068] In addition, the filtering condition can also be the execution time. For example, service requests with execution time within a certain time period are filtered, and those not within the certain time period do not need to be filtered.
[0069] Refer to Figure 4 , Figure 4 is a schematic structural diagram of the execution result corresponding to the service request of the present invention; the execution result is also stored in the form of a Hash set.
[0070] When a service request is executed, a series of events (Events, also called sub-events in the present invention) will be generated. The organizational feature of the sub-events is organized by the service request as the granularity. The sub-events generated by the same service request are archived under the storage instance of the same request and the following most critical dimensions are saved. In other words, one execution result corresponding to one service request corresponds to multiple sub-events, and each sub-event corresponds to an event value factor and an event time.
[0071] There are multiple event value factors of multiple sub-events in the data structure of one execution result, and the event value factors of the selected execution result can be directly obtained; the selected execution result corresponds to the selected service request, and the requested resource total amount and resource allocation priority of the selected service request can be directly obtained from the total amount of requested resources and resource allocation priorities involved in all service requests.
[0072] 103. Obtain the resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources.
[0073] Specifically, referring to the above description, each selected execution result corresponds to multiple value factors; step 103 includes: using the multiple event value factors of the selected execution result corresponding to each selected service request, calculating the sum of the value factors corresponding to each selected service request; based on the sum of the value factors corresponding to each selected service request and the total amount of requested resources for each selected service request, obtaining a resource-normalized request value, where the resource-normalized request value has a positive correlation with the sum of the value factors and a negative correlation with the total amount of requested resources. Specifically, the step of obtaining a resource-normalized request value based on the sum of the value factors corresponding to each selected service request and the total amount of requested resources for each selected service request includes: determining the ratio of the sum of the event value factors corresponding to each selected service request to the total amount of requested resources for each selected service request as the resource-normalized request value for each selected service request. Traverse all the selected service requests to obtain all the resource-normalized request values.
[0074] It can be understood that a selected execution result corresponds to multiple sub-events, each sub-event includes an event value factor, and at the same time, a selected execution result corresponds to a selected service request. Then, for the selected execution result corresponding to a selected service request r, sum up the event value factors of all the sub-events involved in the selected execution result to obtain the sum of the value factors, and use this sum of the value factors as the sum of the value factors corresponding to the service request r. Then, determine the ratio of the sum of the value factors of the service request r to the total amount of requested resources as the resource-normalized request value of the service request r. Traverse all the selected service requests to obtain all the resource-normalized request values.
[0075] 104. Obtain the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request.
[0076] Specifically, obtaining the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request includes: performing a sorting operation on the service requests according to the resource-normalized request value corresponding to the service requests to obtain the current sorting result; obtaining the historical sorting result, which is generated by performing a sorting operation on the service requests based on the resource-normalized request value of the service requests at the historical moment; obtaining the difference result based on the current sorting result and the historical sorting result; obtaining the random difference result based on the difference result and the target random factor.
[0077] Wherein, before the step of obtaining a random difference result based on a difference result and a target random factor, the method further includes: determining an execution state of a service request in a current period, where the execution state includes executed in the current period or not executed in the current period; if the current execution state is that the service request has been executed in the current period, determining a first preset random factor as the target random factor, or, if the current execution state is that the service request has not been executed in the current period, determining a second preset random factor as the target random factor
[0078] The target random factor can be divided into two levels: the first level is the random factor RandomFactor(scheduled) of the service request that has been scheduled and executed in this period; the second level is: the random factor RandomFactor(byPassed) of the service request that has not been scheduled and executed in this period. It can be understood that, for the scheduling task involved in the present invention, the multiple service requests involved in step 101 refer to the service requests in one period, that is, the scheduling method is periodic. At the same time, for service requests in different rounds, the determined random factors are different. Each time the steps of the present invention are performed, the corresponding random factor needs to be determined. In other words, the target random factor refers to the random factor of the current round.
[0079] It should be noted that, referring to the above description, the resource normalization request value includes the total resource normalization request values of multiple selected service requests. Sorting the total resource normalization request values to obtain a current sorting result (denoted as RealTimeRank), and the current sorting result includes the sorting result corresponding to each selected service request; for example, the current sorting result corresponding to the service request r is denoted as RealTimeRank(r).
[0080] It can be understood that the resource normalization request value at a historical moment may refer to the resource normalization request value generated during the process of obtaining the previous random difference result according to the method of the present invention. The current sorting result of this resource normalization request value at the historical moment is the historical sorting result (denoted as HistoryRank), and the historical sorting result includes the sorting result corresponding to each selected service request. For example, the historical sorting result corresponding to the service request r is denoted as HistoryRank(r).
[0081] Then, for each selected service request, the corresponding differential result is the difference between the historical sorting result and the current sorting result (denoted as DifferenceRank). For example, for service request r, the corresponding differential result is: DifferenceRank(r) = HistoryRank(r) - RealTimeRank(r). Traverse all the selected service requests to obtain all the differential results, and then continue to obtain the random differential results based on all the obtained differential results and the target random factor.
[0082] Furthermore, each selected service request corresponds to a differential result; the step of obtaining the random differential result based on the differential result and the target random factor includes: determining the random coefficient using a preset random function; obtaining the random differential result of each selected service request based on the random coefficient, the target random factor, and the differential result of each selected service request.
[0083] It should be noted that the preset random function can be a user-defined random function (denoted as Radom()), which is used to generate a random number between 0 and 1. Among them, the distribution of the random numbers in the random function can be selected according to actual needs, such as full random distribution, normal random distribution, etc. The random number generated by the random function is denoted as the random coefficient.
[0084] Among them, the specific process of obtaining the random differential result of each selected service request based on the random coefficient, the target random factor, and the differential result of each selected service request is expressed as follows:
[0085] RandomedRankFactor(r) = DifferenceRank(r) * Radom() * RandomFactor(scheduled), or
[0086] RandomedRankFactor(r) = DifferenceRank(r) * Radom() * RandomFactor(byPassed);
[0087] Among them, RandomedRankFactor(r) is the random difference result of a selected service request r, Radom() is the random coefficient, DifferenceRank(r) is the difference result of the selected service request r, RandomFactor(scheduled) is the first level of the target random factor, which is the random factor of the service requests that have been scheduled and executed within this period, and RandomFactor(byPassed) is the second level of the target random factor, which is the random factor of the service requests that have not been scheduled and executed within this period. It can be understood that the calculation method of the random difference result adopted is different according to the different execution states of the service requests.
[0088] 105. Update and adjust the resource allocation priority of the service request in the next round by using the random difference result corresponding to the service request.
[0089] After obtaining the random difference result, the random difference result involves the initial priority interval and initial priority information of all selected service requests corresponding to the selected execution results, and then the random difference result is used to adjust the priorities of multiple service requests.
[0090] Referring to the above description, after the priority of the service request is adjusted, it is also necessary to perform the next cycle of the service request to determine whether the priority needs to be adjusted again. The adjustment scheme for the next round is similar to the above scheme of the present invention. Until the random difference result of the service request in a certain round is 0, it indicates that the service request does not need to be adjusted again, and then it stops.
[0091] Furthermore, each resource allocation priority includes initial priority information and an initial priority interval; before the step of adjusting the priorities of multiple service requests by using the random difference result, the method further includes: calculating the result priority interval of each selected service request by using the random difference result of each selected service request and the initial priority interval of each selected service request; obtaining the result priority information of each selected service request based on the result priority interval of each selected service request; obtaining the priority difference based on the result priority information of each selected service request and the initial priority information of each selected service request; correspondingly, the step of adjusting the priorities of multiple service requests by using the random difference result includes: adjusting the priorities of multiple service requests by using the result priority information of each selected service request and the result priority interval of each selected service request.
[0092] At this time, after obtaining the random difference result, calculate the result priority interval by using the random difference result and the initial priority interval. Specifically:
[0093] AdjusRequestQuantum(r) = RequstQuantum(r) - RandomedRankFactor(r)
[0094] Among them, when RequstQuantum(r) is the maximum value of the initial priority interval corresponding to the selected service request r, AdjusRequestQuantum(r) is the maximum value of the result priority interval corresponding to the selected service request r; when RequstQuantum(r) is the minimum value of the initial priority interval corresponding to the selected service request r, AdjusRequestQuantum(r) is the minimum value of the result priority interval corresponding to the selected service request r.
[0095] Based on the configuration relationship between the priority information and the priority interval, the result priority information corresponding to the result priority interval of the selected service request is obtained (denoted as AdjustRankValue). Then, the difference between the result priority information and the initial priority information corresponding to a selected service request is determined as the priority difference (denoted as DifferenceRankValue), that is:
[0096] DifferenceRankValue(r) = AdjustRankValue(r) - RankValue(r)
[0097] Among them, DifferenceRankValue(r) is the priority difference of the selected service request r, AdjustRankValue(r) is the result priority information of the selected service request r, and RankValue(r) is the initial priority information of the selected service request r.
[0098] Then, after obtaining the priority difference and the random difference result, the random difference result is saved back, the initial priority interval in the initial priority information of the selected service request among multiple service requests is updated, and then, according to the priority difference, the initial priority information of the selected service request is adjusted: if the priority differences are not all 0, a priority scheduling is performed to change the current execution result and affect the generation of subsequent events.
[0099] In a specific embodiment, a service request may refer to any form of request executed by a computer. For example, when image processing is performed using a computer device, the service request is an image processing request, such as tagging, classification, and cropping. At this time, the total amount of requested resources may refer to the CPU consumption, memory consumption, and hard disk consumption of the computer device for executing the service request. The initial priority information may refer to the priorities corresponding to various image processing processes. For example, the initial priority information corresponding to image cropping is level 2, and the initial priority information corresponding to image tagging is level 4, etc. The initial priority range is a description range corresponding to multiple different initial priority information. For example, the initial priority corresponding to image cropping is level 2, and the priority range score is 34 - 45.
[0100] At this time, the event value factor may be related to the consumption time of the service request. For example, the consumption time of image cropping is relatively long, and at this time its event value factor is relatively low. The consumption time corresponding to image tagging is relatively short, so the corresponding event value factor is relatively high.
[0101] In an embodiment of the present invention, when receiving multiple service requests in the current round, obtain the request item information carried in each service request. The request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request; for each service request in the current round, determine the selected execution result corresponding to the service request. The selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed; based on the event value factor and the total amount of requested resources, obtain the resource - normalized request value corresponding to the service request; based on the resource - normalized request value corresponding to the service request, obtain the random difference result corresponding to the service request; use the random difference result corresponding to the service request to update and adjust the resource allocation priority of the service request in the next round.
[0102] In the existing method, the set priority is a static fixed value. During the process of resource scheduling, this value is usually unchanged. However, the resource scheduling itself is variable. Using a fixed priority makes it difficult for resource scheduling to fit the actual scenario, resulting in a relatively poor accuracy of the obtained resource scheduling scheme. By using the method of the present application, based on the event value factor and the total amount of requested resources, obtain the final random difference result to use the random difference result to adjust the resource allocation priority. The obtained random difference result is also a dynamic value, making the resource allocation priority adjusted using the random difference result better fit the changes in the actual scenario, resulting in a relatively high accuracy and dynamic adaptability of the obtained resource scheduling scheme.
[0103] The global value gain is the goal of scheduling optimization, and the optimal scheduling of the global gain can be achieved. The priority level is also one of the goals of scheduling optimization. By optimizing the setting of the priority level, the optimization of the overall value gain is ultimately achieved. The two are mutually causal. Through the technical solution design of this patent, the problem of maximizing value in the scenario of complex dynamic resource input and revenue change is realized.
[0104] It should be noted that the resource scheduling method provided by the embodiments of the present invention can be applied to devices such as smart phones, computers, and servers that can perform data queries.
[0105] Optionally, please refer to Figure 5 , Figure 5 is a schematic structural diagram of a resource scheduling device provided by an embodiment of the present invention. As Figure 5 shown, the device includes:
[0106] A receiving module 301, configured to obtain the request item information carried in each of the service requests when receiving multiple service requests in the current round. The request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request.
[0107] A determining module 302, configured to determine a selected execution result corresponding to each service request in the current round. The selected execution result includes an event value factor corresponding to an execution event generated when the service request is executed.
[0108] A value obtaining module 303, configured to obtain a resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources.
[0109] A difference obtaining module 304, configured to obtain a random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request.
[0110] An adjustment module 305, configured to use the random difference result corresponding to the service request to update and adjust the resource allocation priority of the service request in the next round.
[0111] Optionally, as Figure 6 shown, the determining module 302 includes:
[0112] An execution unit 3021, configured to execute multiple service requests to obtain multiple execution results, and one service request corresponds to one execution result.
[0113] A first determining unit 3022, configured to determine a preset time window and / or determine the execution times of multiple execution results. One execution result corresponds to one execution time.
[0114] A filtering unit 3023, configured to filter multiple execution results by using the preset time window and / or multiple execution times, so as to obtain the selected execution results.
[0115] Optionally, as Figure 7 shown, the value obtaining module 303 includes:
[0116] A calculation unit 3031, configured to calculate the sum of value factors corresponding to each selected service request by using multiple event value factors of the selected execution results corresponding to each selected service request;
[0117] A value obtaining unit 3032, configured to obtain the resource-normalized request value based on the sum of value factors corresponding to each selected service request and the total amount of requested resources of each selected service request, where the resource-normalized request value has a positive correlation with the sum of value factors, and the resource-normalized request value has a negative correlation with the total amount of requested resources.
[0118] Optionally, as Figure 8 shown, the difference obtaining module 304 includes:
[0119] A sorting unit 3041, configured to perform a sorting operation on the service requests according to the resource-normalized request value corresponding to the service requests, so as to obtain a current sorting result;
[0120] A historical obtaining unit 3042, configured to obtain a historical sorting result, where the historical sorting result is generated by performing a sorting operation on the service requests according to the resource-normalized request value of the service requests at a historical moment;
[0121] A difference obtaining unit 3043, configured to obtain a difference result based on the current sorting result and the historical sorting result;
[0122] A random difference obtaining unit 3044, configured to obtain a random difference result based on the difference result and a target random factor.
[0123] Optionally, as Figure 9 shown, the device further includes:
[0124] A status determination module 306 is configured to determine an execution status of the service request in the current cycle. The execution status includes having been executed in the current cycle or not having been executed in the current cycle. If the current execution status is that the service request has been executed in the current cycle, the first preset random factor is determined as the target random factor. Or, if the current execution status is that the service request has not been executed in the current cycle, the second preset random factor is determined as the target random factor.
[0125] Optionally, the random difference obtaining unit 3044 is further configured to determine a random coefficient by using a preset random function; and obtain a random difference result of each selected service request based on the random coefficient, the target random factor, and a difference result of each selected service request.
[0126] Optionally, as Figure 10 shown, the apparatus further includes:
[0127] A calculation module 307 is configured to calculate a result priority interval of each selected service request by using the random difference result of each selected service request and an initial priority interval of each selected service request; obtain result priority information of each selected service request based on the result priority interval of each selected service request; and obtain a priority difference based on the result priority information of each selected service request and the initial priority information of each selected service request.
[0128] Correspondingly, the adjustment module 305 is configured to perform priority adjustment on multiple service requests by using the result priority information of each selected service request and the result priority interval of each selected service request.
[0129] It should be noted that the resource scheduling apparatus provided in the embodiments of the present invention can be applied to devices such as smart phones, computers, and servers that can perform service analysis at the graph level.
[0130] The resource scheduling apparatus provided in the embodiments of the present invention can implement each process implemented by the resource scheduling method in the above method embodiments, and can achieve the same beneficial effects. To avoid repetition, it will not be elaborated here.
[0131] See Figure 11 , Figure 11 is a schematic structural diagram of an electronic device provided in the embodiments of the present invention. As Figure 11 shown, it includes: a memory 1002, a processor 1001, and a computer program of the resource scheduling method stored on the memory 1002 and executable on the processor 1001, where:
[0132] The processor 1001 is used to call the computer program stored in the memory 1002 and execute the following steps:
[0133] When receiving multiple service requests in the current round, obtain the request item information carried in each service request, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request;
[0134] For each service request in the current round, determine the selected execution result corresponding to the service request, where the selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed;
[0135] Based on the event value factor and the total amount of requested resources, obtain the resource-normalized request value corresponding to the service request;
[0136] Based on the resource-normalized request value corresponding to the service request, obtain the random difference result corresponding to the service request;
[0137] Use the random difference result corresponding to the service request to update and adjust the resource allocation priority of the service request in the next round.
[0138] Optionally, the first relational graph structure includes event nodes, personnel nodes, and relational edges, and the nodes are connected by relational edges. The steps for the processor 1001 to execute to determine the selected execution results corresponding to multiple service requests include:
[0139] Execute multiple service requests to obtain multiple execution results, where one service request corresponds to one execution result;
[0140] Determine a preset time window, and / or determine the execution times of multiple execution results, where one execution result corresponds to one execution time;
[0141] Use the preset time window, and / or multiple execution times to filter multiple execution results to obtain the selected execution results.
[0142] Optionally, each selected execution result corresponds to multiple event value factors; the steps for the processor 1001 to execute to obtain the resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources include:
[0143] Use the multiple event value factors of the selected execution result corresponding to each selected service request to calculate the sum of the value factors corresponding to each selected service request;
[0144] Based on the sum of the value factors corresponding to each of the selected service requests and the total amount of requested resources for each of the selected service requests, obtain the resource-normalized request value, where the resource-normalized request value has a positive correlation with the sum of the value factors and a negative correlation with the total amount of requested resources.
[0145] Optionally, the step in which the processor 1001 obtains the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request includes:
[0146] Perform a sorting operation on the service request according to the resource-normalized request value corresponding to the service request to obtain the current sorting result;
[0147] Obtain a historical sorting result, where the historical sorting result is generated by performing a sorting operation on the service request based on the resource-normalized request value of the service request at a historical moment;
[0148] Obtain a difference result based on the current sorting result and the historical sorting result;
[0149] Obtain a random difference result based on the difference result and a target random factor.
[0150] Optionally, before the step in which the processor 1001 obtains the random difference result based on the difference result and the target random factor, the method further includes:
[0151] Determine the execution status of the service request in the current cycle, where the execution status includes executed in the current cycle or not executed in the current cycle;
[0152] If the current execution status is that the service request has been executed in the current cycle, determine the first preset random factor as the target random factor, or, if the current execution status is that the service request has not been executed in the current cycle, determine the second preset random factor as the target random factor.
[0153] Optionally, each of the selected service requests corresponds to a difference result and a target priority interval. The step in which the processor 1001 obtains the random difference result based on the difference result and the target random factor includes:
[0154] Use a preset random function to determine a random coefficient;
[0155] Obtain the random difference result of each of the selected service requests based on the random coefficient, the target random factor, and the difference result of each of the selected service requests.
[0156] Optionally, each of the resource allocation priorities includes excellent initial priority information and an initial priority range; before the processor 1001 performs priority adjustment on multiple service requests by using the random difference result, the method further includes:
[0157] Using the random difference result of each selected service request and the initial priority range of each selected service request, calculate the result priority range of each selected service request;
[0158] Based on the result priority range of each selected service request, obtain the result priority information of each selected service request;
[0159] Based on the result priority information of each selected service request and the initial priority information of each selected service request, obtain a priority difference;
[0160] Correspondingly, the step in which the processor 1001 performs priority adjustment on multiple service requests by using the random difference result includes:
[0161] Using the result priority information of each selected service request and the result priority range of each selected service request, perform priority adjustment on multiple service requests.
[0162] It should be noted that the electronic device provided in the embodiments of the present invention can be applied to devices such as smartphones, computers, and servers that can perform resource scheduling.
[0163] The electronic device provided in the embodiments of the present invention can implement each process implemented by the resource scheduling method in the above method embodiments, and can achieve the same beneficial effects. To avoid repetition, it will not be elaborated here.
[0164] The embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements each process of the resource scheduling method or the application-side resource scheduling method provided in the embodiments of the present invention, and can achieve the same technical effects. To avoid repetition, it will not be elaborated here.
[0165] Those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM), etc.
[0166] The above-disclosed are only the preferred embodiments of the present invention. Of course, the scope of the rights of the present invention cannot be limited thereby. Therefore, equivalent changes made according to the claims of the present invention still fall within the scope covered by the present invention.
Claims
1. A resource scheduling method, characterized in that, it includes the following steps: When receiving multiple service requests in the current round, obtain the request item information carried in each service request, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request; For each service request in the current round, determine the selected execution result corresponding to the service request, where the selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed; Based on the event value factor and the total amount of requested resources, obtain the resource-normalized request value corresponding to the service request; Based on the resource-normalized request value corresponding to the service request, obtain the random difference result corresponding to the service request; Use the random difference result corresponding to the service request to update and adjust the resource allocation priority of the service request in the next round.
2. The method according to claim 1, characterized in that, The step of determining the selected execution results corresponding to multiple service requests includes: Execute multiple service requests to obtain multiple execution results, one service request corresponding to one execution result; Determine a preset time window, and / or determine the execution times of multiple execution results, one execution result corresponding to one execution time; Use the preset time window, and / or multiple execution times to filter multiple execution results to obtain the selected execution results.
3. The method according to claim 1, characterized in that, Each selected execution result corresponds to multiple event value factors; the step of obtaining the resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources includes: Use the multiple event value factors of the selected execution result corresponding to each selected service request to calculate the sum of the value factors corresponding to each selected service request; Based on the sum of the value factors corresponding to each selected service request and the total amount of requested resources of each selected service request, obtain the resource-normalized request value, where the resource-normalized request value is positively correlated with the sum of the value factors, and the resource-normalized request value is negatively correlated with the total amount of requested resources.
4. The method according to claim 1, characterized in that, The step of obtaining the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request includes: Perform a sorting operation on the service request according to the resource-normalized request value corresponding to the service request to obtain the current sorting result; Obtain the historical sorting result, where the historical sorting result is generated by performing a sorting operation on the service request based on the resource-normalized request value of the service request at a historical moment; Based on the current sorting result and the historical sorting result, obtain the difference result; Based on the difference result and the target random factor, obtain the random difference result.
5. The method according to claim 4, characterized in that, Before the step of obtaining a random difference result based on the difference result and the target random factor, the method further includes: Determine the execution status of the service request in the current period, where the execution status includes executed in the current period or not executed in the current period; If the current execution status is that the service request has been executed in the current period, determine the first preset random factor as the target random factor, or, if the current execution status is that the service request has not been executed in the current period, determine the second preset random factor as the target random factor.
6. The method according to claim 5, wherein, Each selected service request corresponds to a difference result; the step of obtaining a random difference result based on the difference result and the target random factor includes: Determine a random coefficient using a preset random function; Based on the random coefficient, the target random factor, and the difference result of each selected service request, obtain the random difference result of each selected service request.
7. The method according to claim 6, wherein, Each resource allocation priority includes excellent initial priority information and an initial priority interval; before the step of adjusting the priorities of multiple service requests using the random difference result, the method further includes: Calculate the result priority interval of each selected service request using the random difference result of each selected service request and the initial priority interval of each selected service request; Obtain the result priority information of each selected service request based on the result priority interval of each selected service request; Obtain a priority difference based on the result priority information of each selected service request and the initial priority information of each selected service request; The step of adjusting the priorities of multiple service requests using the random difference result includes: Adjust the priorities of multiple service requests using the result priority information of each selected service request and the result priority interval of each selected service request.
8. A resource scheduling device, wherein, The device includes: A receiving module, configured to obtain the request item information carried in each service request when receiving multiple service requests in the current round, where the request item information includes the resource allocation priority of the service request and the total amount of requested resources of the service request; A determination module, configured to determine the selected execution result corresponding to each service request in the current round, where the selected execution result includes the event value factor corresponding to the execution event generated when the service request is executed; A value obtaining module, configured to obtain the resource-normalized request value corresponding to the service request based on the event value factor and the total amount of requested resources; A difference obtaining module, configured to obtain the random difference result corresponding to the service request based on the resource-normalized request value corresponding to the service request; An adjustment module, configured to update and adjust the resource allocation priority of the service request in the next round using the random difference result corresponding to the service request.
9. An electronic device, It is characterized in that including: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the resource scheduling method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium It is characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the resource scheduling method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Dynamic weighted round robin scheduling policy method based on priorities
CN107733689A
Information processing system, method and medium
US20160139959A1