Task processing method and device for cluster mode
By dynamically adjusting and allocating tasks, combined with device information and task processing speed, the problem of performance differences and uneven load of detection equipment in cluster mode is solved, achieving shorter detection time and more efficient task processing.
Patent Information
- Application Number
- CN202111278464.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-10-30
AI Technical Summary
When the existing cluster mode task allocation method handles scanning tasks across a large network segment, the detection time is uncontrollable due to different device performance and uneven task load. There are technical bottlenecks and cannot effectively reduce the idle time of detection equipment and user waiting time. .
By obtaining information about the task set and detection equipment, the detection task amount of each device is dynamically adjusted, and the dynamic attenuation function is used to allocate tasks. The tasks are proportioned according to the remaining detection number of the equipment and the task processing speed to ensure the flexibility and efficiency of task allocation. .
It effectively reduces the cumulative idle time of detection equipment, improves user experience, and ensures the efficiency and accuracy of task processing in dynamically changing application environments.
Smart Images

Figure CN114356513B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer information processing, and in particular, to a task processing method, device, electronic device and computer-readable medium for cluster mode. Background Art
[0002] In order to better discover and manage the massive assets in the network environment and detect the surviving assets in the network environment, we usually use detection equipment to help us complete the task. However, when the detection equipment processes the scanning task of a large network segment, it often takes a lot of time due to its performance limitations. Therefore, in the actual application environment, the cluster mode is usually used to complete the task with the help of multiple detection devices to minimize the time required to complete the task and improve the user experience.
[0003] In view of this, every time a new detection task request arrives, it is necessary to consider the operation and current load of all detection devices in the current cluster, split the detection targets and distribute them reasonably, so as to complete all tasks in the shortest time.
[0004] In actual situations, the detection devices in the cluster have different performances and are under different task load conditions. There are also uncertain and uncontrollable factors in system communication that affect the actual required scanning time. The cluster task allocation method in the existing technology has technical bottlenecks.
[0005] Therefore, a new task processing method, device, electronic device and computer-readable medium for cluster mode are needed.
[0006] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0007] In view of this, the present disclosure provides a task processing method, apparatus, electronic device and computer-readable medium for a cluster mode, which takes into account the dynamic changes in the operating conditions of each device in the actual application environment, dynamically adjusts the detection task volume of each device according to the computing power of the current device, eliminates the impact of some uncontrollable factors on the results, reduces the cumulative idle time of all detection devices, and spends a shorter detection time to improve user experience.
[0008] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0009] According to one aspect of the present disclosure, a task processing method for a cluster mode is proposed, the method comprising: obtaining a task set, the task set including a plurality of tasks to be processed; obtaining the number of a plurality of detection devices in the cluster and a plurality of device information; determining a plurality of remaining detection numbers corresponding to the plurality of detection devices based on the plurality of device information; determining a task ratio corresponding to the plurality of detection devices based on the plurality of device information and the plurality of remaining detection numbers; extracting a portion of the tasks to be processed from the task set and allocating them to the plurality of detection devices for task processing according to the task ratio.
[0010] In an exemplary embodiment of the present disclosure, the method further includes: monitoring the task processing status of the plurality of detection devices, and re-assigning tasks when there are idle detection devices.
[0011] In an exemplary embodiment of the present disclosure, obtaining a task set includes: when obtaining a new task request, generating a task set according to all tasks in a task queue to be processed.
[0012] In an exemplary embodiment of the present disclosure, obtaining the number of multiple detection devices in a cluster and multiple device information includes: obtaining the number of the multiple detection devices; obtaining the remaining detection number, the number of tasks in the last task set and the task processing time of each detection device in the multiple detection devices.
[0013] In an exemplary embodiment of the present disclosure, task ratios corresponding to the multiple detection devices are determined based on the multiple device information and the multiple remaining detection numbers, including: determining the task processing speed of the multiple devices based on the number of tasks and the task processing time of the previous task set of the multiple device information; and determining multiple task ratios of the multiple devices according to the task processing speed and the remaining detection number.
[0014] In an exemplary embodiment of the present disclosure, some tasks to be processed are extracted from the task set and allocated to the multiple detection devices for task processing according to the task ratio, including: extracting some tasks to be processed from the task set based on a dynamic attenuation function; dividing the tasks to be processed into multiple subsets according to the task ratio; and allocating the multiple subsets to the multiple detection devices for processing.
[0015] In an exemplary embodiment of the present disclosure, some tasks to be processed are extracted from the task set based on a dynamic attenuation function, including: generating the number of tasks to be extracted based on the number of all tasks to be processed in the task set and the number of multiple detection devices; and extracting some tasks to be processed from the task set based on the number of tasks to be extracted.
[0016] In an exemplary embodiment of the present disclosure, dividing the tasks to be processed into a plurality of subsets according to the task allocation ratio includes: dividing the tasks to be processed into a plurality of subsets according to the task allocation ratio and the IP address.
[0017] In an exemplary embodiment of the present disclosure, some tasks to be processed are extracted from the task set and allocated to the multiple detection devices for task processing according to the task ratio, and also include: after the tasks to be processed this time are processed, some tasks to be processed are extracted again and allocated to the multiple detection devices for task processing according to the task ratio until all tasks are processed.
[0018] According to one aspect of the present disclosure, a task processing device for a cluster mode is proposed, the device comprising: a task module, used to obtain a task set, the task set including a plurality of tasks to be processed; an information module, used to obtain the number of a plurality of detection devices in the cluster and a plurality of device information; a quantity module, used to determine a plurality of remaining detection numbers corresponding to the plurality of detection devices based on the plurality of device information; a ratio module, used to determine the task ratio corresponding to the plurality of detection devices based on the plurality of device information and the plurality of remaining detection numbers; and an allocation module, used to extract a portion of the tasks to be processed from the task set and allocate them to the plurality of detection devices for task processing according to the task ratio.
[0019] According to one aspect of the present disclosure, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described above.
[0020] According to one aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described above is implemented.
[0021] According to the task processing method, device, electronic device and computer-readable medium for cluster mode disclosed in the present invention, a task set is obtained, wherein the task set includes multiple tasks to be processed; the number of multiple detection devices in the cluster and multiple device information are obtained; based on the multiple device information, multiple remaining detection numbers corresponding to the multiple detection devices are determined; based on the multiple device information and the multiple remaining detection numbers, the task ratio corresponding to the multiple detection devices is determined; a part of the tasks to be processed is extracted from the task set and allocated to the multiple detection devices for task processing according to the task ratio, taking into account the dynamic changes in the operating conditions of each device in the actual application environment, the detection task amount of each device is dynamically adjusted according to the computing power of the current device, thereby eliminating the influence of some uncontrollable factors on the results, reducing the cumulative idle time of all detection devices, and spending a shorter detection time to improve user experience.
[0022] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail its exemplary embodiments with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present disclosure, and it is clear to a person skilled in the art that other accompanying drawings can be obtained from these accompanying drawings without creative work.
[0024] Figure 1 The present invention is a system block diagram showing a method and device for processing tasks in a cluster mode according to an exemplary embodiment.
[0025] Figure 2 The figure is a flowchart of a task processing method for cluster mode according to an exemplary embodiment.
[0026] Figure 3 is a flowchart of a task processing method for cluster mode according to another exemplary embodiment.
[0027] Figure 4 is a flowchart of a task processing method for cluster mode according to another exemplary embodiment.
[0028] Figure 5 The figure is a block diagram showing a task processing device for cluster mode according to an exemplary embodiment.
[0029] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0030] Figure 7It is a block diagram of a computer-readable medium according to an exemplary embodiment. DETAILED DESCRIPTION
[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0032] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0035] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the disclosed concepts. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0036] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present disclosure, and therefore cannot be used to limit the protection scope of the present disclosure.
[0037] There are only two cluster task allocation methods in the prior art, namely, the equal division method and the weighted round-robin method.
[0038] The working mechanism of the equal division method is as follows:
[0039] 1. A new task request arrives, and the total number of IPs that need to be detected for this task is M;
[0040] 2. Get the number N of available nodes in the current system;
[0041] 3. Divide the target M into N equal parts, each part is m;
[0042] 4. Split M according to the m obtained in step 3 and assign it to each node.
[0043] The above four steps ensure that even when the system accepts a new detection task request or there are multiple tasks in the same time period, the task load borne by each detection device is equal.
[0044] The weighted round-robin method works as follows:
[0045] 1. A new task request arrives, and the total number of IPs that need to be detected for this task is M;
[0046] 2. Get the number N of available nodes in the current system;
[0047] 3. Assign different weights to devices according to their performance, and divide the target M into N parts based on this, each part is Mi;
[0048] 4. Split M according to Mi obtained in step 3 and assign it to each node.
[0049] Taking into account the performance differences of different devices, higher weights are assigned to high-performance detection devices to allocate more detection targets, thereby reducing the overall time to complete the task and reducing user waiting time.
[0050] The inventor of the present disclosure found that the methods in the prior art are all static allocation methods, which directly split the target task and allocate it at one time, and have low flexibility. Both of the above methods do not take into account the current task load of the device in the actual application environment. The operation status and computing power of the device are dynamically changing, and the influence of variables on the results should be weakened. In the actual application environment, due to the existence of uncontrollable and unmeasurable factors, for Mi of the same size, the time spent may be different even under the condition of ensuring the same control variable conditions. For example, for the same device, since there are two situations of survival and non-survival in the target IP segment allocated each time, the unit detection time required for each device is different; and the proportion of the number of surviving assets in the target range is unknown, so the actual time spent will vary according to the actual situation, resulting in a difference between the current queue size of each detection device and the estimated value. Therefore, if the system has currently received multiple detection tasks and is in an unfinished state, this difference will not be estimated; if the target range of the secondary detection is large, this difference will be magnified.
[0051] In view of the technical bottlenecks in the prior art, the present disclosure proposes a task processing method for a cluster mode, which can comprehensively consider the different performances and different loads of the detection devices in the cluster and appropriately allocate tasks.
[0052] Figure 1 The present invention is a system block diagram showing a method and device for processing tasks in a cluster mode according to an exemplary embodiment.
[0053] like Figure 1 As shown, the system architecture 10 may include detection devices 101, 102, 103, a network 104, and a task allocation server 105. The network 104 is used to provide a medium for communication links between the detection devices 101, 102, 103 and the task allocation server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0054] Testing equipment 101,102,103 and task allocation server 105 can constitute a server cluster, and server cluster refers to that many servers are gathered together to carry out the same service together, and it seems that there is only one server in the client. Cluster can utilize multiple computers to carry out parallel computing to obtain very high computing speed, and can also use multiple computers to do backup, so that any machine is broken and the whole system can still operate normally. Once the cluster service is installed and run on the server, the server can join the cluster. Cluster operation can reduce the number of single point failures, and realizes the high availability of cluster resources. Inside the server cluster, testing equipment 101,102,103 interacts with task allocation server 105 through network 104, to receive or send tasks, etc.
[0055] The task allocation server 105 can be a single server providing task allocation, or any detection device in the server cluster. The task allocation server 105 can be a physical server, or can be composed of multiple servers.
[0056] The task allocation server 105 may, for example, obtain a task set, which includes multiple tasks to be processed; the task allocation server 105 may, for example, obtain the number of multiple detection devices in the cluster and multiple device information; the task allocation server 105 may, for example, determine multiple remaining detection numbers corresponding to the multiple detection devices based on the multiple device information; the task allocation server 105 may, for example, determine the task ratio corresponding to the multiple detection devices based on the multiple device information and the multiple remaining detection numbers; the task allocation server 105 may, for example, extract some tasks to be processed from the task set and allocate them to the multiple detection devices for task processing according to the task ratio.
[0057] The task allocation server 105 may also monitor the task processing status of the plurality of detection devices, and re-allocate tasks when there are idle detection devices.
[0058] It should be noted that the task processing method for cluster mode provided in the embodiment of the present disclosure may be executed by the task allocation server 105 , and accordingly, the task processing device for cluster mode may be arranged in the task allocation server 105 .
[0059] Figure 2 The flowchart of a task processing method for cluster mode according to an exemplary embodiment is shown. The task processing method 20 for cluster mode at least includes steps S202 to S210.
[0060] like Figure 2 As shown, in S202, a task set is obtained, wherein the task set includes a plurality of tasks to be processed. When a new task request is obtained, a task set can be generated based on all tasks in the task queue to be processed.
[0061] The tasks in the task set can be tasks of different types and application scenarios, such as data cleaning tasks, data analysis tasks, data processing tasks, etc. The pending tasks in the task set can be tasks in the task processing queue. When a new task arrives, all tasks in the current task queue can be obtained and a new round of task allocation can be performed.
[0062] More specifically, when a new task request enters the queue, the set of all pending IPs in the queue is defined as A; if there is no task request in the queue, the process ends and exits; if there are unprocessed task requests in the queue, tasks are assigned.
[0063] In S204, the number of multiple detection devices in the cluster and multiple device information are obtained, including: obtaining the number of the multiple detection devices; obtaining the remaining detection number, the number of tasks in the last task set and the task processing time of each detection device in the multiple detection devices.
[0064] More specifically, the number of all current detection devices can be defined as n, and their operating status can be obtained, including: the number of remaining detection IPs L, the number set C of IPs that completed the detection scan in the most recent round of tasks, and the required time set T.
[0065] In S206, a plurality of remaining detection numbers corresponding to the plurality of detection devices are determined based on the plurality of device information.
[0066] In S208, the task ratios corresponding to the multiple detection devices are determined based on the multiple device information and the multiple remaining detection numbers, including: determining the task processing speed of the multiple devices based on the task number and task processing time of the previous task set of the multiple device information; and determining the multiple task ratios of the multiple devices according to the task processing speed and the remaining detection number.
[0067] According to the number of IPs L remaining to be detected in the step, some elements of the subset S of set A can be taken as the set of IPs to be processed in this batch. According to the ratio, the set of IP numbers Ri that each detection device should process in this batch can be obtained.
[0068] In S210, some tasks to be processed are extracted from the task set and allocated to the multiple detection devices for task processing according to the task ratio. It also includes: after the current tasks to be processed are processed, some tasks to be processed are extracted again and allocated to the multiple detection devices for task processing according to the task ratio until all tasks are processed.
[0069] In one embodiment, for example, the task processing status of the plurality of detection devices may be monitored, and when there are idle detection devices, the tasks may be allocated again.
[0070] The IP set S of some tasks to be processed in this batch is split according to the sub-elements Ri (where i=1, 2, 3...n) of the ratio R; the split sub-IP set is sent to each detection device; the task execution status of each detection device is monitored, and when a detection device is idle, the task is assigned again.
[0071] According to the task processing method for cluster mode disclosed in the present invention, a task set is obtained, wherein the task set includes multiple tasks to be processed; the number of multiple detection devices in the cluster and multiple device information are obtained; multiple remaining detection numbers corresponding to the multiple detection devices are determined based on the multiple device information; the task ratio corresponding to the multiple detection devices is determined based on the multiple device information and the multiple remaining detection numbers; a part of the tasks to be processed are extracted from the task set and allocated to the multiple detection devices for task processing according to the task ratio, taking into account the dynamic changes in the operating conditions of each device in the actual application environment, the detection task amount of each device is dynamically adjusted according to the computing power of the current device, thereby eliminating the influence of some uncontrollable factors on the results, reducing the cumulative idle time of all detection devices, and spending a shorter detection time to improve user experience.
[0072] It should be clearly understood that the present disclosure describes how to form and use specific examples, but the principles of the present disclosure are not limited to any details of these examples. On the contrary, based on the teachings of the contents disclosed in the present disclosure, these principles can be applied to many other embodiments.
[0073] Figure 3 is a flowchart of a task processing method for cluster mode according to another exemplary embodiment. Figure 3 The process 30 shown is for Figure 2 A detailed description of S208 "determining the task ratios corresponding to the multiple detection devices based on the multiple device information and the multiple remaining detection numbers" in the process shown.
[0074] The algebraic definitions in this embodiment are described as follows:
[0075] ①A: The set of all IPs in the current batch queue. The number of elements in this set is defined as a;
[0076] ②n: the number of all available testing equipment in the current batch system;
[0077] ③L: The set of the remaining number of IPs to be scanned for each detection device in the current batch, satisfying Li∈L(i=1,2,3...n);
[0078] ④C: The set of the number of completed scanned IPs of each detection device in the previous batch, satisfying Ci∈C (i=1,2,3...n);
[0079] ⑤T: The set of time required to complete the scan of each detection device in the previous batch, satisfying Ti∈T (i=1,2,3...n);
[0080] ⑥S: The set of IP numbers to be scanned in the current batch. The number of elements in this set is defined as s;
[0081] ⑦R: The set of IP numbers to be scanned by each detection device in the current batch, satisfying Ri∈R (i=1,2,3...n) and
[0082] like Figure 3 As shown, in S302, the number of tasks to be extracted is generated based on the number of all tasks to be processed in the task set and the number of multiple detection devices.
[0083] S i Calculation of (i is the current round index, j is the detection device index)
[0084] Considering the communication loss, it is experimentally measured that the number of detection devices n can be taken as the batch number, that is:
[0085]
[0086] In order to ensure the effect of dynamic regulation, it is considered to introduce an attenuation model to S i Calculate, that is, S i The value of is constantly decaying, and the present invention uses linear decay to calculate S i , whose expression is:
[0087]
[0088] R ij Calculation of (i is the current round index, j is the detection device index)
[0089] The scanning speed of each device can be calculated based on C and T:
[0090]
[0091] In S304, some tasks to be processed are extracted from the task set based on the number of tasks to be extracted and the dynamic decay function.
[0092] The ratio of the number of tests can be calculated based on the speed ratio of the test equipment. Combined with the number of remaining units in the current queue, the following formula can be obtained:
[0093]
[0094] Based on the above formula, we get:
[0095]
[0096] The above formula is the number of targets that need to be allocated to each detection device in each round. ij <0, take R ij =0.
[0097] In S306, the tasks to be processed are divided into a plurality of subsets according to the task allocation ratio. The tasks to be processed are divided into a plurality of subsets according to the task allocation ratio and the IP address.
[0098] In S308, the plurality of subsets are allocated to the plurality of detection devices for processing.
[0099] The task processing method for cluster mode disclosed in the present invention is combined with the following technical means: each detection task undergoes two rounds of splitting; the first round of splitting processes the single detection task in batches according to the total amount of tasks; the second round of splitting is dynamically adjusted according to the current operation of each detection device to complete the calculation; the batch processing process uses a linear attenuation model to calculate and obtain the total amount that needs to be sent down for each batch; the algorithm used for dynamic adjustment of calculation can be achieved: in the cluster mode, the total task amount of the IP set that needs to be detected for each task is split into batches and entered into the task queue for sending; the process of sending to each monitoring device is dynamically adjusted according to the actual collected parameters to reduce the accumulated idle time of all detection devices.
[0100] Figure 4 is a flowchart of a task processing method for cluster mode according to another exemplary embodiment. Figure 4 The process 40 shown is for Figure 2 Detailed description of S102 "" in the process shown.
[0101] like Figure 4 As shown, in S401, a new task enters the queue.
[0102] In S402, whether there is a task request in the current queue.
[0103] In S404, end.
[0104] In S404, the device information of the detection device is obtained.
[0105] In S405, the ratio and the distribution quantity are calculated.
[0106] In S406, the task set is split according to the calculation results.
[0107] In S407, tasks are issued to various detection devices according to the splitting results.
[0108] In S408, when the detection device completes all tasks, it enters an idle state.
[0109] The task processing method for cluster mode disclosed in the present invention is an algorithm for splitting the detection task range in cluster mode. It takes into account the dynamic changes in the operating conditions of each device in the actual application environment, and dynamically adjusts the detection task amount of each device according to the computing power of the current device, thereby eliminating the impact of some uncontrollable factors on the results, reducing the cumulative idle time of all detection devices, and spending a shorter detection time to improve user experience.
[0110] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a CPU. When the computer program is executed by the CPU, the above functions defined by the above method provided by the present disclosure are performed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0111] In addition, it should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0112] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0113] Figure 5 FIG. 1 is a block diagram of a task processing device for cluster mode according to an exemplary embodiment. Figure 5 As shown, the task processing device 50 for cluster mode includes: a task module 502 , an information module 504 , a quantity module 506 , a ratio module 508 , and an allocation module 510 .
[0114] The task module 502 is used to obtain a task set, which includes a plurality of tasks to be processed. The task module 502 is also used to generate a task set according to all tasks in the task queue to be processed when obtaining a new task request.
[0115] The information module 504 is used to obtain the number of multiple detection devices in the cluster and multiple device information; the information module 504 is also used to obtain the number of the multiple detection devices;
[0116] The remaining number of detections, the number of tasks in the last task set, and the task processing time of each detection device in the multiple detection devices are obtained.
[0117] The quantity module 506 is used to determine a plurality of remaining detection numbers corresponding to the plurality of detection devices based on the plurality of device information;
[0118] The matching module 508 is used to determine the task matching corresponding to the plurality of detection devices based on the plurality of device information and the plurality of remaining detection numbers; the matching module 508 is also used to determine the task processing speed of the plurality of devices based on the number of tasks and the task processing time of the last task set of the plurality of device information;
[0119] The task ratios of the plurality of devices are determined according to the task processing speed and the remaining detection number.
[0120] The allocation module 510 is used to extract some tasks to be processed from the task set and allocate them to the multiple detection devices for task processing according to the task ratio. The allocation module 510 is also used to extract some tasks to be processed again after the current tasks to be processed are processed and allocate them to the multiple detection devices for task processing according to the task ratio until all tasks are processed.
[0121] According to the task processing device for cluster mode disclosed in the present invention, by obtaining a task set, the task set includes multiple tasks to be processed; obtaining the number of multiple detection devices in the cluster and multiple device information; determining multiple remaining detection numbers corresponding to the multiple detection devices based on the multiple device information; determining the task ratio corresponding to the multiple detection devices based on the multiple device information and the multiple remaining detection numbers; extracting some tasks to be processed from the task set and allocating them to the multiple detection devices for task processing according to the task ratio, the method can take into account the dynamic changes in the operation status of each device in the actual application environment, dynamically adjust the detection task amount of each device according to the computing power of the current device, eliminate the influence of some uncontrollable factors on the results, reduce the cumulative idle time of all detection devices, and spend a shorter detection time to improve user experience.
[0122] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment.
[0123] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present disclosure is described. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0124] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.
[0125] The storage unit stores a program code, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps described in this specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 610 can perform the following steps: Figure 2 , Figure 3 , Figure 4 Follow the steps shown in .
[0126] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0127] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0128] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0129] The electronic device 600 may also communicate with one or more external devices 600' (e.g., keyboards, pointing devices, Bluetooth devices, etc.) to enable a user to communicate with the electronic device 600, and / or any device (e.g., routers, modems, etc.) that the electronic device 600 can communicate with one or more other computing devices. Such communication may be performed via an input / output (I / O) interface 650. In addition, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0130] Through the above description of the implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by combining software with necessary hardware. Figure 7As shown, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes a number of instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the embodiment of the present disclosure.
[0131] The software product may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or component of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0132] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0133] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0134] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the following functions: obtaining a task set, which includes multiple tasks to be processed; obtaining the number of multiple detection devices in the cluster and multiple device information; determining multiple remaining detection numbers corresponding to the multiple detection devices based on the multiple device information; determining the task ratio corresponding to the multiple detection devices based on the multiple device information and the multiple remaining detection numbers; extracting some tasks to be processed from the task set and allocating them to the multiple detection devices for task processing according to the task ratio. The computer-readable medium can also implement the following functions: monitoring the task processing status of the multiple detection devices, and re-assigning tasks when there are idle detection devices.
[0135] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0136] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0137] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A task processing method for cluster mode, characterized in that: include: Obtaining a task set, wherein the task set includes a plurality of tasks to be processed; Obtaining the number of multiple detection devices in the cluster and multiple device information, including: obtaining the number of the multiple detection devices, and obtaining the remaining detection number, the number of tasks in the last task set, and the task processing time of each detection device in the multiple detection devices; Determine a plurality of remaining detection numbers corresponding to the plurality of detection devices based on the plurality of device information; Determining task ratios corresponding to the plurality of detection devices based on the plurality of device information and the plurality of remaining detection numbers includes: determining task processing speeds of the plurality of devices based on the number of tasks and task processing time of the last task set of the plurality of device information, and determining a plurality of task ratios of the plurality of devices according to the task processing speed and the remaining detection number; A portion of tasks to be processed is extracted from the task set and allocated to the plurality of detection devices for task processing according to the task ratio.
2. The method according to claim 1, characterized in that Also includes: The task processing status of the plurality of detection devices is monitored, and when there are idle detection devices, the tasks are allocated again.
3. The method according to claim 1, characterized in that Get a collection of tasks, including: When a new task request is obtained, a task set is generated based on all tasks in the task queue to be processed.
4. The method according to claim 1, characterized in that Extracting some tasks to be processed from the task set and allocating them to the plurality of detection devices for task processing according to the task ratio includes: Extracting some tasks to be processed from the task set based on a dynamic attenuation function; Divide the tasks to be processed into multiple subsets according to the task allocation; The plurality of subsets are assigned to the plurality of detection devices for processing.
5. The method according to claim 4, characterized in that Extracting some tasks to be processed from the task set based on a dynamic attenuation function includes: Generate the number of tasks to be extracted based on the number of all tasks to be processed in the task set and the number of multiple detection devices; A portion of the tasks to be processed is extracted from the task set based on the number of tasks to be extracted and a dynamic decay function.
6. The method according to claim 4, characterized in that The tasks to be processed are divided into multiple subsets according to the task distribution ratio, including: The tasks to be processed are divided into multiple subsets according to the task ratio and IP address.
7. The method according to claim 1, characterized in that Extracting some tasks to be processed from the task set and allocating them to the plurality of detection devices for task processing according to the task ratio, further comprising: After the tasks to be processed this time are processed, some of the tasks to be processed are extracted again and allocated to the plurality of detection devices for task processing according to the task ratio until all the tasks are processed.
8. A task processing device for cluster mode, characterized in that: include: A task module, used to obtain a task set, wherein the task set includes a plurality of tasks to be processed; An information module, used to obtain the number of multiple detection devices in the cluster and multiple device information, including: obtaining the number of the multiple detection devices, and obtaining the remaining detection number of each detection device in the multiple detection devices, the number of tasks in the last task set, and the task processing time; A quantity module, used for determining a plurality of remaining detection numbers corresponding to the plurality of detection devices based on the plurality of device information; A matching module, used to determine the task matching corresponding to the plurality of detection devices based on the plurality of device information and the plurality of remaining detection numbers, including: determining the task processing speed of the plurality of devices based on the number of tasks and the task processing time of the last task set of the plurality of device information, and determining the plurality of task matchings of the plurality of devices according to the task processing speed and the remaining detection number; The allocation module is used to extract some tasks to be processed from the task set and allocate them to the multiple detection devices for task processing according to the task ratio.
Citation Information
Patent Citations
Self-adaptive rate control method for stream data processing
CN106648904A
A job scheduling method and apparatus
CN109189581A
Task assignment method, device, apparatus, and storage medium
CN109345108A
Dynamic weight load balancing method based on Nginx
CN111381971A
Method for quality of service controllable real-time scheduling
US20020165754A1
