Resource scheduling method, device, electronic device and storage medium

By dynamically scheduling resources based on tasks and resource conditions of the scanning service domain in the cloud computing environment, the problem of excessive time-consuming task processing caused by unreasonable resource allocation in the existing technology is solved, and more efficient task processing is achieved.

CN114675958BActive Publication Date: 2025-05-13AISINO CORPORATION
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011543546.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2025-05-13
Estimated Expiration
2040-12-24

AI Technical Summary

Technical Problem

In the prior art, resource allocation within each scanning service domain is unreasonable, resulting in a long time to process the task.

Method used

During the task flow scanning process, for each scan service domain, the average time spent of the scan task and the first total time spent in the queued task is calculated based on the number of completed tasks, task time spent, queued tasks and resources, and the target scan service domain that needs to be added, and the resources are scheduled to the domain.

Benefits of technology

It effectively avoids the situation where tasks accumulate in a certain scanning service domain and shortens the overall task processing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114675958B_ABST
    Figure CN114675958B_ABST
Patent Text Reader

Abstract

The present invention discloses a resource scheduling method, device, electronic device and storage medium, the method comprising: in the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, determining the average time consumed to scan the scanning task of the scanning service domain; according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, determining the first total time consumed to scan the tasks being queued by the scanning service domain; according to the first total time consumed to scan the tasks being queued by each scanning service domain, determining the target scanning service domain that needs to increase resources, and scheduling resources to the target scanning service domain. The embodiment of the present invention schedules resources to the target scanning service domain according to the scanning task situation of each scanning service domain, avoids the situation where a large number of tasks are piled up in a certain scanning service domain, and shortens the time consumed to process tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of resource scheduling, and in particular to a resource scheduling method, device, electronic equipment and storage medium. Background Art

[0002] In the cloud computing environment, the task distribution end will issue a task flow, which will carry many tasks to be scanned. Each task needs to pass through different scanning service domains in turn to complete the scanning task. Each scanning service domain will allocate a certain amount of resources. Each scanning service domain will process the tasks in the scanning service domain in parallel through its own configured resources, and send the tasks to the next scanning service domain after processing.

[0003] In the prior art, the same amount of resources is generally allocated to each scanning service domain. The problem is that after the task distribution end issues the task flow, a large number of tasks are accumulated in the first scanning service domain. The resource processing pressure of the first scanning service domain is relatively large, while the resources in other scanning service domains are idle, which greatly increases the time consumption of the overall task processing.

[0004] How to reasonably allocate resources and shorten the time of task processing is a problem that needs to be solved urgently. Summary of the invention

[0005] The embodiments of the present invention provide a resource scheduling method, device, electronic device and storage medium, which are used to solve the problem in the prior art that unreasonable resource allocation in each scanning service domain leads to a long time consumption of overall task processing.

[0006] An embodiment of the present invention provides a resource scheduling method, the method comprising:

[0007] During the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, the average time consumed to scan the tasks of the scanning service domain is determined; according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, the first total time consumed to scan the tasks being queued by the scanning service domain is determined;

[0008] According to the first total time consumed by each scanning service domain to scan the queued tasks, a target scanning service domain that needs to increase resources is determined, and resources are scheduled to the target scanning service domain.

[0009] Furthermore, before determining the target scanning service domain that needs to increase resources according to the first total time consumed by each scanning service domain to scan the queued tasks, the method further includes:

[0010] For each scanning service domain, determine a second total time consumed by the scanning service domain from the initiation of the task flow to scanning all tasks in the task flow according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks;

[0011] The determining, according to the first total time consumed by each scanning service domain to scan the queued tasks, of a target scanning service domain for which resources need to be increased comprises:

[0012] Determine a third total time consumed by the scan service domain with the second largest total time consumption to scan the queued tasks, and a fourth total time consumed by the scan service domain with the second smallest total time consumption to scan the queued tasks;

[0013] It is determined whether the third total time consumption is greater than the fourth total time consumption. If so, the scanning service domain with the largest second total time consumption is determined as the target scanning service domain that needs to increase resources.

[0014] Furthermore, before determining the average time consumption of scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task for each scanning service domain, the method further includes:

[0015] For each scanning service domain, determine whether the number of tasks queued by the scanning service domain has changed, and if so, proceed to subsequent steps; or determine whether the number of resources included in the scanning service domain has changed, and if so, proceed to subsequent steps.

