Task processing method, device, computer equipment and storage medium

By dynamically adjusting the number of hosts and load judgment, the problem of lack of dynamic distributed current limit in the task processing system in the prior art is solved, and flexible adjustment of task processing capabilities and guaranteeing other task processing efficiency is achieved.

CN111737005BActive Publication Date: 2024-12-10CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010621795.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-12-10
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

The existing task processing system lacks a dynamic distributed current limiting solution, and cannot allocate new tasks in a timely manner while ensuring the normal processing of other tasks. The current limiting configuration is usually for a single host, and lacks dynamic adjustment capabilities.

Method used

By obtaining the target task type of new tasks, dynamically adjusting the number of hosts thresholds, judging the host load based on CPU usage and memory usage, and adjusting task allocation to ensure that new tasks are reasonably allocated and processed without affecting the processing efficiency of other tasks.

Benefits of technology

It realizes that when adding new task processing, it can dynamically adjust the server task processing capabilities without manual configuration, supports task processing, and maintains the processing efficiency of other tasks and avoids host performance overload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111737005B_ABST
    Figure CN111737005B_ABST
Patent Text Reader

Abstract

The present application relates to the field of distributed deployment, and provides a task processing method, apparatus, computer equipment, and storage medium, including: obtaining the target task type of a newly added task; obtaining the number of hosts currently processing tasks of the target task type, and determining whether a preset first threshold is reached; if reached, obtaining the first CPU usage rate and the first memory usage rate of each host, and obtaining the first average processing time of tasks currently processing each other task type, and determining whether the first CPU usage rate and the first memory usage rate of each host are both less than the corresponding threshold; if both are less than, increasing the first threshold in turn, so that the number of hosts currently processing tasks of the target task type is less than the increased first threshold, and assigning the newly added task to one of the hosts for processing. When processing newly added tasks, the present application allows the server to actively adjust the task processing capacity without manual configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distributed deployment, and in particular to a task processing method, apparatus, computer equipment and storage medium. Background Art

[0002] At present, in the task platform, in order to ensure that the processing capacity of tasks is not affected, it is usually necessary to limit the flow during task processing, that is, to limit the number of tasks processed simultaneously. The current flow limiting scheme usually limits the flow of the provided services and external calls through semaphores and thread pools, and these schemes usually configure and limit the flow of a single host, lacking a dynamic distributed dynamic flow limiting scheme. At the same time, when adding new tasks, it is impossible to allocate and process the new tasks in a timely manner while ensuring the normal processing of other tasks. Summary of the invention

[0003] The main purpose of this application is to provide a task processing method, apparatus, computer equipment and storage medium, aiming to overcome the defect that dynamic current limiting cannot be performed during current task processing.

[0004] To achieve the above purpose, the present application provides a task processing method, comprising the following steps:

[0005] Get the target task type of the newly added task;

[0006] Obtaining the number of hosts currently processing tasks of the target task type, and determining whether the number of hosts reaches a preset first threshold;

[0007] If reached, obtain the first CPU usage and the first memory usage of each host, and obtain the first average processing time of each task of the other task type currently being processed, and determine whether the first CPU usage and the first memory usage of each host are both less than the corresponding threshold value;

[0008] If they are all smaller than the corresponding thresholds, the first thresholds are adjusted up in sequence so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and the newly added task is assigned to one of the hosts for processing;

[0009] Obtaining again a second CPU usage rate and a second memory usage rate of each of the hosts, and again obtaining a second average processing time for processing tasks of each other task type;

[0010] If the second CPU usage or the second memory usage of any of the hosts reaches the corresponding threshold, or the second average processing time of any other task type is greater than the first average processing time, stop increasing the first threshold.

[0011] Furthermore, the step of obtaining the target task type of the newly added task includes:

[0012] Obtaining an attribute expression of the newly added task, and obtaining an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code;

[0013] Input the task department code, task processing matter code, task importance code and task processing time code into the mapping script respectively, and output the first score, second score, third score and fourth score corresponding to the task department code, task processing matter code, task importance code and task processing time code respectively; wherein the mapping script stores the corresponding relationship between attribute code and score;

[0014] Performing weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task;

[0015] According to the mapping relationship between the total score and the target task type, the target task type of the newly added task is obtained.

[0016] Furthermore, after the step of obtaining the target task type of the newly added task, the following steps are included:

[0017] Obtaining the data volume of the newly added task, and comparing the data volume with the preset data volume;

