Task allocation method and device

By determining the estimated time consumption based on task attribute information and classifying the target, and allocating tasks based on the load level of the cluster host, the problem of severe load on the task execution machine is solved, and intelligent allocation and efficient execution of tasks are achieved.

CN119356865APending Publication Date: 2025-01-24BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411409561.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the business scenario of batch upload and export of tasks, the task execution machine is loaded severely, which affects the task progress. The existing distributed task execution methods cannot achieve intelligent assignment of tasks.

Method used

By obtaining the attribute information of the task, the estimated time consuming of the task is determined, and the target is classified based on the estimated time consuming, and the task is distributed to the corresponding task queue, and then the target host is determined for task allocation based on the load level of the host in the cluster.

Benefits of technology

The intelligent distribution of tasks has been achieved, the task execution efficiency is improved, the task waiting time is reduced, and the user experience is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119356865A_ABST
    Figure CN119356865A_ABST
Patent Text Reader

Abstract

The invention discloses a task allocation method and device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of determining estimated time consumption of tasks, further determining target classifications of the tasks and corresponding target task queues, and allocating the tasks in the target task queues to hosts based on load levels of the hosts according to received task pulling requests of the hosts in clusters corresponding to the target queues, and enabling the host to execute the corresponding task. According to the embodiment, flexible distribution of the batch tasks is realized, the tasks are reasonably distributed, the execution efficiency of the tasks is improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task allocation method and device. Background Art

[0002] At present, with the rapid development of various enterprises, most of them will develop their own systems to meet service needs. As enterprise services become richer, the business tasks of the corresponding enterprise systems will also increase in large quantities. In the business scenario of batch uploading and exporting tasks, a large number of business tasks need to be allocated by the system and the corresponding task processes need to be executed, which easily leads to task accumulation, causing serious load on the task execution machine and affecting the task progress.

[0003] For the above problem, through the distributed task execution method, different threads can be used to execute multiple tasks at the same time, thereby improving the task processing efficiency. However, this method cannot realize the intelligent allocation of tasks, and there is still the problem of serious load on the task execution machine. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a task allocation method and device, which can realize intelligent task allocation, improve task execution efficiency and improve user experience while ensuring the load of the task execution host.

[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for allocating tasks is provided, comprising:

[0006] Determine the estimated duration of the task based on the acquired attribute information of the task;

[0007] Determine the target classification of tasks based on their estimated duration;

[0008] Distribute tasks to target task queues corresponding to target categories;

[0009] The target host is determined based on the load level of each host in the cluster corresponding to the target task queue, and the task is assigned to the target host.

[0010] Optionally, based on the acquired attribute information of the task, an estimated time consumption of the task is determined, including:

[0011] Determine the task type of the task based on the acquired attribute information of the task;

[0012] A first estimated time consumption corresponding to the task type is determined as the estimated time consumption of the task, where the first estimated time consumption is determined based on a historical execution time consumption of the task corresponding to the task type.

[0013] Optionally, the method further comprises:

[0014] Get the time consumed by the target host to execute the task;

[0015] The first estimated duration is updated based on the elapsed time.

[0016] Optionally, based on the acquired attribute information of the task, an estimated time consumption of the task is determined, including:

[0017] Split the task into multiple subtasks;

[0018] Determine the estimated duration of a task based on the execution duration of multiple subtasks.

[0019] Optionally, determining the target host based on the load level of each host in the cluster corresponding to the target task queue includes:

[0020] Get the load level of each host in the cluster corresponding to the target task queue;

[0021] The target host is determined based on the load level of each host and a preset maximum load level threshold.

[0022] Optionally, the method further comprises:

[0023] Based on the number of queued tasks in each monitored task queue and the load level of each host in the cluster corresponding to each task queue, the preset maximum load level threshold of each host is dynamically adjusted.

[0024] According to another aspect of an embodiment of the present invention, there is provided a task allocation device, comprising:

[0025] A determination module, used to determine an estimated time consumption of a task based on the acquired attribute information of the task; and to determine a target classification of the task based on the estimated time consumption;

[0026] A distribution module, used to distribute tasks to target task queues corresponding to target categories;

[0027] The allocation module is used to determine the target host based on the load level of each host in the cluster corresponding to the target task queue, and allocate the task to the target host.

[0028] Optionally, the determination module is further configured to:

[0029] Determine the task type of the task based on the acquired attribute information of the task;

[0030] A first estimated time consumption corresponding to the task type is determined as the estimated time consumption of the task, where the first estimated time consumption is determined based on a historical execution time consumption of the task corresponding to the task type.

[0031] Optionally, the device further comprises:

[0032] The acquisition module is used to obtain the time consumed by the target host to execute the task;

[0033] An updating module is used to update the first estimated time based on the consumed time.

[0034] Optionally, the determination module is further configured to:

[0035] Split the task into multiple subtasks;

[0036] Determine the estimated duration of a task based on the execution duration of multiple subtasks.

[0037] Optionally, the determination module is further configured to:

[0038] Get the load level of each host in the cluster corresponding to the target task queue;

[0039] The target host is determined based on the load level of each host and a preset maximum load level threshold.

[0040] Optionally, the device further comprises:

[0041] The adjustment module is used to dynamically adjust the preset maximum load level threshold of each host based on the number of queued tasks in each monitored task queue and the load level of each host in the cluster corresponding to each task queue.

[0042] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the task allocation method provided by an embodiment of the present invention.

[0043] According to another aspect of an embodiment of the present invention, a computer readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method for allocating tasks provided by an embodiment of the present invention is implemented.

[0044] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the task allocation method provided by the embodiment of the present invention is implemented.

[0045] An embodiment of the above invention has the following advantages or beneficial effects: it can determine the estimated time consumption of the task based on the acquired attribute information of the task, and further determine the target classification of the task, distribute the task to the corresponding target task queue, and then allocate the task to the target host based on the load level of the host in the cluster, thereby realizing intelligent allocation of tasks based on task consumption, dividing tasks of different time consumption into teams for processing, improving resource utilization, reducing task waiting time, and improving user satisfaction.

[0046] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0048] Figure 1 is a schematic diagram of main steps of a method for allocating tasks according to an embodiment of the present invention;