[0016] Further, after determining the second total time consumed by the scanning service domain to scan all tasks in the task flow, and before determining the target scanning service domain for which resources need to be increased according to the total time consumed by each scanning service domain to scan the queued tasks, the method further includes:

[0017] Determine a first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine a second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value;

[0018] Determine whether the second average value is greater than a preset duration threshold, and if so, proceed to subsequent steps.

[0019] Further, the scheduling of resources to the target scanning service domain includes:

[0020] Determine whether there are idle resources in the idle resource pool. If yes, extract resources from the idle resource pool and transfer them to the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them to the target scanning service domain.

[0021] On the other hand, an embodiment of the present invention provides a resource scheduling device, the device comprising:

[0022] A first determination module is used to determine, during the task flow scanning process, for each scanning service domain, an average time consumption for scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption for scanning each task; and determine a first total time consumption for scanning tasks being queued by the scanning service domain according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumption for scanning tasks of the scanning service domain;

[0023] The scheduling module is used to determine a target scanning service domain that needs to increase resources according to a first total time consumed by each scanning service domain to scan the queued tasks, and schedule resources to the target scanning service domain.

[0024] Furthermore, the device also includes:

[0025] A second determination module is used to determine, for each scanning service domain, a second total time consumed by the scanning service domain from the initiation of the task flow to scanning all tasks in the task flow according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks;

[0026] The scheduling module is specifically used to determine the third total time consumed by the scanning service domain with the second largest total time consumption to scan the queued tasks, and the fourth total time consumed by the scanning service domain with the second smallest total time consumption to scan the queued tasks; determine whether the third total time consumption is greater than the fourth total time consumption, and if so, determine that the scanning service domain with the second largest total time consumption is the target scanning service domain that needs to increase resources.

[0027] Furthermore, the device also includes:

[0028] A judgment module is used to judge whether the number of tasks queued in each scanning service domain has changed, and if so, trigger the first determination module; or to judge whether the number of resources included in the scanning service domain has changed, and if so, trigger the first determination module.

[0029] Furthermore, the device also includes:

[0030] The third determination module is used to determine the first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine the second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value; judge whether the second average value is greater than a preset duration threshold, and if so, trigger the second determination module.

[0031] Furthermore, the scheduling module is specifically used to determine whether there are idle resources in the idle resource pool. If so, extract resources from the idle resource pool and transfer them into the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them into the target scanning service domain.

[0032] On the other hand, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0033] Memory, used to store computer programs;

[0034] The processor is used to implement any of the method steps described above when executing the program stored in the memory.

[0035] On the other hand, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the method steps described above is implemented.

[0036] An embodiment of the present invention provides a resource scheduling method, device, electronic device and storage medium, the method comprising: in a task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, determining the average time consumed to scan the tasks of the scanning service domain; according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, determining the first total time consumed to scan the tasks being queued by the scanning service domain; according to the first total time consumed to scan the tasks being queued by each scanning service domain, determining a target scanning service domain that needs to increase resources, and scheduling resources to the target scanning service domain.

[0037] The above technical solution has the following advantages or beneficial effects:

[0038] In an embodiment of the present invention, for each scanning service domain, the average time consumption of scanning tasks of the scanning service domain is determined according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task, and then the first total time consumption of scanning tasks of the scanning service domain in queue is determined according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumption of scanning tasks of the scanning service domain, and finally the target scanning service domain that needs to increase resources is determined according to the first total time consumption of scanning tasks in queue by each scanning service domain, and resources are dispatched to the target scanning service domain. In an embodiment of the present invention, resources are dispatched to the target scanning service domain according to the scanning task situation of each scanning service domain, thereby avoiding the situation where a large number of tasks are piled up in a certain scanning service domain and shortening the time consumption of task processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A schematic diagram of a resource scheduling process provided in Example 1 of the present invention;

[0041] Figure 2 A schematic diagram of the structure of a task flow scanning system provided in Example 5 of the present invention;

[0042] Figure 3 A schematic diagram of the structure of a resource scheduling device provided in Example 6 of the present invention;

[0043] Figure 4 This is a schematic diagram of the structure of an electronic device provided in Example 7 of the present invention. DETAILED DESCRIPTION

[0044] The present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] Embodiment 1:

[0046] Figure 1 A schematic diagram of a resource scheduling process provided by an embodiment of the present invention, the process includes the following steps:

[0047] S101: During the task flow scanning process, for each scanning service domain, the average time consumed for scanning tasks of the scanning service domain is determined according to the number of scanning tasks completed by the scanning service domain and the time consumed for scanning each task; and the first total time consumed for scanning queued tasks of the scanning service domain is determined according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumed for scanning tasks of the scanning service domain.

[0048] S102: Determine a target scanning service domain that needs to increase resources according to a first total time consumed by each scanning service domain to scan queued tasks, and schedule resources to the target scanning service domain.

[0049] The resource scheduling method provided in the embodiment of the present invention is applied to an electronic device, which may be a PC, a tablet computer, etc. The schedulable resources in the embodiment of the present invention may be resources such as a server that can process tasks.

[0050] After the task distribution end sends the task flow, during the task flow scanning process, the electronic device obtains the number of completed scanning tasks and the time taken to scan each task for each scanning service domain, and determines the average time taken to scan the tasks of the scanning service domain according to the number of completed scanning tasks and the time taken to scan each task. As shown, the sum of the time consumed for scanning each task is calculated, and the ratio of the sum to the number of completed scanning tasks is used as the average time consumed by the scanning task in the scanning service domain. 已i Indicates the number of completed scan tasks in the iScan service domain, T j represents the time taken for the jth completed scanning task, T Ai Indicates the average duration of the iScan service domain scan task.

[0051] During the task flow scanning process, the electronic device obtains the number of tasks queued by the scanning service domain and the number of resources contained in the scanning service domain for each scanning service domain, and determines the first total time consumed by the scanning service domain to scan the tasks being queued according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain, and the average time consumed by the scanning service domain to scan the tasks. As shown in the formula As shown, the product of the number of tasks queued by the scanning service domain and the average time consumed by the scanning service domain to scan tasks is calculated, and the ratio of the product to the number of resources included in the scanning service domain is used as the first total time consumed by the scanning service domain to scan the tasks being queued. Qi represents the number of tasks queued in the i-th scanning service domain, N i Indicates the number of resources contained in the i-scan service domain, T Qi Indicates the first total time consumed by the i-th scanning service domain scanning queued tasks.

[0052] According to the first total time consumed by each scanning service domain to scan the queued tasks, the target scanning service domain that needs to increase resources is determined, and the resources are dispatched to the target scanning service domain. Among them, the scanning service domain with the largest first total time consumption can be determined as the target scanning service domain, and resources are dispatched to the target scanning service domain. In this way, the pressure of the scanning service domain with the largest first total time consumption is relieved.

[0053] In an embodiment of the present invention, for each scanning service domain, the average time consumption of scanning tasks of the scanning service domain is determined according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task, and then the first total time consumption of scanning tasks of the scanning service domain in queue is determined according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumption of scanning tasks of the scanning service domain, and finally the target scanning service domain that needs to increase resources is determined according to the first total time consumption of scanning tasks in queue by each scanning service domain, and resources are dispatched to the target scanning service domain. In an embodiment of the present invention, resources are dispatched to the target scanning service domain according to the scanning task situation of each scanning service domain, thereby avoiding the situation where a large number of tasks are piled up in a certain scanning service domain and shortening the time consumption of task processing.

[0054] Embodiment 2:

[0055] In order to make resource allocation more reasonable, based on the above embodiment, in an embodiment of the present invention, before determining the target scanning service domain for which resources need to be increased according to the first total time consumed by each scanning service domain to scan the queued tasks, the method further includes:

[0056] For each scanning service domain, determine a second total time consumed by the scanning service domain from the initiation of the task flow to scanning all tasks in the task flow according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks;

[0057] The determining, according to the first total time consumed by each scanning service domain to scan the queued tasks, of a target scanning service domain for which resources need to be increased comprises:

[0058] Determine a third total time consumed by the scan service domain with the second largest total time consumption to scan the queued tasks, and a fourth total time consumed by the scan service domain with the second smallest total time consumption to scan the queued tasks;

[0059] It is determined whether the third total time consumption is greater than the fourth total time consumption. If so, the scanning service domain with the largest second total time consumption is determined as the target scanning service domain that needs to increase resources.