[0018] If the data volume of the newly added task is less than the preset data volume, the newly added task is stored in the first folder; if the data volume of the newly added task is not less than the preset data volume, the newly added task is stored in the second folder;

[0019] A data table is created, and after each newly added task is stored, a corresponding relationship between the task name and the storage folder of each newly added task is constructed in the data table.

[0020] Furthermore, the newly added task includes a plurality of text messages; after the step of obtaining the target task type of the newly added task, the following steps are included:

[0021] Create a blank layer;

[0022] Sorting the plurality of text messages according to a preset order, and obtaining the number of the text messages, and obtaining the number of characters in each text message;

[0023] Dividing a plurality of target areas corresponding to the number of items in the blank layer, and establishing a one-to-one mapping relationship between the text information and the target areas;

[0024] Adding each of the sorted text information to the target area having a one-to-one mapping relationship;

[0025] Calculating a first ratio of the number of characters in all the sorted text messages according to the number of characters in each of the sorted text messages;

[0026] Dividing a preset seal into sub-seals corresponding to the number of pieces of text information, and the area ratio of each of the sub-seals is the same as the first ratio;

[0027] Each of the sub-seals is added to the target area where the corresponding text information is located, and the sub-seals, text information and the blank layer are synthesized to obtain a task picture, which is then stored.

[0028] Furthermore, after the step of synthesizing the sub-stamp, text information and the blank layer to obtain the task picture, the following steps are included:

[0029] creating a copy of said task picture;

[0030] Converting a copy of the task image into a string, and adding the string to an array to generate a character group;

[0031] Performing hash calculation on the character group to obtain a hash value;

[0032] The task image is encrypted using the hash value.

[0033] The present application also provides a task processing device, comprising:

[0034] A first acquisition unit, used to acquire a target task type of a newly added task;

[0035] A second acquisition unit is used to acquire the number of hosts currently processing tasks of the target task type, and determine whether the number of hosts reaches a preset first threshold;

[0036] A third acquisition unit is used to obtain the first CPU usage rate and the first memory usage rate of each host at present, and obtain the first average processing time of the task of each other task type currently being processed, and determine whether the first CPU usage rate and the first memory usage rate of each host are both less than the corresponding threshold value;

[0037] an allocating unit, configured to increase the first threshold in sequence if all of them are smaller than the corresponding threshold, so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and allocate the newly added task to one of the hosts for processing;

[0038] a fourth acquisition unit, configured to again acquire a second CPU usage rate and a second memory usage rate of each of the hosts, and again acquire a second average processing time for processing tasks of each other task type;

[0039] The stopping unit is used to stop increasing the first threshold if the second CPU usage rate or the second memory usage rate of any of the hosts reaches the corresponding threshold, or the second average processing time of any other task type is greater than the first average processing time.

[0040] Furthermore, the first acquisition unit includes:

[0041] An acquisition subunit is used to acquire an attribute expression of the newly added task, and acquire an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code;

[0042] A scoring subunit is used to input the task department code, task processing matter code, task importance code and task processing time code into a mapping script respectively, and output a first score, a second score, a third score and a fourth score corresponding to the task department code, the task processing matter code, the task importance code and the task processing time code respectively; wherein the mapping script stores a corresponding relationship between attribute code and score;

[0043] a calculation subunit, configured to perform a weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task;

[0044] The determination subunit is used to obtain the target task type of the newly added task according to the mapping relationship between the total score and the target task type.

[0045] Furthermore, it also includes:

[0046] A fifth acquiring unit, configured to acquire the data volume of the newly added task and compare the data volume with a preset data volume;

[0047] A first storage unit is used to store the newly added task in a first folder if the data volume of the newly added task is less than a preset data volume; and to store the newly added task in a second folder if the data volume of the newly added task is not less than the preset data volume;

[0048] The construction unit is used to create a data table, and after storing each newly added task, construct a corresponding relationship between the task name and the storage folder of each newly added task in the data table.

[0049] Furthermore, it also includes:

[0050] Create a unit to create a blank layer;

[0051] A sorting unit, used to sort the plurality of text messages according to a preset order, and obtain the number of the text messages, and the number of characters in each text message;

[0052] An establishing unit, used for dividing the blank layer into a plurality of target areas corresponding to the number of strips, and establishing a one-to-one mapping relationship between the text information and the target areas;