[0049] Figure 2 is a schematic diagram of the structure of a system for a task allocation method according to an embodiment of the present invention;

[0050] Figure 3 is a schematic diagram of main modules of a task allocation device according to an embodiment of the present invention;

[0051] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0052] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0053] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0054] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution disclosed in the present invention are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0055] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.

[0056] Figure 1 is a schematic diagram of the main process of the task allocation method according to an embodiment of the present invention, such as Figure 1 As shown, including:

[0057] Step S101, determining the estimated time consumption of the task based on the acquired attribute information of the task.

[0058] After the system receives a task request, it will store the attribute information of the task in the database, including the task identity document (ID), task status, task time and other data. Among them, the task status is in progress, and it will be updated to completed after the subsequent tasks are completed. Pull the task from the database and determine the estimated time of the task. Specifically, the estimated time of the task can be determined based on the time taken to complete the same task in the past.

[0059] Optionally, when pulling tasks, the tasks are pulled according to the task status, that is, the tasks whose task status is in execution are pulled.

[0060] Step S102, determining the target classification of the task based on the estimated time consumption.

[0061] According to the comparison result of the estimated time consumption of the determined task and the preset threshold, the target classification of the task is determined. Specifically, according to whether the estimated time consumption of the determined task is greater than the preset threshold, the task is determined to be a fast task or a slow task, including: tasks with an estimated time consumption greater than the preset threshold are determined to be classified as slow tasks, and tasks with an estimated time consumption not greater than the preset threshold are determined to be classified as fast tasks. The preset threshold can be dynamically configured based on the execution status of system business tasks.

[0062] Optionally, task classification can be set according to actual conditions, not limited to 2 categories, and 3 or more categories can be set, such as fast, medium, slow tasks, etc., without limitation. The corresponding preset thresholds can also be set according to actual conditions, also without limitation.

[0063] Step S103: distribute the task to the target task queue corresponding to the target classification.

[0064] After determining the target classification of the task, the task is distributed to the target task queue corresponding to the target classification. Specifically, the system contains multiple task queues, the number of which is the same as the number of task classifications, that is, each task queue corresponds to a task classification. After determining the target classification of the task, the task can be distributed to the corresponding target task queue, for example, a slow task is distributed to a slow task queue, and a fast task is distributed to a fast task queue. When a task is distributed to a target queue, the task ID and estimated time are stored in the queue. It can be seen that the tasks stored in the task queue are ordered data sorted by distribution time.