[0060] In an embodiment of the present invention, before the electronic device determines the target scanning service domain that needs to increase resources based on the first total time taken by each scanning service domain to scan the queued tasks, for each scanning service domain, the electronic device determines the second total time taken by the scanning service domain from the initiation of the task flow to the scanning of all tasks in the task flow based on the time length from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time taken by the scanning service domain to scan tasks. As shown in the formula As shown, the product of the number of tasks not scanned by the scanning service domain and the average time consumed by the scanning service domain to scan tasks is calculated, the ratio of the product to the number of resources included in the scanning service domain is calculated, and the sum of the ratio and the length of time from the initiation of the task flow to the current moment is taken as the second total time consumed by the scanning service domain to scan all tasks in the task flow. In the formula, N 未i represents the number of tasks not scanned by the i-th scanning service domain, T 已 Indicates the length of time from the initiation of the task flow to the current moment, T Ni represents the second total time consumed by the i-th scanning service domain to scan all tasks in the task flow. Determine the third total time consumed by the scanning service domain with the largest second total time to scan the tasks being queued, and the fourth total time consumed by the scanning service domain with the smallest second total time to scan the tasks being queued. For example, if the scanning service domain with the largest second total time is scanning service domain A and the scanning service domain with the smallest second total time is scanning service domain C, then according to the formula The third total time consumption of scanning the queued tasks by scanning service domain A and the fourth total time consumption of scanning the queued tasks by scanning service domain C are calculated. It is determined whether the third total time consumption is greater than the fourth total time consumption. If so, the scanning service domain with the largest second total time consumption is determined as the target scanning service domain that needs to increase resources, and resources are scheduled to the target scanning service domain. If not, the target scanning service domain is not determined, and resource scheduling is not performed.

[0061] Because in the embodiment of the present invention, for each scanning service domain, the second total time consumed by the scanning service domain to scan all tasks in the task flow is determined based on the number of tasks that have not been scanned by the scanning service domain, the number of resources contained in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks. The third total time consumed by the scanning service domain with the largest second total time consumed to scan the tasks in the queue is determined, and the fourth total time consumed by the scanning service domain with the smallest second total time consumed to scan the tasks in the queue is determined; it is determined whether the third total time consumed is greater than the fourth total time consumed. If so, the scanning service domain with the largest second total time consumed is determined as the target scanning service domain that needs to increase resources, and resources are scheduled to the target scanning service domain. This makes resource allocation more reasonable.

[0062] Embodiment 3:

[0063] In order to ensure the timeliness of resource scheduling, based on the above embodiments, in the embodiment of the present invention, before determining the average time consumption of the scanning task of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task for each scanning service domain, the method further includes:

[0064] For each scanning service domain, determine whether the number of tasks queued by the scanning service domain has changed, and if so, proceed to subsequent steps; or determine whether the number of resources included in the scanning service domain has changed, and if so, proceed to subsequent steps.

[0065] In an embodiment of the present invention, before performing resource scheduling, for each scanning service domain, it is determined whether the number of tasks queued by the scanning service domain has changed, and if so, subsequent resource scheduling steps are performed; or it is determined whether the number of resources included in the scanning service domain has changed, and if so, subsequent resource scheduling steps are performed.

[0066] In the embodiment of the present invention, when the number of tasks queued by any scanning service domain changes, or when the number of resources contained in any scanning service domain changes, a step of resource scheduling is performed, that is, a step of determining the average time consumption of scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task is performed for each scanning service domain, thereby ensuring the timeliness of resource scheduling. At the same time, if the number of tasks queued by all scanning service domains has not changed, and the number of resources contained in all scanning service domains has not changed, resource scheduling is not performed at this time, thereby solving the problem of high system energy consumption caused by too frequent resource scheduling.

[0067] Embodiment 4:

[0068] On the basis of the above embodiments, in an embodiment of the present invention, after determining the second total time consumed by the scanning service domain to scan all tasks in the task flow, and before determining the target scanning service domain for which resources need to be increased according to the total time consumed by each scanning service domain to scan the queued tasks, the method further includes:

[0069] Determine a first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine a second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value;

[0070] Determine whether the second average value is greater than a preset duration threshold, and if so, proceed to subsequent steps.

[0071] In an embodiment of the present invention, after the electronic device determines the second total time consumed by the scanning service domain to scan all tasks in the task flow, before determining the target scanning service domain that needs to increase resources based on the total time consumed by each scanning service domain to scan the queued tasks, the electronic device determines the first average value of each second total time consumed based on the second total time consumed by each scanning service domain to scan all tasks in the task flow, and determines the second average value of the difference between each second total time consumed and the first average value based on each second total time consumed and the first average value. As shown in the formula As shown, the sum of the second total time consumed by each scanning service domain to scan all tasks in the task flow is calculated, and the ratio of the sum to the number of scanning service domains is calculated.