[0053] A first adding unit, used for adding each of the sorted text information to the target area having a one-to-one mapping relationship;

[0054] a ratio calculation unit, configured to calculate a first ratio of the number of characters in all the text messages according to the number of characters in each of the sorted text messages;

[0055] A segmentation unit, used for segmenting a preset seal into sub-seals corresponding to the number of pieces of text information, and the area ratio of each of the sub-seals is the same as the first ratio;

[0056] The second adding unit is used to add each of the sub-seals to the target area where the corresponding text information is located, and synthesize the sub-seals, text information and the blank layer to obtain a task picture, and store it.

[0057] Furthermore, the second adding unit is further used for:

[0058] creating a copy of said task picture;

[0059] Converting a copy of the task image into a string, and adding the string to an array to generate a character group;

[0060] Performing hash calculation on the character group to obtain a hash value;

[0061] The task image is encrypted using the hash value.

[0062] The present application also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.

[0063] The present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.

[0064] The task processing method, apparatus, computer equipment and storage medium provided in the present application include: obtaining a target task type of a newly added task; obtaining the number of hosts currently processing tasks of the target task type, and determining whether the number of hosts reaches a preset first threshold; if so, obtaining a first CPU usage rate and a first memory usage rate of each host currently processing tasks of each other task type, and obtaining a first average processing time of tasks currently processing each other task type, and determining whether the first CPU usage rate and the first memory usage rate of each host are both less than a corresponding threshold; if both are less than the corresponding threshold, increasing the first threshold in sequence so that the number of hosts currently processing tasks of the target task type is less than the increased first threshold, and allocating the newly added task to one host for processing; obtaining a second CPU usage rate and a second memory usage rate of each host again, and obtaining a second average processing time of tasks processing each other task type again; if the second CPU usage rate or the second memory usage rate of any host reaches the corresponding threshold, or the second average processing time of tasks of any other task type is greater than the first average processing time, stopping increasing the first threshold. When processing new tasks, this application allows the server to actively adjust its task processing capabilities without manual configuration to support the processing of new tasks without affecting the processing efficiency of other tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 This is a schematic diagram of the steps of a task processing method in an embodiment of the present application;

[0066] Figure 2 is a structural block diagram of a task processing device in an embodiment of the present application;

[0067] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.

[0068] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0070] Reference Figure 1 In one embodiment of the present application, a task processing method is provided, comprising the following steps:

[0071] Step S1, obtaining the target task type of the newly added task;

[0072] Step S2, obtaining the number of hosts currently processing tasks of the target task type, and determining whether the number of hosts reaches a preset first threshold;

[0073] Step S3, if reached, obtain the first CPU usage rate and the first memory usage rate of each host, and obtain the first average processing time of each task of the other task type currently being processed, and determine whether the first CPU usage rate and the first memory usage rate of each host are both less than the corresponding threshold value;

[0074] Step S4: if all are smaller than the corresponding threshold, the first threshold is increased in sequence, so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and the newly added task is assigned to one of the hosts for processing;

[0075] Step S5, obtaining again the second CPU usage rate and the second memory usage rate of each host, and obtaining again the second average processing time for processing tasks of each other task type;

[0076] Step S6: If the second CPU usage rate or the second memory usage rate of any of the hosts reaches the corresponding threshold, or the second average processing time of any other task type is greater than the first average processing time, stop increasing the first threshold.

[0077] In this embodiment, the above method is applied to a distributed server, and is used to assign each task to a host in the distributed server for processing. The above tasks include a variety of task types, and tasks of different task types usually require different numbers of processors. In the above distributed server, a threshold value for the number of processors corresponding to each task type is pre-maintained, that is, a first threshold value. For example, 20 hosts are shared, and the threshold value for the number of processors corresponding to a certain task A is pre-set to 10, which means that at most 10 hosts can process the task A at the same time. If the first threshold value increases to 11, it means that at most 11 hosts can process the task A at the same time.

[0078] As described in step S1 above, when there are a large number of new tasks, the new tasks need to be assigned to the host for processing, so the target task type of the new task is obtained, that is, what task type the task belongs to is determined. Since each task type is pre-set with a threshold number of hosts that process the task, when the above new tasks come, the number of hosts that currently process the tasks of the above target task type on the distributed server may have reached the threshold; therefore, further coordination processing is required.