[0065] Optionally, in order to speed up the task pulling and processing, each task category can also correspond to multiple task queues. When assigned to a task queue among multiple task queues, tasks can be distributed to each queue in turn according to the number of queues; tasks can also be distributed according to the number of tasks in each task queue, for example, tasks are distributed to the queue with the smallest number of tasks each time, or within a preset time period after determining the queue with the smallest number of tasks, all pulled tasks will be distributed to the queue, and then re-determined in the next time period, etc.

[0066] Optionally, in order to ensure the completion speed of the task, when allocating resources, the system allocates more resources to the cluster of the slow task queue to increase the execution speed of the cluster of the slow task queue.

[0067] Step S104, determining a target host based on the load level of each host in the cluster corresponding to the target task queue, and assigning the task to the target host.

[0068] After receiving a task pull request from a host in the cluster corresponding to the target task queue, a task in the target queue is assigned to the host so that the host performs the relevant operations of the task. When pulling tasks, the concurrency problem of tasks can be avoided by adding a distributed lock to the task being pulled. Among them, the task pull request is a request executed when the load level of the host in the cluster meets the load condition, for example, the current load level of the host is less than the maximum water level threshold. Specifically, after receiving a task pull request sent by a host in the cluster, it is determined whether the load level of the host meets the above conditions. If it does, the request will be responded to and the task will be assigned. If it does not, the request will be rejected and the task will be assigned to other hosts that meet the conditions.

[0069] Optionally, the load water level is calculated as a weighted sum of the number of tasks executed simultaneously by the host and the corresponding estimated time consumption. The highest water level threshold is a relatively high threshold for a relatively stable load based on basic performance indicators of the host, such as cpu, memory, disk, etc.

[0070] Optionally, the task pull request of the host in the cluster can be a request sent at a scheduled time. Each cluster can be set with a different scheduled time, or all clusters can be set with the same scheduled time.

[0071] Optionally, the correspondence and quantity between task classifications, task queues, clusters and hosts in the clusters are explained: each task classification can correspond to at least one task queue, that is, a slow task classification can correspond to at least one slow task queue; each task queue can correspond to at least one task execution cluster, wherein at least one task execution cluster can be classified according to parameters such as task execution capability, and each classified cluster corresponds to a task queue, and at least one task execution cluster can also be randomly classified; each cluster contains multiple hosts.

[0072] According to the task allocation method provided in an embodiment of the present invention, it is possible to determine the estimated time consumption of the task based on the acquired attribute information of the task, and further determine the target classification of the task, distribute the task to the corresponding target task queue, and then allocate the task to the target host based on the load level of the host in the cluster, thereby realizing intelligent allocation of tasks based on task time consumption, dividing tasks of different time consumption into teams for processing, improving resource utilization, reducing task waiting time, and improving user satisfaction.

[0073] Optionally, based on the acquired attribute information of the task, determining the estimated time of the task includes: determining the task type of the task based on the acquired attribute information of the task; determining a first estimated time corresponding to the task type as the estimated time of the task, the first estimated time determined based on the historical execution time of the task corresponding to the task type. When determining the estimated time of the task, the task type to which the task belongs is determined based on the task identifier in the attribute information of the task, and the first estimated time is calculated based on the historical execution time of the task corresponding to the task type, including: counting multiple execution times and performing weighted averaging, and the result obtained is the first estimated time. Determining the first estimated time is the estimated time of the task. The calculation of this estimated time is applicable to scenarios where the execution time of tasks of the same type is fixed or has a small difference.

[0074] Optionally, the method also includes: obtaining the time consumed by the target host to execute the task; and updating the first estimated time based on the consumed time. During the execution of the task by the system host, the first estimated time can be dynamically adjusted, and a judgment is made based on the total time consumed to execute the task. If the difference with the first estimated time is large, the first estimated time can be updated. For example, if the first estimated time is 20 and the total time consumed to execute the task is 5, the first estimated time can be appropriately reduced to 10; or if the first estimated time is 5 and the total time consumed to execute the task is 25, the first estimated time can be appropriately increased to 18. The size of the specific adjustment value can be determined based on the average of the first estimated time and the total time consumed to execute the task; or it can be determined based on a preset adjustment step, which is not limited to this.