[0072] - as the first average value of each second total time consumption. In the formula, n represents the number of scanned service domains, and T represents the first average value of each second total time consumption. As shown in the formula As shown, the difference between each second total time consumption and the first average value is calculated, and then the ratio of the difference to the number of scanned service domains is used as the second average value, where M is the second average value.

[0073] The electronic device stores a preset duration threshold, such as 1 minute, 2 minutes, etc. It is determined whether the second average value is greater than the preset duration threshold. If so, a step is performed to determine a target scanning service domain for which resources need to be increased based on the total time taken to scan the queued tasks for each scanning service domain. If not, resource scheduling is not performed, thereby further solving the problem of high system energy consumption caused by too frequent resource scheduling.

[0074] Embodiment 5:

[0075] In order to make resource scheduling more reasonable, based on the above embodiments, in an embodiment of the present invention, scheduling resources to the target scanning service domain includes:

[0076] Determine whether there are idle resources in the idle resource pool. If yes, extract resources from the idle resource pool and transfer them to the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them to the target scanning service domain.

[0077] In an embodiment of the present invention, when scheduling resources to a target scanning service domain, the electronic device first determines whether there are idle resources in the idle resource pool. If so, resources are extracted from the idle resource pool and transferred to the target scanning service domain. If not, resources are extracted from the second scanning service domain with the smallest total time consumption and transferred to the target scanning service domain. It should be noted that when performing resource scheduling, the embodiment of the present invention can schedule one resource or two resources. Preferably, one resource can be scheduled each time. After scheduling the resources, the resource scheduling step is repeated.

[0078] Figure 2 A schematic diagram of the structure of a task flow scanning system provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, all the internal structures of the scanning service domain are the same as Figure 2 The internal structure of the A service domain is consistent. The task distribution end sends the task flow, which will pass through the A, B...G service domains in sequence and finally complete the overall task. The task flow scanning system also includes an idle resource pool, which includes server 1 to be allocated, server 2 to be allocated, server 3 to be allocated...server n to be allocated. Each service domain includes a queue, an internal scheduling end, and existing servers.

[0079] Embodiment 6:

[0080] Figure 3 A schematic diagram of the structure of a resource scheduling device provided in an embodiment of the present invention, the device comprising:

[0081] The first determination module 31 is used for determining, during the task flow scanning process, for each scanning service domain, an average time consumption of scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task; and determining a first total time consumption of scanning tasks being queued by the scanning service domain according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumption of scanning tasks of the scanning service domain;

[0082] The scheduling module 32 is used to determine a target scanning service domain that needs to increase resources according to the first total time consumed by each scanning service domain to scan the queued tasks, and schedule resources to the target scanning service domain.

[0083] The device also includes:

[0084] A second determining module 33 is used to determine, for each scanning service domain, a second total time consumed from the initiation of the task flow to scanning all tasks in the task flow of the scanning service domain according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks;

[0085] The scheduling module 32 is specifically used to determine the third total time consumed by the scanning service domain with the second largest total time consumption to scan the queued tasks, and the fourth total time consumed by the scanning service domain with the second smallest total time consumption to scan the queued tasks; determine whether the third total time consumption is greater than the fourth total time consumption, and if so, determine that the scanning service domain with the second largest total time consumption is the target scanning service domain that needs to increase resources.

[0086] The device also includes:

[0087] The judgment module 34 is used to judge whether the number of tasks queued in each scanning service domain has changed, and if so, trigger the first determination module 31; or judge whether the number of resources included in the scanning service domain has changed, and if so, trigger the first determination module 31.

[0088] The device also includes:

[0089] The third determination module 35 is used to determine the first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine the second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value; judge whether the second average value is greater than a preset duration threshold, and if so, trigger the second determination module 33.

[0090] The scheduling module 32 is specifically used to determine whether there are idle resources in the idle resource pool. If yes, extract resources from the idle resource pool and transfer them into the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them into the target scanning service domain.

[0091] Embodiment 7:

[0092] Based on the above embodiments, an electronic device is also provided in an embodiment of the present invention, such as Figure 4 As shown, it includes: a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304;

[0093] The memory 303 stores a computer program. When the program is executed by the processor 301, the processor 301 performs the following steps:

[0094] During the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, the average time consumed to scan the tasks of the scanning service domain is determined; according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, the first total time consumed to scan the tasks being queued by the scanning service domain is determined;

[0095] According to the first total time consumed by each scanning service domain to scan the queued tasks, a target scanning service domain that needs to increase resources is determined, and resources are scheduled to the target scanning service domain.

[0096] Based on the same inventive concept, an electronic device is also provided in an embodiment of the present invention. Since the principle of solving the problem by the above electronic device is similar to that of the resource scheduling method, the implementation of the above electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0097] The electronic device provided in the embodiment of the present invention may specifically be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), a network side device, etc.

[0098] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0099] The communication interface 302 is used for communication between the electronic device and other devices.

[0100] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0101] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0102] In the embodiment of the present invention, when the processor executes the program stored in the memory, in the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed for scanning each task, the average time consumed for scanning tasks of the scanning service domain is determined; according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumed for scanning tasks of the scanning service domain, the first total time consumed for scanning tasks being queued by the scanning service domain is determined; according to the first total time consumed for scanning tasks being queued by each scanning service domain, the target scanning service domain that needs to increase resources is determined, and resources are scheduled to the target scanning service domain. In the embodiment of the present invention, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed for scanning each task, the average time consumed for scanning tasks of the scanning service domain is determined, then according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumed for scanning tasks of the scanning service domain, the first total time consumed for scanning tasks being queued by the scanning service domain is determined, and finally according to the first total time consumed for scanning tasks being queued by each scanning service domain, the target scanning service domain that needs to increase resources is determined, and resources are scheduled to the target scanning service domain. In the embodiment of the present invention, resources are dispatched to the target scanning service domain according to the scanning task situation of each scanning service domain, thereby avoiding the situation where a large number of tasks are accumulated in a certain scanning service domain and shortening the time consumption of task processing.

[0103] Embodiment 8:

[0104] On the basis of the above embodiments, an embodiment of the present invention further provides a computer storage readable storage medium, wherein the computer readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:

[0105] During the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, the average time consumed to scan the tasks of the scanning service domain is determined; according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, the first total time consumed to scan the tasks being queued by the scanning service domain is determined;

[0106] According to the first total time consumed by each scanning service domain to scan the queued tasks, a target scanning service domain that needs to increase resources is determined, and resources are scheduled to the target scanning service domain.

[0107] Based on the same inventive concept, a computer-readable storage medium is also provided in an embodiment of the present invention. Since the principle of solving the problem when the processor executes the computer program stored on the above-mentioned computer-readable storage medium is similar to the resource scheduling method, the implementation of the processor when executing the computer program stored on the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.

[0108] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.

[0109] A computer program is stored in a computer-readable storage medium provided in an embodiment of the present invention. When the computer program is executed by a processor, during a task flow scanning process, for each scanning service domain, the average time consumed for scanning tasks of the scanning service domain is determined according to the number of scanning tasks completed by the scanning service domain and the time consumed for scanning each task; the first total time consumed for scanning queued tasks by the scanning service domain is determined according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed for scanning tasks by the scanning service domain; and a target scanning service domain that needs to increase resources is determined according to the first total time consumed for scanning queued tasks by each scanning service domain, and resources are scheduled to the target scanning service domain. In an embodiment of the present invention, for each scanning service domain, the average time consumption of scanning tasks of the scanning service domain is determined according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task, and then the first total time consumption of scanning tasks of the scanning service domain in queue is determined according to the number of tasks queued by the scanning service domain, the number of resources contained in the scanning service domain and the average time consumption of scanning tasks of the scanning service domain, and finally the target scanning service domain that needs to increase resources is determined according to the first total time consumption of scanning tasks in queue by each scanning service domain, and resources are dispatched to the target scanning service domain. In an embodiment of the present invention, resources are dispatched to the target scanning service domain according to the scanning task situation of each scanning service domain, thereby avoiding the situation where a large number of tasks are piled up in a certain scanning service domain and shortening the time consumption of task processing.