[0079] As described in step S2 above, the number of hosts in the current distributed server that process tasks of the target task type is obtained, and it is determined whether the number of hosts reaches a preset first threshold; if it does not reach the preset first threshold, the newly added tasks can be allocated to the hosts for processing according to the preset allocation rules. If it reaches the preset first threshold, it indicates that the hosts that process tasks of the target task type have reached saturation.

[0080] As described in the above step S3, if the preset first threshold is reached, in order to assign and process the above-mentioned new tasks as soon as possible and avoid backlog, the above-mentioned first threshold can be increased so that the above-mentioned new tasks can have more processors, that is, there are more hosts to process the above-mentioned tasks; at the same time, it is also necessary to consider that when adding processors for the above-mentioned new tasks, it should be avoided that the processing time of other tasks is increased, and the hardware performance of the host is avoided to be over-saturated, so as to avoid causing the performance crash of the host.

[0081] Therefore, in this embodiment, it is necessary to obtain the first CPU usage rate and the first memory usage rate of each of the hosts, and determine whether the first CPU usage rate and the first memory usage rate of each of the hosts are less than the corresponding threshold value. If they are both less than the threshold value, it indicates that each host is in an idle state at this time. At this time, the new task can be assigned to the above-mentioned host; if the first CPU usage rate or the first memory usage rate of any host reaches the corresponding threshold value, it is not appropriate to assign the new task at this time. In this embodiment, it is necessary to make a comprehensive consideration in combination with all hosts, and not just consider the hardware usage status of one host. In this embodiment, it is also necessary to obtain the first average processing time of each other task type currently being processed. In order to ensure the normal processing of tasks of other task types, the first average processing time should not be increased.

[0082] As described in the above step S4, if they are all less than the corresponding thresholds, it indicates that each host is in an idle state at this time. Therefore, the first threshold can be increased sequentially so that the number of hosts currently processing tasks of the target task type is less than the first threshold after the increase. When it is less than the first threshold after the increase, the newly added task can be assigned to one of the hosts for processing.

[0083] As described in the above step S5, since the number of hosts processing the above-mentioned target task type tasks in the above-mentioned distributed server is increased, the processing pressure of the host will increase. Therefore, it is necessary to obtain the second CPU usage and the second memory usage of each of the hosts again, and to obtain the second average processing time for processing tasks of each other task type again.

[0084] As described in the above step S6, the above second CPU usage rate and the second memory usage rate are compared with the corresponding thresholds respectively. If the second CPU usage rate or the second memory usage rate of any of the hosts reaches the corresponding threshold, it indicates that the host is in an overvoltage state, which will inevitably reduce the processing speed of its processing tasks, thereby increasing the processing time of the processing tasks. Therefore, it is not appropriate to allocate new tasks at this time, and the above first threshold is stopped from being increased, that is, the above first threshold is no longer increased.

[0085] Alternatively, the second average processing time of tasks of any other task type mentioned above is compared with the corresponding first average processing time. When the second average processing time of tasks of any other task type is greater than the first average processing time, it indicates that the processing speed of the processing tasks has been reduced. Therefore, it is necessary to stop increasing the first threshold, that is, no longer increase the first threshold.

[0086] In this embodiment, the number of hosts currently processing the above-mentioned target task type tasks is continuously monitored. If the number of the above-mentioned hosts does not reach the first threshold after increment within the preset time period, it indicates that there are not enough tasks to be allocated at this time, and therefore the number of processors processing the above-mentioned target task type tasks is restored to the preset first threshold.

[0087] In this embodiment, the performance of each host in the distributed server is coordinated, and each task can be allocated resources relatively fairly through dynamic threshold calculation, so that each host can provide task processing capabilities at maximum performance. Through this solution, when a new task is added at a certain moment, the server can actively adjust its working capacity without manual configuration to support the processing of the task as much as possible, without affecting the processing efficiency of other tasks.

[0088] In one embodiment, the step S1 of obtaining the target task type of the newly added task includes:

[0089] Step S101, obtaining an attribute expression of the newly added task, and obtaining an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code;

[0090] Step S102, inputting the task department code, task processing matter code, task importance code and task processing time code into a mapping script respectively, and outputting the first score, the second score, the third score and the fourth score corresponding to the task department code, the task processing matter code, the task importance code and the task processing time code respectively; wherein the mapping script stores the corresponding relationship between attribute code and score;

[0091] Step S103, performing weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task;

[0092] Step S104, obtaining the target task type of the newly added task according to the mapping relationship between the total score and the target task type.