[0075] Optionally, based on the acquired attribute information of the task, determining the estimated time consumption of the task includes: splitting the task into multiple subtasks; and determining the estimated time consumption of the task based on the execution time consumption of the multiple subtasks. Another method for calculating the estimated time consumption is to split the steps of the task, count the execution time consumption of each split subtask, and sum up to obtain the estimated time consumption of the task. The execution time consumption of each sub-process can be a fixed time consumption of the process, or a time consumption calculated based on the historical execution time consumption.

[0076] The task allocation method provided in an embodiment of the present invention can estimate the time consumption of a task. Specifically, the time consumption of the entire task can be estimated according to the task type, or according to the time consumption of each subtask in the task. The classification of the task is determined based on the time consumption, thereby realizing flexible partitioning of tasks, avoiding long waiting times for fast tasks, improving the efficiency of task processing, and ensuring user experience.

[0077] Optionally, the target host is determined based on the load level of each host in the cluster corresponding to the target task queue, including: obtaining the load level of each host in the cluster corresponding to the target task queue; determining the target host based on the load level of each host and a preset maximum load level threshold. Taking the load level as an example, when receiving a task pull request from the host, the current load water level of the host is obtained, and it is determined whether the current load water level of the host plus the estimated time of the task in the target task queue is less than the maximum water level threshold, or whether the current load water level of the host is less than the maximum water level threshold. If the above conditions are met, the task of the target task queue is allocated to the host in response to the pull request. If not, the pull request of the host is rejected, and the task of the target task queue is allocated to other hosts that meet the above conditions.

[0078] Optionally, the method further includes: dynamically adjusting the preset maximum load level threshold of each host based on the number of queued tasks in each monitored task queue and the load level of each host in the cluster corresponding to each task queue. During the execution of the system task, the preset maximum water level threshold is dynamically adjusted according to the load water level of all hosts. If the load water level of all hosts is high, or the load water level of more than a certain number of hosts is high, the maximum water level threshold is increased.

[0079] According to the task allocation method provided in an embodiment of the present invention, tasks can be allocated according to the load level of each host in the cluster corresponding to each task queue. On the basis of the classification of fast and slow tasks, tasks can be allocated to hosts with light loads. This can greatly improve the task processing efficiency and improve the utilization of system resources, so that each host maintains a load-balanced state.

[0080] Optionally, after the host completes the task, the number of tasks corresponding to the host is reduced by one, the task duration of the task is reduced from the corresponding watermark, and the status of the task in the database is modified to completed.

[0081] Optionally, monitor the task processing of the system, including machine monitoring and task execution data monitoring. Machine monitoring: monitors the performance of the current machine by analyzing the CPU, memory, disk and other information provided by the underlying operating system; Task execution data monitoring: includes the number of tasks in the task queue, the task data executed by the host, the real-time water level of the host (reflected in the total estimated time of the task), and the number of tasks assigned to the fast and slow task queues. Based on the acquired monitoring data, the monitoring data can be displayed through the built page. For the load of each monitored host, the number of parallel tasks of each host can be adjusted.

[0082] Optionally, early warnings are issued for monitoring points such as the number of tasks in the fast task queue, the number of tasks in the slow task queue, the real-time water level of the host, and the allocation of fast and slow task queues. Each alarm is configured with a corresponding alarm threshold. Among them, the alarm threshold needs to be adjusted accordingly based on data such as the water level threshold dynamically adjusted by the system.

[0083] Optionally, the data of the task acquisition, distribution, assignment, and execution process is stored through MySQL to achieve persistent storage of task data and ensure the re-execution of failed tasks.

[0084] According to the task allocation method provided by the embodiment of the present invention, it is possible to perform target classification based on the estimated time consumption of the task determined by the attribute information, and distribute the task to the corresponding queue, realize the grouping of fast and slow tasks, avoid long waiting time for fast tasks, and improve the user experience. Furthermore, for each task queue, tasks are allocated according to the load level of each host in the corresponding cluster, and tasks are allocated to hosts with light loads, which can achieve reasonable allocation of tasks, greatly improve the processing efficiency of tasks and the utilization rate of system resources, and enable each host to maintain a load-balanced state. The task allocation strategy can be dynamically adjusted through the dynamically adjusted load level threshold and the distribution threshold of the fast and slow queues, improve the adaptability of the task allocation strategy and system resources, and ensure the execution of tasks with maximum efficiency. In addition, through the visualized monitoring data, the task execution of the system can be better monitored, abnormal events can be handled in a timely manner, and the stability of the system can be guaranteed.