[0110] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0111] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0113] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0114] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A resource scheduling method, characterized in that: The method comprises: During the task flow scanning process, for each scanning service domain, according to the number of scanning tasks completed by the scanning service domain and the time consumed to scan each task, the average time consumed to scan the tasks of the scanning service domain is determined; according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumed to scan the tasks of the scanning service domain, the first total time consumed to scan the tasks being queued by the scanning service domain is determined; Determine a target scanning service domain that needs to increase resources according to a first total time consumed by each scanning service domain to scan the queued tasks, and schedule resources to the target scanning service domain; Before determining the target scanning service domain that needs to increase resources according to the first total time consumed by each scanning service domain to scan the queued tasks, the method further includes: For each scanning service domain, determine a second total time consumed by the scanning service domain from the initiation of the task flow to scanning all tasks in the task flow according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks; The determining, according to the first total time consumed by each scanning service domain to scan the queued tasks, of a target scanning service domain for which resources need to be increased comprises: Determine a third total time consumed by the scan service domain with the second largest total time consumption to scan the queued tasks, and a fourth total time consumed by the scan service domain with the second smallest total time consumption to scan the queued tasks; It is determined whether the third total time consumption is greater than the fourth total time consumption. If so, the scanning service domain with the largest second total time consumption is determined as the target scanning service domain that needs to increase resources.

2. The method according to claim 1, characterized in that Before determining, for each scanning service domain, the average time consumption of scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption of scanning each task, the method further includes: For each scanning service domain, determine whether the number of tasks queued by the scanning service domain has changed, and if so, proceed to subsequent steps; or determine whether the number of resources included in the scanning service domain has changed, and if so, proceed to subsequent steps.

3. The method according to claim 1, characterized in that After determining the second total time consumed by the scanning service domain to scan all tasks in the task flow, and before determining the target scanning service domain for which resources need to be increased according to the total time consumed by each scanning service domain to scan the queued tasks, the method further includes: Determine a first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine a second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value; Determine whether the second average value is greater than a preset duration threshold, and if so, proceed to subsequent steps.

4. The method according to claim 1, characterized in that The scheduling of resources to the target scanning service domain includes: Determine whether there are idle resources in the idle resource pool. If yes, extract resources from the idle resource pool and transfer them to the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them to the target scanning service domain.

5. A resource scheduling device, characterized in that: The device comprises: A first determination module is used to determine, during the task flow scanning process, for each scanning service domain, an average time consumption for scanning tasks of the scanning service domain according to the number of scanning tasks completed by the scanning service domain and the time consumption for scanning each task; and determine a first total time consumption for scanning tasks being queued by the scanning service domain according to the number of tasks queued by the scanning service domain, the number of resources included in the scanning service domain and the average time consumption for scanning tasks of the scanning service domain; A scheduling module, configured to determine a target scanning service domain that needs to increase resources according to a first total time consumed by each scanning service domain to scan the queued tasks, and schedule resources to the target scanning service domain; A second determination module is used to determine, for each scanning service domain, a second total time consumed by the scanning service domain from the initiation of the task flow to scanning all tasks in the task flow according to the length of time from the initiation of the task flow to the current moment, the number of tasks not scanned by the scanning service domain, the number of resources included in the scanning service domain, and the average time consumed by the scanning service domain to scan tasks; The scheduling module is specifically used to determine the third total time consumed by the scanning service domain with the second largest total time consumption to scan the queued tasks, and the fourth total time consumed by the scanning service domain with the second smallest total time consumption to scan the queued tasks; determine whether the third total time consumption is greater than the fourth total time consumption, and if so, determine that the scanning service domain with the second largest total time consumption is the target scanning service domain that needs to increase resources.

6. The device according to claim 5, characterized in that The device also includes: A judgment module is used to judge whether the number of tasks queued in each scanning service domain has changed, and if so, trigger the first determination module; or to judge whether the number of resources included in the scanning service domain has changed, and if so, trigger the first determination module.

7. The device according to claim 5, characterized in that The device also includes: The third determination module is used to determine the first average value of each second total time consumption according to the second total time consumption of each scanning service domain scanning all tasks in the task flow, and determine the second average value of the difference between each second total time consumption and the first average value according to each second total time consumption and the first average value; judge whether the second average value is greater than a preset duration threshold, and if so, trigger the second determination module.

8. The device according to claim 5, characterized in that The scheduling module is specifically used to determine whether there are idle resources in the idle resource pool. If so, extract resources from the idle resource pool and transfer them into the target scanning service domain. If not, extract resources from the second scanning service domain with the smallest total time consumption and transfer them into the target scanning service domain.

9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 4 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Task scheduling device and task scheduling method

    CN103488691A

  • Distributed system real-time task scheduling method, device and equipment and storage medium

    CN109710407A