[0093] In this embodiment, the target task type of the above-mentioned newly added task is not a task type in the usual sense (for example, a test task, a development task, a detection task, etc.), but a parameter that integrates the characteristics of the task department, task processing items, task processing time and task importance of the newly added task; the differences in the above-mentioned target task types can express their different priorities, and target task types with different priorities can correspond to different first thresholds.

[0094] Specifically, the above attribute expression refers to an expression that expresses the above newly added task in the form of coding. For example, an attribute expression is: (P1=1; P2=4; P3=2; P4=4min). The meanings of the numbers, letters and other parameters in each code are different. P1 represents the task department, parameter 1 represents the project department, and parameter 2 represents the development department; P2 represents the task processing matters, and parameter 4 can represent the security verification task; P3 represents the importance of the task, parameter 2 represents important, and parameter 1 represents very important; P4 represents the task processing time. Based on the above attribute expression, the attributes of the above newly added task can be obtained.

[0095] Tasks of different departments, different processing matters, different processing times, and different importance levels may have different priorities, and obviously should correspond to different task types, rather than different processing matters corresponding to different task types as in the prior art. For example, a task is a task for an important department, but its importance is not high, and the processing time is also long, then obviously the priority of the task can be lowered. Therefore, in this embodiment, for the attribute coding of the above-mentioned newly added tasks, the corresponding scores are obtained respectively based on the corresponding relationship between the attribute coding and the score stored in the mapping script; each attribute coding corresponds to a different weight for the score, and the task importance coding corresponds to the highest weight for the score (for example, 0.6. According to the weight of the score corresponding to each attribute coding, a weighted calculation is performed to obtain the total score of the above-mentioned newly added tasks; finally, according to the mapping relationship between the total score and the target task type, the target task type of the newly added task is obtained.

[0096] In one embodiment, after each task is processed, in order to facilitate subsequent query of the task, the task needs to be stored accordingly. The current storage mechanism is to store all task data in the same folder. Although this can also be used to store tasks uniformly, the problem faced during query is that since all tasks are stored in one folder, it takes a long time to query the folder. At present, there is also a way to store tasks in different folders according to the processing host of the task; however, since different tasks have different data volumes, when querying, if large files and small files are stored in one folder, the overall query speed of the folder will be significantly reduced. This is mainly because when the hard disk reads data, the reading speed of most hard disks for small files is not as good as the reading speed of large files, especially when jumping from reading a small file to reading other small files, it takes a lot of time; while a folder is full of large files, the overall time consumed is relatively less when jumping from reading a large file to reading other large files.

[0097] After the step S1 of obtaining the target task type of the newly added task, the following steps are included:

[0098] Step S11, obtaining the data volume of the newly added task, and comparing the data volume with the preset data volume;

[0099] Step S12, if the data volume of the newly added task is less than the preset data volume, the newly added task is stored in the first folder; if the data volume of the newly added task is not less than the preset data volume, the newly added task is stored in the second folder; that is, tasks with different data volumes are stored in different folders.

[0100] Step S13, create a data table, and after storing each new task, construct a corresponding relationship between the task name and the storage folder of each new task in the data table. In this step, the location where each new task is saved is saved in the data table, so that when querying the above task later, first find the location corresponding to the task in the above data table according to the task name, that is, find which folder the task is saved in, and then query in the corresponding folder, so as to reduce the query time; at the same time, since small files and large files are stored in different folders, it is convenient to query data in a targeted manner and improve the query speed.

[0101] In other embodiments, when querying, the attributes of the task to be queried may be directly obtained, the data volume of the task may be obtained from the attributes, a corresponding folder may be matched according to the data volume, and then the corresponding task may be queried in the corresponding folder.

[0102] In one embodiment, the newly added task includes a plurality of text messages; after the step S1 of obtaining the target task type of the newly added task, the following steps are included:

[0103] Create a blank layer;

[0104] Sorting the plurality of text messages according to a preset order, and obtaining the number of the text messages, and obtaining the number of characters in each text message;

[0105] Dividing a plurality of target areas corresponding to the number of items in the blank layer, and establishing a one-to-one mapping relationship between the text information and the target areas;

[0106] Adding each of the sorted text information to the target area having a one-to-one mapping relationship;

[0107] Calculating a first ratio of the number of characters in all the sorted text messages according to the number of characters in each of the sorted text messages;

[0108] Dividing a preset seal into sub-seals corresponding to the number of pieces of text information, and the area ratio of each of the sub-seals is the same as the first ratio;

[0109] Each of the sub-seals is added to the target area where the corresponding text information is located, and the sub-seals, text information and the blank layer are synthesized to obtain a task picture, which is then stored.

[0110] In this embodiment, the above-mentioned newly added task includes multiple text information, for example, a task content field, a task deadline field, etc. The above-mentioned text information is extracted from the above-mentioned newly added task, and the number of text information is obtained; a blank layer is created, and according to the number of the above-mentioned text information, the blank layer is divided into corresponding multiple target areas, and each text information is added to a target area.

[0111] In order to ensure the authenticity of the above-mentioned task picture, it is also necessary to stamp the above-mentioned task picture; instead of stamping a complete seal on the picture, this is because the anti-counterfeiting property of the entire seal is poor; therefore, in this embodiment, the seal is divided into multiple sub-seals, and each sub-seal is stamped in the target area where each text information is located, which enhances the anti-counterfeiting property of the data; and there is a corresponding relationship between the area ratio between the sub-seals and the first ratio of the number of characters in each of the text information. When the task is reviewed subsequently, the task picture can be verified whether it has been modified based on the number of the above-mentioned file information, the number of characters in each text information and the ratio of the above-mentioned sub-seals, which is convenient for the subsequent task review.

[0112] In one embodiment, after the step of synthesizing the sub-stamp, text information and the blank layer to obtain the task picture, the following steps are included:

[0113] creating a copy of said task picture;

[0114] Converting a copy of the task image into a string, and adding the string to an array to generate a character group;

[0115] Performing hash calculation on the character group to obtain a hash value;

[0116] The task image is encrypted using the hash value.

[0117] In this embodiment, the task image needs to be encrypted, so a copy consistent with the task image is created and converted into a string, usually a string in base64 format, and the string is added to an array to generate a character group. The character group is a data stream expression of the task image. When performing a hash calculation on it, the amount of calculation can be significantly reduced compared to performing a hash calculation on the task image. The hash value obtained by the hash calculation is used as the encryption password of the task image.

[0118] Reference Figure 2 In one embodiment of the present application, a task processing device is also provided, including:

[0119] A first acquisition unit 10 is used to acquire a target task type of a newly added task;

[0120] A second acquisition unit 20 is used to acquire the number of hosts currently processing tasks of the target task type, and determine whether the number of hosts reaches a preset first threshold;

[0121] The third acquisition unit 30 is used to obtain the first CPU usage rate and the first memory usage rate of each host at present, and obtain the first average processing time of each task of other task types at present, and determine whether the first CPU usage rate and the first memory usage rate of each host are both less than the corresponding threshold value;

[0122] The allocating unit 40 is configured to increase the first threshold in sequence if all of them are smaller than the corresponding threshold, so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and allocate the newly added task to one of the hosts for processing;

[0123] A fourth acquisition unit 50 is used to again acquire a second CPU usage rate and a second memory usage rate of each of the hosts, and again acquire a second average processing time for processing tasks of each other task type;

[0124] The stopping unit 60 is used to stop increasing the first threshold if the second CPU usage rate or the second memory usage rate of any of the hosts reaches the corresponding threshold, or the second average processing time of any other task type is greater than the first average processing time.

[0125] In one embodiment, the first acquisition unit 10 includes:

[0126] An acquisition subunit is used to acquire an attribute expression of the newly added task, and acquire an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code;

[0127] A scoring subunit is used to input the task department code, task processing matter code, task importance code and task processing time code into a mapping script respectively, and output a first score, a second score, a third score and a fourth score corresponding to the task department code, the task processing matter code, the task importance code and the task processing time code respectively; wherein the mapping script stores a corresponding relationship between attribute code and score;

[0128] a calculation subunit, configured to perform a weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task;

[0129] The determination subunit is used to obtain the target task type of the newly added task according to the mapping relationship between the total score and the target task type.

[0130] In one embodiment, it further includes:

[0131] A fifth acquiring unit, configured to acquire the data volume of the newly added task and compare the data volume with a preset data volume;

[0132] A first storage unit is used to store the newly added task in a first folder if the data volume of the newly added task is less than a preset data volume; and to store the newly added task in a second folder if the data volume of the newly added task is not less than the preset data volume;

[0133] The construction unit is used to create a data table, and after storing each newly added task, construct a corresponding relationship between the task name and the storage folder of each newly added task in the data table.

[0134] In one embodiment, it further includes:

[0135] Create a unit to create a blank layer;

[0136] A sorting unit, used to sort the plurality of text messages according to a preset order, and obtain the number of the text messages, and the number of characters in each text message;

[0137] An establishing unit, used for dividing the blank layer into a plurality of target areas corresponding to the number of strips, and establishing a one-to-one mapping relationship between the text information and the target areas;

[0138] A first adding unit, used for adding each of the sorted text information to the target area having a one-to-one mapping relationship;

[0139] a ratio calculation unit, configured to calculate a first ratio of the number of characters in all the text messages according to the number of characters in each of the sorted text messages;

[0140] A segmentation unit, used for segmenting a preset seal into sub-seals corresponding to the number of pieces of text information, and the area ratio of each of the sub-seals is the same as the first ratio;

[0141] The second adding unit is used to add each of the sub-seals to the target area where the corresponding text information is located, and synthesize the sub-seals, text information and the blank layer to obtain a task picture, and store it.

[0142] In one embodiment, the second adding unit is further used for:

[0143] creating a copy of said task picture;

[0144] Converting a copy of the task image into a string, and adding the string to an array to generate a character group;

[0145] Performing hash calculation on the character group to obtain a hash value;

[0146] The task image is encrypted using the hash value.

[0147] In this embodiment, the specific implementation of each unit and sub-unit in the above-mentioned device embodiment may refer to the description in the above-mentioned method embodiment, and will not be repeated here.

[0148] Reference Figure 3 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store task image data, etc. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a task processing method is implemented.

[0149] Those skilled in the art will understand that Figure 3 The structure shown in is merely a block diagram of a portion of the structure related to the present application solution and does not constitute a limitation on the computer device to which the present application solution is applied.

[0150] An embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, a task processing method is implemented. It can be understood that the computer-readable storage medium in this embodiment can be a volatile readable storage medium or a non-volatile readable storage medium.

[0151] In summary, the task processing method, apparatus, computer equipment and storage medium provided in the embodiments of the present application include: obtaining the target task type of the newly added task; obtaining the number of hosts currently processing the task of the target task type, and determining whether the number of hosts reaches a preset first threshold; if reached, obtaining the first CPU usage and first memory usage of each host, and obtaining the first average processing time of the task currently processing each other task type, and determining whether the first CPU usage and first memory usage of each host are both less than the corresponding threshold; if both are less than the corresponding threshold, increasing the first threshold in sequence so that the number of hosts currently processing the task of the target task type is less than the increased first threshold, and assigning the newly added task to one of the hosts for processing; obtaining the second CPU usage and second memory usage of each host again, and obtaining the second average processing time of the task processing each other task type again; if the second CPU usage or the second memory usage of any of the hosts reaches the corresponding threshold, or the second average processing time of the task of any other task type is greater than the first average processing time, stop increasing the first threshold. When processing new tasks, this application allows the server to actively adjust its task processing capabilities without manual configuration to support the processing of new tasks without affecting the processing efficiency of other tasks.

[0152] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0153] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.