[0085] like Figure 2 The structure diagram of the system of the task allocation method according to the embodiment of the present invention is shown, which specifically includes:

[0086] After receiving the submitted task, the system stores the task data in the DB database, including the task ID, task status and creation time. The task scheduling center obtains the task data and assigns the task by calling the DB database. Specifically, after obtaining the task, the task scheduling center configures and reads the task time information, such as the historical task execution time; estimates the task time based on the configured read information, and classifies the tasks according to the task time; distributes the tasks according to the classification results, with fast tasks distributed to the fast task queue and slow tasks distributed to the slow task queue; the queue corresponding to the host box of the execution instance cluster corresponding to each queue sends a task pull request, and determines whether to respond to the request to assign tasks based on the load level of each host and the threshold corresponding to the preset water level line. If it does not exceed the water level line, it can be assigned. If it exceeds the water level line, it proves that the machine will be fully loaded, and no new tasks will be accepted, and the assignment request will be rejected. The fast task execution instance cluster contains 2 hosts, and the slow task cluster contains 3 hosts; it is determined whether each host has successfully completed the task. If completed, the task status in the database is updated to completed.

[0087] Figure 3 is a schematic diagram of a task allocation device 300 provided in an embodiment of the present invention, such as Figure 3 As shown, including:

[0088] The determination module 301 is used to determine the estimated time consumption of the task based on the acquired attribute information of the task; and determine the target classification of the task based on the estimated time consumption;

[0089] A distribution module 302 is used to distribute tasks to target task queues corresponding to target categories;

[0090] The allocation module 303 is used to determine the target host based on the load level of each host in the cluster corresponding to the target task queue, and allocate the task to the target host.

[0091] The task allocation device provided in an embodiment of the present invention can determine the estimated time consumption of the task based on the acquired attribute information of the task, and further determine the target classification of the task, distribute the task to the corresponding target task queue, and then allocate the task to the target host based on the load level of the host in the cluster, thereby realizing intelligent allocation of tasks based on task time consumption, dividing tasks of different time consumption into teams for processing, improving resource utilization, reducing task waiting time, and improving user satisfaction.

[0092] Optionally, the determination module 301 is further configured to:

[0093] Determine the task type of the task based on the acquired attribute information of the task;

[0094] A first estimated time consumption corresponding to the task type is determined as the estimated time consumption of the task, where the first estimated time consumption is determined based on a historical execution time consumption of the task corresponding to the task type.

[0095] Optionally, the device further comprises:

[0096] The acquisition module 304 is used to acquire the time consumed by the target host to execute the task;

[0097] The updating module 305 is used to update the first estimated time consumption based on the consumed time.

[0098] Optionally, the determination module 301 is further configured to:

[0099] Split the task into multiple subtasks;

[0100] Determine the estimated duration of a task based on the execution duration of multiple subtasks.

[0101] Optionally, the determination module 301 is further configured to:

[0102] Get the load level of each host in the cluster corresponding to the target task queue;

[0103] The target host is determined based on the load level of each host and a preset maximum load level threshold.

[0104] Optionally, the device further comprises:

[0105] The adjustment module 306 is used to dynamically adjust the preset maximum load level threshold of each host based on the number of queued tasks in each monitored task queue and the load level of each host in the cluster corresponding to each task queue.

[0106] According to the task allocation method provided by the embodiment of the present invention, it is possible to perform target classification based on the estimated time consumption of the task determined by the attribute information, and distribute the task to the corresponding queue, realize the grouping of fast and slow tasks, avoid long waiting time for fast tasks, and improve the user experience. Furthermore, for each task queue, tasks are allocated according to the load level of each host in the corresponding cluster, and tasks are allocated to hosts with light loads, which can achieve reasonable allocation of tasks, greatly improve the processing efficiency of tasks and the utilization rate of system resources, and enable each host to maintain a load-balanced state. The task allocation strategy can be dynamically adjusted through the dynamically adjusted load level threshold and the distribution threshold of the fast and slow queues, improve the adaptability of the task allocation strategy and system resources, and ensure the execution of tasks with maximum efficiency. In addition, through the visualized monitoring data, the task execution of the system can be better monitored, abnormal events can be handled in a timely manner, and the stability of the system can be guaranteed.

