A task dynamic scheduling method, task issuing method and device thereof
Through dynamic scheduling methods and task issuance methods, based on resource quota configuration and priority queue information, the problem of inflexible resource allocation in the existing technology is solved, realizing instant refresh of tasks and efficient utilization of resources.
Patent Information
- Application Number
- CN202111578475.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2041-12-22
AI Technical Summary
When existing scheduling technologies deal with a large number of refresh tasks, resource allocation is inflexible, resulting in high-priority tasks postponing low-priority tasks and unable to achieve instant refresh.
By obtaining refresh task information, resource quota configuration information and current priority queue information, calculate the number of idle tasks, and configure the priority queues for different refresh tasks according to resource quotas, ensure that high-priority tasks do not affect other customer tasks, and set each priority level The maximum number of dispatches for the queue to ensure that all tasks are dispatched.
It realizes flexible allocation of resources, avoids the situation where high-priority tasks postpone low-priority tasks, and ensures instant refresh of tasks and efficient utilization of resources.
Smart Images

Figure CN114443241B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet technology, and in particular to a task dynamic scheduling method, a task issuing method and a device thereof. Background Art
[0002] As the number of CDN customers increases, each node needs to handle hundreds of millions of refresh tasks every day, with a limited number of refresh tasks. In this case, it is necessary to decide which tasks to prioritize and which tasks can be delayed. In the current situation, scheduling is an effective means to solve the problem of multiple businesses competing for shared resources.
[0003] Existing scheduling algorithms can be divided into the following categories according to scheduling rules: based on distinguishing business priority services, based on dynamic two-way priority, proportional differentiation algorithms, and based on discrete particle swarms. Today's queue scheduling algorithms all adjust the groups stored in the queue, calculate the trigger order, and use this as a benchmark for scheduling control. The traditional first-in-first-out task model will cause the tasks submitted by later customers to pile up, and the effect of instant refresh cannot be achieved. Existing scheduling technology generally adopts a single-threaded working method, that is, sorting tasks in the same queue. Although it can solve the problem of network resource allocation to a certain extent, tasks will only be sorted according to preset rules and cannot be adjusted dynamically. In some cases, high-priority tasks may continue to be carried out while low-priority tasks are postponed in large quantities, resulting in inflexible resource allocation. Summary of the invention
[0004] Therefore, the technical problem to be solved by the present invention is to overcome the defect of inflexible resource allocation in the prior art, thereby providing a task dynamic scheduling method, a task issuing method and a device thereof.
[0005] According to the first aspect, the present invention provides a task dynamic scheduling method, including: obtaining externally input refresh task information, resource quota configuration information and current priority queue information; the refresh task information includes at least one refresh task; according to the externally input refresh task information and the resource quota configuration information, obtaining the corresponding priority queue; according to the corresponding priority queue and the resource quota configuration information, calculating the current number of idle tasks; according to the number of idle tasks, inserting a corresponding number of the at least one refresh task into the priority queue to obtain a new priority queue.
[0006] Optionally, obtaining a corresponding priority queue based on the externally input refresh task information and the resource quota configuration information includes: obtaining a corresponding configuration type based on the refresh task information and the resource quota configuration information; obtaining a refresh amount, an initial priority and a preset queue length based on the configuration type; judging whether the current configuration type allows task creation based on the refresh amount; when the configuration type allows task creation, judging a corresponding priority queue based on the initial priority; and when the configuration type prohibits task creation, stopping task scheduling and reporting an error.
[0007] Optionally, the current number of idle tasks is calculated based on the corresponding priority queue and the resource quota configuration information, including: judging whether the number of tasks of the same configuration type in the current priority queue is less than the preset queue length based on the priority queue, the preset queue length and the information of the priority queue; when the number of tasks of the same configuration type in the priority queue is greater than or equal to the preset queue length, lowering the priority and reselecting the priority queue; when the number of tasks of the same configuration type in the priority queue is less than the preset queue length, calculating the current number of idle tasks.
[0008] Optionally, according to the number of idle tasks, a corresponding number of at least one refresh task is inserted into the priority queue to obtain a new priority queue, and the method also includes: determining whether all of the at least one refresh task are inserted into the priority queue; when the at least one refresh task is not all inserted into the priority queue, lowering the priority of the remaining tasks and reselecting the priority queue.
[0009] According to the second aspect, the present invention provides a task issuing method, including: obtaining the issuing number of the current priority queue and the remaining issuing number of the previous priority queue; obtaining the number of tasks of each priority queue according to the priority queue obtained by the task dynamic scheduling method described in the first aspect and any optional implementation method of the first aspect; calculating the maximum issuing number according to the issuing number of the current priority queue and the remaining issuing number of the previous priority queue; judging whether the number of tasks in the current priority queue is greater than the maximum issuing number; when the number of tasks in the current priority queue is greater than the maximum issuing number, extracting the corresponding number of tasks in the current priority queue according to the maximum issuing number; when the number of tasks in the current priority queue is less than or equal to the maximum issuing number, extracting all tasks in the current priority queue, and calculating the difference between the number of tasks in the current priority queue and the maximum issuing number as the remaining issuing number of the current priority queue; repeating the above steps until the tasks of all priority queues are extracted; and completing task issuing according to all extracted tasks.
[0010] Optionally, after calculating the maximum number of dispatches, the method further includes: determining whether the current priority queue is the lowest priority queue; and when the current priority queue is the lowest priority queue, extracting a corresponding number of tasks in the current priority queue according to the maximum number of dispatches.
[0011] According to the third aspect, the present invention provides a task dynamic scheduling device, including: an information acquisition module, used to obtain externally input refresh task information, resource quota configuration information and current priority queue information; the refresh task information includes at least one refresh task; a queue acquisition module, used to obtain the corresponding priority queue according to the externally input refresh task information and the resource quota configuration information; an idle calculation module, used to calculate the current number of idle tasks according to the corresponding priority queue and the resource quota configuration information; a task queue insertion module, used to insert a corresponding number of the at least one refresh task into the priority queue according to the number of idle tasks, to obtain a new priority queue.
[0012] According to a fourth aspect, the present invention provides a task issuing device, comprising: a data acquisition module, used to obtain the number of issues of the current priority queue and the remaining number of issues of the previous priority queue; a task acquisition module, used to obtain the number of tasks of each priority queue according to the priority queue obtained by the task dynamic scheduling method described in the first aspect and any optional implementation method of the first aspect; a issuing calculation module, used to calculate the maximum number of issues according to the number of issues of the current priority queue and the remaining number of issues of the previous priority queue; an overflow judgment module, used to judge whether the number of tasks in the current priority queue is greater than the maximum number of issues; a maximum extraction module, used to extract the corresponding number of tasks in the current priority queue according to the maximum number of issues when the number of tasks in the current priority queue is greater than the maximum number of issues; a selection extraction module, used to extract all tasks in the current priority queue when the number of tasks in the current priority queue is less than or equal to the maximum number of issues, and calculate the difference between the number of tasks in the current priority queue and the maximum number of issues as the remaining number of issues of the current priority queue; a loop extraction module, used to repeat the above steps until the tasks of all priority queues are extracted; and a task issuing module, used to complete task issuing according to all extracted tasks.
[0013] According to the fifth aspect, the present invention provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the task dynamic scheduling method as described in the first aspect and any optional implementation manner of the first aspect or the steps of the task issuing method as described in the second aspect and any optional implementation manner of the second aspect.
[0014] According to the sixth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the task dynamic scheduling method as described in the first aspect and any optional implementation manner of the first aspect are implemented, or the steps of the task issuing method as described in the second aspect and any optional implementation manner of the second aspect are implemented.
[0015] The technical solution of the present invention has the following advantages:
[0016] 1. The task dynamic scheduling method disclosed in the embodiment of the present invention pre-sets resource quota configuration information, configures different resource quotas for different refresh tasks, and isolates each user task from each other. By pre-setting multiple priority queues and calculating the number of idle tasks in each priority queue, a large number of high-priority tasks can be satisfied without affecting other customers' tasks.
[0017] 2. The task delivery method disclosed in the embodiment of the present invention ensures that tasks of all priorities will be delivered each time a task is delivered by setting the maximum delivery number of each priority queue, thereby avoiding the situation where only high-priority tasks are delivered and low-priority tasks are delayed for a long time. By calculating the remaining delivery number of the priority queue, the efficiency of delivery can be fully improved, avoiding waste of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flowchart of a specific example of a task dynamic scheduling method in an embodiment of the present invention;
[0020] Figure 2 A flowchart of another specific example of a task dynamic scheduling method in an embodiment of the present invention;
[0021] Figure 3 A flowchart of a specific example of a task issuing method in an embodiment of the present invention;
[0022] Figure 4 A flowchart of another specific example of a task issuing method in an embodiment of the present invention;
[0023] Figure 5 It is a structural block diagram of a specific example of a task dynamic scheduling device in an embodiment of the present invention;
[0024] Figure 6 A structural block diagram of a specific example of a task issuing device in an embodiment of the present invention
[0025] Figure 7 FIG. 4 is a specific example diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0028] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0029] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0030] The present invention discloses a task dynamic scheduling method, such as Figure 1 As shown, the following steps are included:
[0031] Step S11, obtaining externally input refresh task information, resource quota configuration information and current priority queue information; the refresh task information includes at least one refresh task.
[0032] Specifically, the refresh task information also includes a domain name and a user, the resource quota configuration information includes multiple configuration types, and the current priority queue information includes the number of tasks in multiple priority queues.
[0033] Furthermore, multiple configuration types in the resource quota configuration information correspond to the domain names and users in the refresh task information, and the resource quota configuration information includes domain names, users, quotas, initial priorities, and preset queue lengths. Each configuration type is configured with different quotas, initial priorities, and preset queue lengths for any domain name and any user. In particular, configuration types can be set separately for all users and domain names based on actual users and domain names; configuration types can also be set only for special users and domain names, and then a default configuration type can be set separately. When it does not belong to a special user and / or domain name, the default configuration type can be used to reduce the workload during resource configuration.
[0034] Exemplarily, the resource quota configuration information may be in the following form:
[0035]
[0036] Among them, the initial priority includes 0, 1, 2, 3, 4, and 5, a total of 6 levels. The correspondence between the priority and the priority queue is preset. In particular, the priority and the priority queue can be one-to-one, two-to-one, or many-to-one. The priority and the priority queue include a two-to-one relationship, that is, priority 0 and priority 1 correspond to the first priority queue at the same time. When the priority is 0, the task is inserted into the head of the first priority queue, and when the priority is 1, the task is inserted into the tail of the first priority queue, so as to achieve two priorities corresponding to the same priority queue. In the above-mentioned resource quota configuration information embodiment, the preset queue lengths of 0, 1, 2, 3, 4, and 5 correspond to the head of the first priority queue, the tail of the first priority queue, the second priority queue, the third priority queue, the fourth priority queue, and the fifth priority queue, respectively.
[0037] Furthermore, when the domain name included in the refresh task information is a.com and the user is User1, the resource quota configuration numbered 1 is adopted; when the domain name included in the refresh task information is not a.com and the user is User1, the resource quota configuration numbered 2 is adopted; when the domain name included in the refresh task information is not a.com and the user is not User1, the resource quota configuration numbered 3 is adopted.
[0038] For example, the resource quota configuration numbered 1 is used, that is, User1 issues a.com refresh tasks. At this time, according to the configuration information, User1 can only issue 1,000 refresh tasks for a.com every day, and the initial priority is 2. A maximum of 200 tasks with the configuration number 1 can be inserted into each priority queue.
[0039] Step S12: acquiring a corresponding priority queue according to externally input refresh task information and resource quota configuration information.
[0040] Specifically, first obtain the corresponding configuration type according to the refresh task information and resource quota configuration information; then obtain the refresh amount, initial priority and preset queue length according to the configuration type; then determine whether the current configuration type allows the creation of tasks according to the refresh amount; when the configuration type allows the creation of tasks, determine the corresponding priority queue according to the initial priority; when the configuration type prohibits the creation of tasks, stop task scheduling and report an error.
[0041] Furthermore, if Figure 2 As shown in the figure, taking the refresh task of a.com issued by User1 as an example, according to the user User1 and the domain name a.com, the resource quota configuration information is queried to obtain the currently used configuration type number 1. According to the configuration type number 1, the refresh quota is 1000, the initial priority is 2, and the preset queue lengths are / , / , 200, 200, 200, ∞, which correspond to the first priority queue head, the first priority queue tail, the second priority queue, the third priority queue, the fourth priority queue and the fifth priority queue respectively. Query the refresh times of the current configuration type to determine whether the current refresh times reach the refresh quota. When the refresh quota is reached, the task creation is prohibited, and when the refresh quota is not reached, the task creation is allowed. When the task creation is prohibited, the task scheduling process is stopped and an error is reported. When the task creation is allowed, the priority queue to which the current task belongs is determined according to the initial priority.
[0042] Step S13, calculating the current number of idle tasks according to the corresponding priority queue and resource quota configuration information.
[0043] Specifically, based on the priority queue, the preset queue length and the information of the priority queue, determine whether the number of tasks of the same configuration type in the current priority queue is less than the preset queue length; when the number of tasks of the same configuration type in the priority queue is greater than or equal to the preset queue length, lower the priority and reselect the priority queue; when the number of tasks of the same configuration type in the priority queue is less than the preset queue length, calculate the current number of idle tasks.
[0044] Furthermore, if Figure 2As shown, taking the initial priority 2 corresponding to the second priority queue as an example, there are already 100 tasks with configuration type 1 in the second priority queue. According to the preset queue length in the configuration type, a total of 200 tasks with configuration type 1 can be inserted into the second priority queue. At this time, 100<200, it is judged that the number of tasks of the same configuration type in the priority queue at this time is less than the preset queue length, and the current number of idle tasks is 200-100=100.
[0045] Furthermore, when there are already 200 tasks of configuration type 1 in the second priority queue, according to the preset queue length in the configuration type, a total of 200 tasks of configuration type 1 can be inserted into the second priority queue, and at this time 200=200, then it is judged that the number of tasks of the same configuration type in the priority queue at this time is not less than the preset queue length, and the priority of the current task is reduced to level 3. At this time, it is assumed that priority 3 corresponds to the third priority queue, and there are already 0 tasks of configuration type 1 in the third priority queue. According to the preset queue length in the configuration type, a total of 200 tasks of configuration type 1 can be inserted into the third priority queue, and at this time 0<200, then it is judged that the number of tasks of the same configuration type in the priority queue at this time is less than the preset queue length, and the current number of idle tasks is 200-0=200.
[0046] Step S14: insert at least one refresh task of a corresponding number into the priority queue according to the number of idle tasks to obtain a new priority queue.
[0047] Furthermore, if Figure 2 As shown, it is determined whether at least one refresh task is fully inserted into the priority queue; when at least one refresh task is not fully inserted into the priority queue, the priority of the remaining tasks is lowered and the priority queue is reselected.
[0048] For example, taking the initial priority 2 corresponding to the second priority queue as an example, there are 100 tasks with configuration type 1 in the second priority queue. When the current number of idle tasks is 100 and the current refresh task information includes 50 refresh tasks, all 50 refresh tasks will be inserted into the second priority queue.
[0049] For example, taking the initial priority 2 corresponding to the second priority queue as an example, there are already 100 tasks with configuration type 1 in the second priority queue, and the current number of idle tasks in the second priority queue is 100. When the current refresh task information includes 150 refresh tasks, 150>100 at this time, and 50 tasks are remaining tasks and cannot be inserted into the second priority queue. First, insert the 100 refresh tasks into the second priority queue, and then reduce the priority of the 50 remaining tasks to level 3. At this time, assuming that priority 3 corresponds to the third priority queue, there are already 0 tasks with configuration type 1 in the third priority queue, and the number of idle tasks in the third priority queue is 200, then all 50 remaining tasks are inserted into the third priority queue. In particular, when the priority drops to the lowest, all tasks are inserted into the last priority queue.
[0050] The task dynamic scheduling method disclosed in the embodiment of the present invention pre-sets resource quota configuration information, configures different resource quotas for different refresh tasks, and isolates each user task from each other. By pre-setting multiple priority queues and calculating the number of idle tasks in each priority queue, a large number of high-priority tasks can be satisfied without affecting other customers' tasks.
[0051] The present invention also discloses a task issuing method, such as Figure 3 As shown, the following steps are included:
[0052] Step S21, obtaining the number of messages sent by the current priority queue and the number of messages remaining sent by the previous priority queue.
[0053] Specifically, the number of dispatches of the current priority queue is calculated by the preset dispatch coefficient and the total number of dispatches. For example, when the total number of dispatches is 1000, the dispatch coefficient of the first priority queue is 0.5, the dispatch coefficient of the second priority queue is 0.25, the dispatch coefficient of the third priority queue is 0.15, the dispatch coefficient of the fourth priority queue is 0.08, and the dispatch coefficient of the fifth priority queue is 0.02, the number of dispatches of the first priority queue is 500, the number of dispatches of the second priority queue is 250, the number of dispatches of the third priority queue is 150, the number of dispatches of the fourth priority queue is 80, and the number of dispatches of the fifth priority queue is 20. The remaining number of dispatches of the previous priority queue is calculated when the previous priority queue extracts a task.
[0054] Step S22, obtaining the number of tasks in each priority queue according to the priority queue obtained by the task dynamic scheduling method described in the embodiment of the present invention.
[0055] Step S23, calculating the maximum number of sends according to the number of sends of the current priority queue and the remaining number of sends of the previous priority queue.
[0056] Further, it is determined whether the current priority queue is the lowest priority queue; when the current priority queue is the lowest priority queue, a corresponding number of tasks in the current priority queue are extracted according to the maximum number of sent tasks.
[0057] Specifically, the maximum number of sent packets is the sum of the number of sent packets of the current priority queue and the remaining number of sent packets of the previous priority queue.
[0058] Step S24, determining whether the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent.
[0059] Step S25, when the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent, a corresponding number of tasks in the current priority queue is extracted according to the maximum number of tasks to be sent.
[0060] Step S26, when the number of tasks in the current priority queue is less than or equal to the maximum number of tasks to be sent, extract all tasks in the current priority queue, and calculate the difference between the number of tasks in the current priority queue and the maximum number of tasks to be sent as the remaining number of tasks to be sent in the current priority queue.
[0061] Step S27, repeat the above steps until the tasks of all priority queues are extracted.
[0062] In particular, when extracting tasks, a task aggregation method may be used, that is, tasks with the same parameters are merged and recorded, which is not limited in the present invention.
[0063] Step S28, completing task distribution based on all extracted tasks.
[0064] Specifically, a refresh command is generated according to all the extracted tasks, and the refresh command is sent to the corresponding device, thereby completing the task issuance.
[0065] For example, Figure 4 As shown, the first priority queue includes 600 tasks and the number of tasks sent is 500, the second priority queue includes 150 tasks and the number of tasks sent is 250, the third priority queue includes 200 tasks and the number of tasks sent is 150, the fourth priority queue includes 150 tasks and the number of tasks sent is 80, and the fifth priority queue includes 1000 tasks and the number of tasks sent is 20.
[0066] First, extract the tasks in the first priority queue. Since the first priority queue is extracted first, there is no previous priority queue, that is, the maximum number of dispatches is equal to the number of dispatches in the current priority queue. Since 600>500, that is, the number of tasks in the current priority queue is greater than the maximum number of dispatches, tasks can be extracted from the first priority queue according to the maximum number of dispatches of 500.
[0067] Then, the tasks in the second priority queue are extracted. Since the first priority queue is extracted according to the maximum number of dispatches, the remaining number of dispatches in the previous priority queue is 0. At this time, the maximum number of dispatches is equal to the number of dispatches in the current priority queue. Since 150 < 250, that is, the number of tasks in the current priority queue is less than the maximum number of dispatches, all tasks in the second priority queue are extracted at this time, and the difference between the number of tasks in the current priority queue and the maximum number of dispatches is calculated, that is, the remaining number of dispatches in the second priority queue is 250-150=100.
[0068] Next, the tasks in the third priority queue are extracted. Since the remaining number of dispatches calculated when extracting the tasks in the second priority queue is 100, that is, the remaining number of dispatches in the previous priority queue is 100, the maximum number of dispatches at this time is equal to the sum of the number of dispatches in the current priority queue and the remaining number of dispatches in the previous priority queue, that is, 150+100=250. Since 200<250, that is, the number of tasks in the current priority queue is less than or equal to the maximum number of dispatches, all tasks in the third priority queue are extracted, and the difference between the number of tasks in the current priority queue and the maximum number of dispatches is calculated, that is, the remaining number of dispatches in the third priority queue is 250-200=50.
[0069] Then, the tasks in the 4th priority queue are extracted. Since the remaining number of dispatches calculated when extracting the tasks in the 3rd priority queue is 50, that is, the remaining number of dispatches in the previous priority queue is 50, the maximum number of dispatches at this time is equal to the sum of the dispatches in the current priority queue and the remaining number of dispatches in the previous priority queue, that is, 80+50=130. Since 150>130, that is, the number of tasks in the current priority queue is greater than the maximum number of dispatches, tasks can be extracted from the 4th priority queue according to the maximum number of dispatches of 130.
[0070] Finally, the tasks in the 5th priority queue are extracted. Since the 4th priority queue is extracted according to the maximum number of dispatches, the remaining number of dispatches in the previous priority queue is 0. At this time, the maximum number of dispatches is equal to the number of dispatches in the current priority queue. Since the 5th priority queue is the lowest priority queue, tasks are directly extracted from the 5th priority queue according to the maximum number of dispatches 20.
[0071] When all tasks in the five priority queues are extracted, a total of 500+150+200+130+20=1000 tasks are extracted. A refresh command is generated according to all the extracted tasks and sent to the device to complete the task delivery.
[0072] The task delivery method disclosed in the embodiment of the present invention ensures that tasks of all priorities will be delivered each time a task is delivered by setting the maximum delivery number of each priority queue, thereby avoiding the situation where only high-priority tasks are delivered and low-priority tasks are delayed for a long time. By calculating the remaining delivery number of the priority queue, the efficiency of delivery can be fully improved, avoiding waste of resources.
[0073] The present invention also discloses a task dynamic scheduling device, such as Figure 5 As shown, including:
[0074] The information acquisition module 101 is used to obtain externally input refresh task information, resource quota configuration information and current priority queue information; the refresh task information includes at least one refresh task; for specific contents, please refer to the corresponding part of step S11 in the above method embodiment, which will not be repeated here.
[0075] The queue acquisition module 102 is used to acquire the corresponding priority queue according to the externally input refresh task information and resource quota configuration information; the specific content refers to the corresponding part of step S12 in the above method embodiment, which will not be repeated here.
[0076] The idle calculation module 103 is used to calculate the current number of idle tasks according to the corresponding priority queue and resource quota configuration information; the specific content refers to the corresponding part of step S13 in the above method embodiment, which will not be repeated here.
[0077] The task queue-insertion module 104 is used to insert a corresponding number of at least one refresh task into the priority queue according to the number of idle tasks to obtain a new priority queue; for details, please refer to the corresponding part of step S14 in the above method embodiment, which will not be repeated here.
[0078] The task dynamic scheduling device provided by the present invention ensures that tasks of all priorities will be issued each time a task is issued by setting the maximum number of issues for each priority queue, thereby avoiding the situation where only high-priority tasks are issued and low-priority tasks are postponed for a long time. By calculating the remaining number of issues of the priority queue, the efficiency of the issue can be fully improved, avoiding resource waste.
[0079] The present invention also provides a task issuing device, such as Figure 6 As shown, including:
[0080] The data acquisition module 201 is used to obtain the number of sends of the current priority queue and the remaining number of sends of the previous priority queue; for details, please refer to the corresponding part of step S21 in the above method embodiment, which will not be repeated here.
[0081] The task acquisition module 202 is used to obtain the number of tasks in each priority queue according to the priority queue obtained by the task dynamic scheduling method in the embodiment of the present invention; the specific content refers to the corresponding part of step S22 in the above method embodiment, which will not be repeated here.
[0082] The sending calculation module 203 is used to calculate the maximum sending number according to the sending number of the current priority queue and the remaining sending number of the previous priority queue; the specific content refers to the corresponding part of step S23 in the above method embodiment, which will not be repeated here.
[0083] The overflow judgment module 204 is used to judge whether the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent; for details, please refer to the corresponding part of step S24 in the above method embodiment, which will not be repeated here.
[0084] The maximum extraction module 205 is used to extract the corresponding number of tasks in the current priority queue according to the maximum number of tasks sent when the number of tasks in the current priority queue is greater than the maximum number of tasks sent. For details, please refer to the corresponding part of step S25 in the above method embodiment, which will not be repeated here.
[0085] Select extraction module 206, which is used to extract all tasks in the current priority queue when the number of tasks in the current priority queue is less than or equal to the maximum number of dispatches, and calculate the difference between the number of tasks in the current priority queue and the maximum number of dispatches as the remaining number of dispatches in the current priority queue; for specific details, please refer to the corresponding part of step S26 in the above method embodiment, which will not be repeated here.
[0086] The loop extraction module 207 is used to repeat the above steps until the tasks of all priority queues are extracted; for details, please refer to the corresponding part of step S27 in the above method embodiment, which will not be repeated here.
[0087] The task issuing module 208 is used to complete task issuing according to all the extracted tasks; for the specific content, please refer to the corresponding part of step S28 in the above method embodiment, which will not be repeated here.
[0088] The task dispatching device disclosed in the embodiment of the present invention ensures that tasks of all priorities will be dispatched each time a task is dispatched by setting the maximum dispatching number of each priority queue, thereby avoiding the situation where only high-priority tasks are dispatched and low-priority tasks are postponed for a long time. By calculating the remaining dispatching number of the priority queue, the dispatching efficiency can be fully improved, avoiding resource waste.
[0089] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, the electronic device may include a processor 301 and a memory 302, wherein the processor 301 and the memory 302 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0090] The processor 301 may be a central processing unit (CPU). The processor 301 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0091] The memory 302 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the task dynamic scheduling method or task delivery method in the embodiment of the present invention. The processor 301 executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory 302, that is, implementing the task dynamic scheduling method or task delivery method in the above method embodiment.
[0092] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 301, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the processor 301 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0093] One or more modules are stored in the memory 302, and when executed by the processor 301, the execution is as follows: Figure 1 or Figure 3 The task dynamic scheduling method or task issuing method in the illustrated embodiment.
[0094] Although the exemplary embodiments and their advantages have been described in detail, those skilled in the art may make various changes, substitutions and modifications to these embodiments without departing from the spirit of the present invention and the scope of protection defined by the appended claims, and such modifications and variations all fall within the scope defined by the appended claims. For other examples, those of ordinary skill in the art should readily understand that the order of the process steps may be changed while maintaining the scope of protection of the present invention.
[0095] In addition, the scope of application of the present invention is not limited to the processes, mechanisms, manufactures, material compositions, means, methods and steps of the specific embodiments described in the specification. From the disclosure of the present invention, it will be easily understood by those skilled in the art that the processes, mechanisms, manufactures, material compositions, means, methods or steps that currently exist or will be developed in the future, which perform substantially the same functions as the corresponding embodiments described in the present invention or obtain substantially the same results, can be applied according to the present invention. Therefore, the claims attached to the present invention are intended to include these processes, mechanisms, manufactures, material compositions, means, methods or steps within their scope of protection.
Claims
1. A task dynamic scheduling method, characterized in that: include: Obtain external input refresh task information, resource quota configuration information and current priority queue information; The refresh task information includes at least one refresh task; Acquire a corresponding priority queue according to the externally input refresh task information and the resource quota configuration information; Calculate the current number of idle tasks according to the corresponding priority queue and the resource quota configuration information; According to the number of idle tasks, inserting a corresponding number of at least one refresh task into the priority queue to obtain a new priority queue; Wherein, acquiring the corresponding priority queue according to the externally input refresh task information and the resource quota configuration information includes: According to the refresh task information and the resource quota configuration information, obtaining a corresponding configuration type; According to the configuration type, a refresh quota, an initial priority, and a preset queue length are obtained; According to the refresh quota, determine whether the current configuration type allows the creation of tasks; When the configuration type allows the task to be created, determining the corresponding priority queue according to the initial priority; When the configuration type prohibits the creation of tasks, task scheduling is stopped and an error is reported; The calculating the number of current idle tasks according to the corresponding priority queue and the resource quota configuration information includes: According to the priority queue, the preset queue length and the information of the priority queue, determining whether the number of tasks of the same configuration type in the current priority queue is less than the preset queue length; When the number of tasks of the same configuration type in the priority queue is greater than or equal to the preset queue length, the priority is lowered and a priority queue is reselected; When the number of tasks of the same configuration type in the priority queue is less than the preset queue length, the number of current idle tasks is calculated.
2. The method according to claim 1, characterized in that The step of inserting a corresponding number of the at least one refresh task into the priority queue according to the number of idle tasks to obtain a new priority queue further includes: Determining whether all of the at least one refresh task are inserted into the priority queue; When the at least one refresh task is not completely inserted into the priority queue, the priorities of the remaining tasks are lowered and a priority queue is reselected.
3. A task issuing method, characterized in that: include: Get the number of dispatches in the current priority queue and the remaining number of dispatches in the previous priority queue; According to the priority queue obtained by the task dynamic scheduling method according to claim 1 or 2, obtaining the number of tasks in each priority queue; Calculate the maximum number of sends according to the number of sends of the current priority queue and the remaining number of sends of the previous priority queue; Determine whether the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent; When the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent, a corresponding number of tasks in the current priority queue is extracted according to the maximum number of tasks to be sent; When the number of tasks in the current priority queue is less than or equal to the maximum number of tasks to be sent, all tasks in the current priority queue are extracted, and the difference between the number of tasks in the current priority queue and the maximum number of tasks to be sent is calculated as the remaining number of tasks to be sent in the current priority queue; Repeat the above steps until all the tasks in the priority queue are extracted; Complete task distribution based on all extracted tasks.
4. The method according to claim 3, characterized in that After calculating the maximum number of deliveries, the following are also included: Determine whether the current priority queue is the lowest priority queue; When the current priority queue is the lowest priority queue, a corresponding number of tasks in the current priority queue are extracted according to the maximum number of sent tasks.
5. A task dynamic scheduling device, characterized in that: include: The information acquisition module is used to obtain external input refresh task information, resource quota configuration information and current priority queue information; The refresh task information includes at least one refresh task; A queue acquisition module, used to acquire a corresponding priority queue according to the externally input refresh task information and the resource quota configuration information; An idle calculation module, used to calculate the current number of idle tasks according to the corresponding priority queue and the resource quota configuration information; A task queue insertion module, used for inserting a corresponding number of at least one refresh task into the priority queue according to the number of idle tasks, to obtain a new priority queue; The queue acquisition module acquires the corresponding priority queue according to the externally input refresh task information and the resource quota configuration information, including: According to the refresh task information and the resource quota configuration information, obtaining a corresponding configuration type; According to the configuration type, a refresh quota, an initial priority, and a preset queue length are obtained; According to the refresh quota, determine whether the current configuration type allows the creation of tasks; When the configuration type allows the task to be created, determining the corresponding priority queue according to the initial priority; When the configuration type prohibits the creation of tasks, task scheduling is stopped and an error is reported; The idle calculation module calculates the number of current idle tasks according to the corresponding priority queue and the resource quota configuration information, including: According to the priority queue, the preset queue length and the information of the priority queue, determining whether the number of tasks of the same configuration type in the current priority queue is less than the preset queue length; When the number of tasks of the same configuration type in the priority queue is greater than or equal to the preset queue length, the priority is lowered and a priority queue is reselected; When the number of tasks of the same configuration type in the priority queue is less than the preset queue length, the number of current idle tasks is calculated.
6. A task issuing device, characterized in that: include: The data acquisition module is used to obtain the number of dispatches in the current priority queue and the remaining number of dispatches in the previous priority queue; A task acquisition module, configured to obtain the number of tasks in each priority queue according to the priority queue obtained by the task dynamic scheduling method according to any one of claims 1 to 2; A sending calculation module, used for calculating the maximum sending number according to the sending number of the current priority queue and the remaining sending number of the previous priority queue; An overflow judgment module is used to judge whether the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent; A maximum extraction module, used for extracting a corresponding number of tasks in the current priority queue according to the maximum number of tasks to be sent when the number of tasks in the current priority queue is greater than the maximum number of tasks to be sent; Select an extraction module, which is used to extract all tasks in the current priority queue when the number of tasks in the current priority queue is less than or equal to the maximum number of tasks to be sent, and calculate the difference between the number of tasks in the current priority queue and the maximum number of tasks to be sent as the remaining number of tasks to be sent in the current priority queue; A loop extraction module is used to repeat the above steps until all the tasks of the priority queue are extracted; The task distribution module is used to complete the task distribution based on all the extracted tasks.
7. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the steps of the task dynamic scheduling method as described in any one of claims 1-2 or the steps of the task issuing method as described in any one of claims 3-4.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the task dynamic scheduling method as described in any one of claims 1-2 or the steps of the task issuing method as described in any one of claims 3-4 are implemented.
Citation Information
Cited By
Cloud platform optimization method and system based on dynamic resource scheduling
CN121233323A