[0154] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A task processing method, characterized in that: The following steps are involved: Get the target task type of the newly added task; Obtaining the number of hosts currently processing tasks of the target task type, and determining whether the number of hosts reaches a preset first threshold; If reached, obtain the first CPU usage and the first memory usage of each host, and obtain the first average processing time of each task of the other task type currently being processed, and determine whether the first CPU usage and the first memory usage of each host are both less than the corresponding threshold value; If they are all smaller than the corresponding thresholds, the first thresholds are adjusted up in sequence so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and the newly added task is assigned to one of the hosts for processing; Obtaining again a second CPU usage rate and a second memory usage rate of each of the hosts, and again obtaining a second average processing time for processing tasks of each other task type; If the second CPU usage rate or the second memory usage rate of any of the hosts reaches the corresponding threshold, or the second average processing time of any other task type is greater than the first average processing time, stop increasing the first threshold; The step of obtaining the target task type of the newly added task includes: Obtaining an attribute expression of the newly added task, and obtaining an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code; Input the task department code, task processing matter code, task importance code and task processing time code into the mapping script respectively, and output the first score, second score, third score and fourth score corresponding to the task department code, task processing matter code, task importance code and task processing time code respectively; wherein the mapping script stores the corresponding relationship between attribute code and score; Performing weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task; According to the mapping relationship between the total score and the target task type, the target task type of the newly added task is obtained.