[0107] Figure 4 An exemplary system architecture 400 is shown to which the method for allocating tasks or the apparatus for allocating tasks according to the embodiments of the present invention can be applied.

[0108] like Figure 4As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0109] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0110] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0111] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received task allocation request and other data, and feed back the processing result (such as the task allocation result - only an example) to the terminal device.

[0112] It should be noted that the task allocation method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the task allocation device is generally set in the server 405 .

[0113] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0114] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device or a server suitable for implementing an embodiment of the present invention. Figure 5 The terminal device or server shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0115] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0116] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0117] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0118] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer 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 of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0119] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0120] The units or modules involved in the embodiments of the present invention may be implemented in software or hardware. The units or modules described may also be provided in a processor. For example, they may be described as follows: a processor includes a determination module, a distribution module, and an allocation module. The names of these modules do not, in some cases, constitute limitations on the units or modules themselves. For example, the determination module may also be described as a "module for determining the estimated time consumption of a task based on the acquired attribute information of the task."

[0121] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0122] Determine the estimated duration of the task based on the acquired attribute information of the task;

[0123] Determine the target classification of tasks based on their estimated duration;

[0124] Distribute tasks to target task queues corresponding to target categories;

[0125] The target host is determined based on the load level of each host in the cluster corresponding to the target task queue, and the task is assigned to the target host.

[0126] According to the technical solution of the embodiment of the present invention, it is possible to determine the estimated time consumption of a task based on the acquired attribute information of the task, and further determine the target classification of the task, distribute the task to the corresponding target task queue, and then assign the task to the target host based on the load level of the host in the cluster, thereby realizing intelligent allocation of tasks based on task consumption, dividing tasks of different time consumption into teams for processing, improving resource utilization, reducing task waiting time, and improving user satisfaction.

[0127] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A task allocation method, characterized in that: include: Determine an estimated time consumption of the task based on the acquired attribute information of the task; Determining a target classification of the task based on the estimated time consumption; Distributing the task to a target task queue corresponding to the target classification; A target host is determined based on the load level of each host in the cluster corresponding to the target task queue, and the task is allocated to the target host.

2. The method according to claim 1, characterized in that The step of determining the estimated time consumption of the task based on the acquired attribute information of the task includes: Determining a task type of the task based on the acquired attribute information of the task; A first estimated time duration corresponding to the task type is determined as the estimated time duration of the task, where the first estimated time duration is determined based on a historical execution time duration of the task corresponding to the task type.

3. The method according to claim 2, characterized in that The method further comprises: Obtaining the time consumed by the target host to execute the task; The first estimated duration is updated based on the consumed time.

4. The method according to claim 1, characterized in that The step of determining the estimated time consumption of the task based on the acquired attribute information of the task includes: Splitting the task into a plurality of subtasks; Based on the execution times of the multiple subtasks, an estimated execution time of the task is determined.

5. The method according to any one of claims 1 to 4, characterized in that: The determining the target host based on the load level of each host in the cluster corresponding to the target task queue includes: Obtaining the load level of each host in the cluster corresponding to the target task queue; The target host is determined based on the load levels of the respective hosts and a preset maximum load level threshold.

6. The method according to claim 5, characterized in that The method further comprises: Based on the number of queued tasks in each monitored task queue and the load level of each host in the cluster corresponding to each task queue, the preset maximum load level threshold of each host is dynamically adjusted.

7. A task allocation device, characterized in that: include: A determination module, used to determine the estimated time consumption of the task based on the acquired attribute information of the task; Determining a target classification of the task based on the estimated time consumption; A distribution module, used for distributing the task to a target task queue corresponding to the target classification; The allocation module is used to determine the target host based on the load level of each host in the cluster corresponding to the target task queue, and allocate the task to the target host.

8. An electronic device, characterized in that: include: 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 according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.