2. The task processing method according to claim 1, characterized in that: After the step of obtaining the target task type of the newly added task, the following steps are included: Obtaining the data volume of the newly added task, and comparing the data volume with the preset data volume; If the data volume of the newly added task is less than the preset data volume, the newly added task is stored in the first folder; if the data volume of the newly added task is not less than the preset data volume, the newly added task is stored in the second folder; A data table is created, and after each newly added task is stored, a corresponding relationship between the task name and the storage folder of each newly added task is constructed in the data table.

3. The task processing method according to claim 1, characterized in that: The newly added task includes a plurality of text messages; after the step of obtaining the target task type of the newly added task, the method further includes: Create a blank layer; Sorting the plurality of text messages according to a preset order, and obtaining the number of the text messages, and obtaining the number of characters in each text message; Dividing a plurality of target areas corresponding to the number of items in the blank layer, and establishing a one-to-one mapping relationship between the text information and the target areas; Adding each of the sorted text information to the target area having a one-to-one mapping relationship; Calculating a first ratio of the number of characters in all the sorted text messages according to the number of characters in each of the sorted text messages; Dividing a preset seal into sub-seals corresponding to the number of pieces of text information, and the area ratio of each of the sub-seals is the same as the first ratio; Each of the sub-seals is added to the target area where the corresponding text information is located, and the sub-seals, text information and the blank layer are synthesized to obtain a task picture, which is then stored.

4. The task processing method according to claim 3, characterized in that: After the step of synthesizing the sub-stamp, text information and the blank layer to obtain the task picture, the method includes: creating a copy of said task picture; Converting a copy of the task image into a string, and adding the string to an array to generate a character group; Performing hash calculation on the character group to obtain a hash value; The task image is encrypted using the hash value.

5. A task processing device, used to execute the method according to any one of claims 1 to 4, characterized in that: include: A first acquisition unit, used to acquire a target task type of a newly added task; A second acquisition unit is used to acquire the number of hosts currently processing tasks of the target task type, and determine whether the number of hosts reaches a preset first threshold; A third acquisition unit is used to obtain the first CPU usage rate and the first memory usage rate of each host at present, and obtain the first average processing time of the task of each other task type currently being processed, and determine whether the first CPU usage rate and the first memory usage rate of each host are both less than the corresponding threshold value; an allocating unit, configured to increase the first threshold in sequence if all of them are smaller than the corresponding threshold, so that the number of hosts currently processing tasks of the target task type is smaller than the increased first threshold, and allocate the newly added task to one of the hosts for processing; a fourth acquisition unit, configured to again acquire a second CPU usage rate and a second memory usage rate of each of the hosts, and again acquire a second average processing time for processing tasks of each other task type; a stopping unit, configured to stop increasing the first threshold if a second CPU usage rate or a second memory usage rate of any of the hosts reaches a corresponding threshold, or a second average processing time of tasks of any other task type is greater than the first average processing time; The first acquisition unit includes: An acquisition subunit is used to acquire an attribute expression of the newly added task, and acquire an attribute code of the newly added task according to the attribute expression, wherein the attribute code includes a task department code, a task processing matter code, a task importance code, and a task processing time code; A scoring subunit is used to input the task department code, task processing matter code, task importance code and task processing time code into a mapping script respectively, and output a first score, a second score, a third score and a fourth score corresponding to the task department code, the task processing matter code, the task importance code and the task processing time code respectively; wherein the mapping script stores a corresponding relationship between attribute code and score; a calculation subunit, configured to perform a weighted sum calculation on the first score, the second score, the third score and the fourth score to obtain a total score of the newly added task; The determination subunit is used to obtain the target task type of the newly added task according to the mapping relationship between the total score and the target task type.

6. The task processing device according to claim 5, characterized in that: Also includes: A fifth acquiring unit, configured to acquire the data volume of the newly added task and compare the data volume with a preset data volume; A first storage unit, configured to store the newly added task in a first folder if the data volume of the newly added task is less than a preset data volume; If the data volume of the newly added task is not less than the preset data volume, storing the newly added task in the second folder; The construction unit is used to create a data table, and after storing each newly added task, construct a corresponding relationship between the task name and the storage folder of each newly added task in the data table.

7. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.