Task allocation method

By obtaining the task queue in the distributed retrieval system and determining the target execution method based on the execution node, the problem of unbalanced allocation is solved, and the balanced allocation and efficient retrieval of tasks are achieved, which improves the retrieval performance and efficiency.

CN119166328APending Publication Date: 2024-12-20CHINA MOBILE INTERNET CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411090627.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

The existing distributed retrieval methods have allocation imbalances in task allocation, resulting in a low task allocation rate, affecting retrieval performance and efficiency.

Method used

By obtaining the task queue, determining candidate execution methods based on multiple execution nodes, and determining target execution methods in turn based on the execution order, achieving balanced allocation of tasks, avoiding local optimal solutions, ensuring global optimal allocation schemes, and reducing task planning complexity. Improve distribution flexibility and efficiency.

Benefits of technology

实现了任务的均衡分配,确保了高质量的时延服务,提高了任务分配的灵活性和效率,避免了单一执行节点过载,提升了检索性能。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166328A_ABST
    Figure CN119166328A_ABST
Patent Text Reader

Abstract

The invention discloses a task allocation method, and the method comprises the steps: obtaining at least one task queue, and enabling each task queue to comprise at least one task; for each task queue, determining at least one candidate execution mode corresponding to the task queue according to a plurality of execution nodes; and based on the execution sequence of each task queue, determining a target execution mode corresponding to each task queue according to the total expected execution time corresponding to each candidate execution mode in sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of information retrieval technology, distributed retrieval can improve retrieval speed and efficiency and return retrieval results to users in a timely manner. Current distributed retrieval usually uses index clusters, which are similar to distributed architectures. The retrieval and data are stored on the same server. However, this distributed retrieval method has the problem of unbalanced allocation when allocating retrieval tasks, resulting in a low task allocation rate, which in turn affects retrieval performance and efficiency. Summary of the invention

[0003] The embodiment of the present application provides a task allocation method, which can allocate multiple tasks in a balanced and efficient manner.

[0004] In a first aspect, an embodiment of the present application provides a task allocation method, the method comprising: obtaining at least one task queue, wherein each task queue includes at least one task; for each of the task queues, determining at least one candidate execution mode corresponding to the task queue according to multiple execution nodes; based on the execution order of each of the task queues, determining the target execution mode corresponding to each of the task queues in turn according to the total expected execution time corresponding to each of the candidate execution modes.

[0005] In second aspect, an embodiment of the present application provides a task allocation device, which includes: an acquisition module, used to acquire at least one task queue, wherein each task queue includes at least one task; a first determination module, used to determine, for each of the task queues, at least one candidate execution mode corresponding to the task queue according to multiple execution nodes; a second determination module, used to determine, based on the execution order of each of the task queues, the target execution mode corresponding to each of the candidate execution modes in turn according to the total expected execution time corresponding to each of the candidate execution modes.

[0006] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0008] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.

[0009] In an embodiment of the present application, at least one task queue is obtained, wherein each task queue includes at least one task, and then for each task queue, at least one candidate execution mode corresponding to the task queue is determined according to multiple execution nodes, and finally, based on the execution order of each task queue, the target execution mode corresponding to each task queue is determined in turn according to the total expected execution time corresponding to each candidate execution mode, thereby achieving balanced distribution of tasks, being able to find the global optimal distribution plan without falling into the local optimum, being able to ensure that each task obtains high-quality service guarantee in terms of latency, and performing task distribution in units of queues, thereby reducing the complexity of planning all tasks together and improving the flexibility and efficiency of task distribution. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Figure 1 It is a flowchart of a task allocation method provided in an embodiment of the present application;

[0011] Figure 2a It is an interactive schematic diagram of a distributed retrieval architecture provided in an embodiment of the present application;

[0012] Figure 2b is another flowchart of a task allocation method provided in an embodiment of the present application;

[0013] Figure 3 is a structural diagram of another task allocation device provided in an embodiment of the present application;

[0014] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0016] In the following, in conjunction with the accompanying drawings, a task allocation method provided by an embodiment of the present application is described in detail through specific embodiments and application scenarios.

[0017] Figure 1A task allocation method provided by an embodiment of the present application is shown, and the method can be executed by an electronic device, and the electronic device can include: a server and / or a terminal device. In other words, the method can be executed by software or hardware installed in the electronic device, and the method includes the following steps:

[0018] S110: Acquire at least one task queue.

[0019] Each task queue includes at least one task.

[0020] It is understandable that the multiple tasks are divided into at least one task queue, each task queue includes at least one task, so that the tasks can be allocated in queues.

[0021] Optionally, the type of the task may include but is not limited to: retrieval, order processing, data analysis, user request, etc.

[0022] S120: For each of the task queues, determine at least one candidate execution mode corresponding to the task queue according to multiple execution nodes.

[0023] It is understandable that the candidate execution mode refers to which execution node executes each task in the task queue. Exemplarily, it is assumed that the first task queue includes a first task, a second task, a third task, and a fourth task, and multiple execution nodes include a first node, a second node, and a third node, and each node can execute two tasks. Then the execution mode corresponding to the first task queue may include: the first task and the second task are executed by the first node, and the third task and the fourth task are executed by the second node; or, the first task is executed by the second node, the third task and the fourth task are executed by the first node, and the second task is executed by the third node; or, the third task is executed by the second node, the first task is executed by the first node, and the second task and the fourth task are executed by the third node, etc.

[0024] S130: Based on the execution order of each of the task queues, determine the target execution mode corresponding to each of the task queues according to the total expected execution time corresponding to each of the candidate execution modes.

[0025] Wherein, this execution order can be determined according to at least one of the following: the priority of the task, the arrival time of the task, the dependency between multiple tasks, the load situation of each execution node.It is understandable that, when determining the execution order of each described task queue according to the priority of the task, the task in the task queue with high priority will be executed first, and the task in the task queue with low priority may need to wait, therefore, the task in the task queue with high priority will give priority to determining the target execution mode, so that the execution node corresponding to the task with high priority is idle or has a lower load.When determining the execution order of each described task queue according to the arrival time of the task, the task in the task queue with early arrival time will be executed first, and the task in the task queue with late arrival time may need to wait, therefore, the task in the task queue with early arrival time will give priority to determining the target execution mode, so that the task that arrives first can be executed as soon as possible.In addition, there may also be a dependency between the tasks, that is, some tasks must be started to execute after other tasks are completed.Therefore, the execution order of each described task queue can be determined according to the dependency between the tasks. At the same time, the load capacity of each execution node may be different, so when allocating tasks, the load of each execution node should be kept balanced as much as possible to improve the overall execution efficiency. Therefore, the execution order of each task queue can be determined according to the load of each execution node and the priority and arrival time of each task. In practical applications, the execution order of each task queue can be dynamically determined according to information such as the priority of the task, the arrival time of the task, the dependency between multiple tasks, and the load of each execution node.

[0026] It should be noted that each task in each queue also has a corresponding execution order.

[0027] It can be understood that at least one candidate execution mode corresponding to each task queue is determined in S120, and different candidate execution modes may have different total expected execution times. Therefore, based on the execution order of each task queue, the target execution mode corresponding to each task queue can be determined in turn according to the total expected execution time corresponding to each candidate execution mode. That is, the task queue of the first execution order first determines the total expected execution time of each candidate execution mode, and then determines the target execution mode according to the total expected execution time corresponding to each candidate execution mode; then the task queue of the second execution order determines the total expected execution time of each candidate execution mode based on the target execution mode, and then determines the target execution mode according to the total expected execution time corresponding to each candidate execution mode; then the task queue of the third execution order continues to determine the total expected execution time of each candidate execution mode corresponding to the task queue based on the above-mentioned two target execution modes, and then determines the target execution mode according to the total expected execution time corresponding to each execution mode, and so on, until each task queue has determined the target execution mode.

[0028] In an embodiment of the present application, at least one task queue is obtained, wherein each task queue includes at least one task, and then for each task queue, at least one candidate execution mode corresponding to the task queue is determined according to multiple execution nodes, and finally, based on the execution order of each task queue, the target execution mode corresponding to each task queue is determined in turn according to the total expected execution time corresponding to each candidate execution mode, thereby achieving balanced distribution of tasks, being able to find the global optimal distribution plan without falling into the local optimum, being able to ensure that each task obtains high-quality service guarantee in terms of latency, and performing task distribution in units of queues, thereby reducing the complexity of planning all tasks together and improving the flexibility and efficiency of task distribution.

[0029] In one implementation, obtaining at least one task queue includes: obtaining multiple tasks at a preset sampling frequency within a preset time period; determining the number of tasks obtained per unit time based on the preset time period and the multiple tasks; and constructing at least one task queue based on the multiple tasks when the number of tasks obtained is greater than or equal to a first threshold.

[0030] It is understandable that the preset sampling frequency is used to represent the period of acquiring tasks. If the sampling frequency is set too high, the user will have to wait longer. If the sampling frequency is set too low, resource consumption will increase. Therefore, the preset sampling frequency can be set according to actual needs.

[0031] When the tasks received within the preset time period are greater than or equal to the first threshold value, at least one task queue can be constructed based on the multiple tasks, so that a single task queue can be prevented from being too long, causing the task allocation time to be lengthened, thereby causing the user waiting time to be lengthened. Wherein, the number of tasks included in each task queue can be equal. In addition, when constructing at least one task queue based on multiple tasks, it can be divided based on the arrival time of the tasks, and it can also be divided according to the priority order of the tasks.

[0032] Optionally, when the number of tasks received within a preset time period is greater than or equal to a first threshold, if it is determined that an execution node needs to execute multiple tasks, in order to avoid overloading of an execution node, which would result in decreased retrieval performance, the number of task queues to be constructed can be set to an integer multiple of the execution nodes.

[0033] In this implementation, when the number of acquired tasks is greater than or equal to the first threshold, multiple tasks are divided into at least one task queue, so that tasks can be allocated in queues, thereby improving the rate of task allocation.

[0034] Furthermore, the method also includes: when the number of tasks acquired is less than a first threshold, selecting at least one first execution node from the multiple execution nodes based on resource information of each of the execution nodes; and executing the multiple tasks through the at least one first execution node.

[0035] It can be understood that when the tasks received within a preset time period are less than a first threshold, it proves that the task amount is small, and at least one first execution node can be selected from the multiple execution nodes based on the resource information of each of the execution nodes, that is, the first execution node is the first number of execution nodes with the smallest load. In this way, multiple tasks can be quickly executed through the first number of execution nodes, thereby improving the efficiency of task processing.

[0036] In one implementation, determining at least one candidate execution mode corresponding to the task queue according to the multiple execution nodes may include the following steps:

[0037] Step 1: Determine at least one execution mode corresponding to the task queue through a probability transfer restriction condition.

[0038] Step 2: According to the total expected execution time corresponding to each execution mode, determine one of the candidate execution modes corresponding to the task queue from the at least one execution mode.

[0039] Step 3: Update the probability transfer restriction condition according to the candidate execution mode and the attenuation coefficient, and proceed to the step of determining at least one execution mode corresponding to the task queue through the probability transfer restriction condition, until the number of the candidate execution modes obtained meets the second threshold.

[0040] It is understandable that, for each task queue, in each round of search, multiple execution modes may be determined, and then candidate execution modes may be determined from the multiple execution modes, and then the probability transition restriction condition may be updated, and a new round of search may be continued based on the updated probability transition restriction condition until the number of the candidate execution modes obtained meets the second threshold. Optionally, the second threshold may be a preset maximum number of search rounds.

[0041] Among them, the probability transfer restriction condition can be set as:

[0042]

[0043] Among them, P j represents the selection probability of the next execution node j, γ represents the other execution nodes among multiple execution nodes except the assigned nodes, i.e., the remaining execution nodes, and w ij represents the weight between the currently traversed execution node i and the next execution node j, α represents the first calculation factor, and β represents the second calculation factor; n ij represents the heuristic function, whose value is equal to the ratio of the expected execution time to the load; similarly, n is It also represents the heuristic function; q represents a random number between [0, 1]; Q represents a pre-set selection parameter between (0, 1), Q is a constant; w is Indicates the weights between the currently traversed execution node i and other nodes s. In addition, each weight can be a pre-set value.

[0044] The updated probability transfer condition is to introduce the attenuation coefficient to update w in the above formula ij The update amount Δw is achieved best,ij It can be expressed by the following formula:

[0045]

[0046] in, represents the cumulative weight between any two adjacent execution nodes i and j among the execution nodes involved in the candidate execution mode; w best,ij 'Indicates updated Δw best,ij represents the update amount, Δw best,ij k represents the accumulated weight after (i, j); D2 represents the second constant term; Lbest represents the total execution distance corresponding to the candidate execution mode; ρ represents the attenuation coefficient, which can be determined by the following formula (5):

[0047]

[0048] Among them, ρ max represents the final value of the attenuation coefficient, ρ min represents the starting value of the attenuation coefficient, the final value and the starting value may be predetermined, π represents pi, t represents the current search round, and T represents the maximum search round.

[0049] In this implementation, each determined candidate execution method is a local optimal solution, not a global optimal solution. Therefore, it is necessary to update the probability transfer constraint conditions and determine the remaining local optimal solutions so as to determine the global optimal solution from multiple local optimal solutions based on the expected execution time of each local optimal solution.

[0050] In one implementation, determining at least one execution mode corresponding to the task queue by using a probability transfer limiting condition may include the following steps:

[0051] Step 1: through the probability transfer restriction condition, determine the execution node corresponding to each task in turn, and obtain an execution mode corresponding to the task queue.

[0052] Exemplarily, taking a task queue as an example, the task queue includes three tasks: a first task, a second task and a third task, wherein the execution order of the three tasks can be that the execution order of the first task is 1, the execution order of the second task is 2, and the execution order of the third task is 3. Then, when determining an execution mode corresponding to the task queue, starting from the starting node, the first task is assigned to the starting node, and then the next execution node is determined according to the probability transfer restriction condition, and the second task is assigned to the execution node, and the next execution node is determined according to the probability transfer restriction condition, and the third task is assigned to the execution node.

[0053] It should be noted that the allocation in this process refers to only recording the correspondence between tasks and execution nodes, not the actual allocation, which will not be elaborated later.

[0054] Step 2: When each execution mode is determined and there are execution nodes that have not been traversed among the multiple execution nodes, the probability transfer restriction condition is updated based on the attenuation coefficient, and the execution mode corresponding to the task queue is continued to be determined according to the updated probability transfer restriction condition.

[0055] It can be understood that in the process of determining the execution mode, if there are other nodes among multiple execution nodes that have not been searched, the next execution mode can be determined. However, in order to avoid exploring repeated execution modes, the weights between nodes, the distances between nodes, the node status, the task status, etc. can be considered during the exploration process, that is, it can be achieved by updating the probability transfer restriction conditions.

[0056] In one implementation, the execution node corresponding to each of the tasks is determined in turn through probability transfer restriction conditions to obtain an execution mode corresponding to the task queue, including: starting from the second execution node, according to the probability transfer restriction conditions, the execution node with the highest probability is selected in turn from the multiple execution nodes to expand until the execution node corresponding to each of the tasks in the task queue is determined, to obtain an execution mode corresponding to the task queue; wherein the second execution node is the execution node with the smallest load among the multiple execution nodes.

[0057] It can be understood that the execution node with the smallest load can be used as the starting node. Starting from the starting node, each time a task is assigned, the selection probability of other nodes is determined at the current traversal node based on the probability transfer restriction condition, and then expanded to the execution node with the largest selection probability until all tasks have been assigned.

[0058] In this implementation, decisions can be made quickly based on the current task and the status of each execution node, avoiding time-consuming complete exhaustive enumeration or random allocation, so that task allocation can be completed in a short time and overall efficiency can be improved. At the same time, by limiting the conditions through probabilistic transfer and based on the task status and execution node status, the optimal execution node is selected, which helps to optimize resource utilization and avoid excessive allocation or waste of resources, thereby improving the overall utilization and performance of the system.

[0059] In one implementation, the method further includes: updating the probability transfer restriction condition based on the attenuation coefficient each time when traversing one of the execution nodes.

[0060] It is understandable that in order to prevent the accumulation of excessive weights from covering up the heuristic information and thus affecting subsequent exploration, the weight needs to be updated after passing through an execution node. The weight can be updated by introducing a decay coefficient. For example, the decay coefficient can update the weight between the currently traversed execution node i and the next execution node j:

[0061] w ij '=(1-ρ)*w ij +Δw ij (6)

[0062]

[0063]

[0064] Among them, w ij The sum of the previous weights between the currently traversed execution node i and the next execution node j, ρ represents the attenuation coefficient. The formula for determining the attenuation coefficient can refer to the above formula (5), w ij 'Indicates the updated w ij , Δw ij Denotes the weight increment, Δw ij k represents the weight increment of the kth task queue between the currently traversed execution node i and the next execution node j, n represents the total number of task queues, D1 represents the first constant term, d ij Indicates the distance between the currently traversed execution node i and the next execution node j.

[0065] Optionally, the distance d between the currently traversed execution node i and the next execution node j ij It can be expressed by the following formula:

[0066] d ij =δ 1,ij +δ 2,ij (9)

[0067]

[0068] Among them, δ 1,ij Indicates the data length L corresponding to the next task to be assigned i The processing speed V corresponding to the next execution node j j The ratio between 2,ij Indicates the storage size G corresponding to the next task to be assigned i The bandwidth F corresponding to the next execution node j j The ratio between .

[0069] In one implementation, the method further includes: when passing through the multiple execution nodes and the number of execution methods obtained is less than a third threshold, updating the probability transfer limitation condition based on the attenuation coefficient, and continuing to determine the execution method corresponding to the task queue according to the updated probability transfer limitation condition.

[0070] It can be understood that in a certain search round, if all execution nodes are searched, but the number of execution methods obtained is less than the third threshold, then the probability transfer restriction condition can be continued to be updated, and other execution methods corresponding to the task queue can be continued to be determined according to the updated probability transfer restriction condition.

[0071] In one implementation, a target execution mode corresponding to each of the task queues is determined based on the total expected execution time corresponding to each candidate execution mode, including: calculating the total expected execution time of each of the candidate execution modes based on the task information of each of the tasks in each of the candidate execution modes and the remaining service capacity of each related execution node, wherein each of the related execution nodes is an execution node corresponding to each of the candidate execution modes; and selecting the target execution mode corresponding to the task queue from at least one of the candidate execution modes corresponding to each of the task queues based on the total expected execution time.

[0072] The total expected execution time is the sum of the expected execution times corresponding to the relevant execution nodes, and the expected execution time corresponding to each relevant execution node is the difference between the data length of the corresponding task and the remaining service capacity of the relevant execution node. After obtaining the total expected execution time, the candidate execution mode with the smallest total expected execution time can be determined as the target execution mode.

[0073] Optionally, the remaining service capacity of the relevant execution node can be determined in the following manner: using a pre-deployed target model to identify the operating characteristics corresponding to the execution node j, and obtaining the remaining service capacity of the execution node j. The operating characteristics corresponding to the execution node j include but are not limited to the number of processor cores, the maximum frequency of each core, the operating frequency of each core, the number of tasks processed, the total amount of memory, and the remaining amount of memory. Among them, the target model can be based on a preset neural network model, and the operating characteristics are used as the model input, and the remaining service capacity is used as the output for training, so as to obtain a target model with computing capabilities.

[0074] In addition, if the dimensions of the identified operation features are small, the BP neural network can be used to pre-build the target model and initialize its hyperparameters. Then, the BP neural network is trained using the historical operation features and the corresponding manually calibrated computing power to obtain the trained target model.

[0075] In this implementation, after determining at least one candidate execution mode, the total expected execution time of each candidate execution mode is determined, so that the candidate execution mode with the smallest total expected execution time is determined as the target execution mode, which helps to ensure that the task is completed on time and the execution node resources are used efficiently.

[0076] In one implementation, the method further includes: each time a target execution mode corresponding to the task queue is determined, based on the target execution mode and task information of each task corresponding to the task queue, updating the remaining service capacity of each related execution node.

[0077] In this implementation, in order to more accurately estimate the total expected execution time of each candidate execution mode corresponding to the subsequent task queue, the remaining service capacity of each relevant execution node can be updated according to the existing target execution mode and the task information of the corresponding task, thereby further improving the accuracy of the subsequent task queue in determining the target execution mode.

[0078] In one implementation, the method further includes: merging the at least one task queue into at least one task group, wherein each task group includes at least one task queue, wherein the number of the task groups is the same as the number of the execution nodes; and determining the execution node corresponding to each task group by corresponding the task groups to the execution nodes one-to-one.

[0079] It is understandable that in order to speed up the planning, at least one task queue can be merged into multiple task groups, so that the number of task groups is the same as the number of execution nodes. When a subtask group is placed every time an execution node is reached, only one round of placement is required. For example: there are execution nodes A1-A10, and there are task queues: B1-B10, then B1 is placed on execution node A1, B2 is placed on execution node A2, and so on. In this way, it is also possible to effectively avoid overloading of a single execution node, thereby ensuring the stability of retrieval performance.

[0080] The above embodiments are described in detail below through an illustrative application scenario.

[0081] The present application embodiment provides a distributed retrieval architecture, such as Figure 2aAs shown, it includes an interaction layer, a retrieval layer and a storage layer, wherein the interaction layer can be set as a WebServer, which provides functions such as input of query conditions and display of query results to users through a Web interface, and then parses the query conditions entered by the user through the Web interface, converts them into a request format defined by the retrieval layer, and then sends them to the retrieval layer for execution. After the retrieval layer obtains a response, it renders the result into an HTML page and finally displays it to the user. The retrieval layer can be set as a plurality of retrieval servers arranged in a distributed architecture, which is the core part of distributed information retrieval. The retrieval layer implements related operations such as resource selection, query distribution and result fusion. Each retrieval server in the retrieval layer can access the data in the storage server to realize distributed retrieval. The storage layer can be set as a server cluster, which provides storage and retrieval service support for the retrieval layer. The retrieval layer can submit query requests to the resource library during the query distribution process and obtain the query results of the resource library. In this storage architecture, the storage layer only provides a query interface but does not perform retrieval tasks. The retrieval tasks are distributed in the distributed retrieval architecture provided by the retrieval layer. Therefore, a high-speed and high-bandwidth communication channel is required between the storage layer and the retrieval layer, which can effectively reduce the data processing resource consumption of the storage layer. The setting of the retrieval layer can improve the ability to process retrieval tasks, thereby enhancing the user retrieval experience.

[0082] In addition, although the use of a distributed architecture retrieval server for retrieval can enhance the ability to process retrieval tasks, too many retrieval tasks concentrated on a certain retrieval server will lead to a decrease in retrieval performance. Therefore, it is necessary to schedule the retrieval tasks to ensure retrieval performance. In one implementation, a retrieval task allocation server can be built in the retrieval layer, and the remaining retrieval servers serve as retrieval task execution servers, which perform retrieval in the storage layer using a pre-set retrieval algorithm to implement the execution of retrieval tasks. The retrieval tasks are received by the retrieval task allocation server, and the retrieval tasks are allocated at a certain frequency, thereby ensuring that the retrieval tasks on each retrieval task execution server are relatively balanced. When the retrieval tasks received by the entire retrieval layer have not reached the overall upper limit, the retrieval performance will not be reduced due to the high load of a certain retrieval task execution server.

[0083] Below through Figure 2b , the working principle of the above retrieval layer is explained, which may include the following steps:

[0084] S210: The search task allocation server collects the search tasks transmitted by the interaction layer according to a preset sampling frequency to obtain a queue of search tasks to be executed.

[0085] The sampling frequency is used to indicate the period for obtaining the queue of retrieval tasks to be executed. If the sampling frequency is set too high, the user will have to wait longer; if the sampling frequency is set too low, the resource consumption of the retrieval task allocation server will increase. Therefore, the sampling frequency can be set according to actual needs.

[0086] When the number of retrieval tasks received by the retrieval task allocation server per unit time is less than a preset threshold, it proves that the access volume at this time is small, and there is no need to balance the retrieval tasks. The retrieval tasks can be randomly allocated to different retrieval task execution servers, or the retrieval tasks can be randomly allocated to different retrieval task execution servers with the smallest load.

[0087] When the number of retrieval tasks received by the retrieval task allocation server per unit time exceeds a preset threshold, a fixed number of retrieval tasks can be used to form a queue of retrieval tasks to be executed, thereby avoiding a single queue of retrieval tasks to be executed being too long, resulting in longer task allocation time and thus longer user waiting time.

[0088] In addition, when the number of retrieval tasks received by the retrieval task allocation server in a unit time exceeds a preset threshold, a retrieval task execution server needs to execute several retrieval tasks, which proves that the allocation of retrieval tasks needs to be optimized to avoid overloading of a retrieval task execution server, resulting in a decrease in retrieval performance. For subsequent task allocation, the queue of retrieval tasks to be executed can be an integer multiple of the number of retrieval task execution servers.

[0089] S220: construct multiple task allocators for the retrieval task queue to be executed, each task allocator uses the retrieval task execution server with the smallest current load as a starting node to perform task allocation search.

[0090] Each retrieval task execution server uploads its load to the retrieval task allocation server in real time.

[0091] S230: For each task allocation machine, the task allocation machine carries all the retrieval tasks in the to-be-executed retrieval task queue and starts from the starting node.

[0092] At this time, a first counter m=1 may be set.

[0093] S240: According to the pre-set probability transfer limiting conditions, each task allocation machine is caused to proceed to the next retrieval task execution server.

[0094] The probability transfer limiting condition can refer to the above formula (1). In this embodiment, P in formula (1) j represents the selection probability of retrieval task execution server j, γ represents the set of retrieval task execution servers outside the assigned node table, and wij represents the weight between the retrieval task execution server i where the task allocation machine is currently located and the retrieval task execution server j, α represents the first calculation factor, and β represents the second calculation factor; n ij represents the heuristic function, whose value is equal to the ratio of the expected execution time to the load; similarly, n is It also represents the heuristic function. q represents a random number between [0, 1]; Q represents a pre-set selection parameter between (0, 1), Q is a constant; w is It represents the weight between the retrieval task execution server i where the task allocation machine is currently located and the retrieval task execution server s. The weight can be a unified initial value or a preset value.

[0095] When each task dispatching machine reaches a retrieval task execution server, it places the first task in the retrieval task queue to be executed on the retrieval task execution server and adds the retrieval task execution server to the allocated node table. Each task dispatching machine corresponds to an allocated node table. Finally, the count value of the first counter m is increased by one.

[0096] At the same time, in order to prevent the accumulation of too large weights from covering up the heuristic information and thus affecting the search of the subsequent task allocation machine, when the task allocation machine passes through a retrieval task execution server or all retrieval task execution servers, the weight needs to be updated. By introducing the attenuation coefficient, the weight will gradually decrease after a period of change. The weight of the task allocation machine's moving path can be updated by referring to the above formulas (5), (6) and (7), where, in this embodiment, w ij represents the unupdated weight between retrieval task execution server i and retrieval task execution server j, ρ represents the decay coefficient, and w ij 'Indicates the updated w ij , Δw ij Denotes the weight increment, Δw ij k represents the weight increment generated by the kth task dispatcher between the retrieval task execution server i and the retrieval task execution server j, n represents the total number of task dispatchers, D1 represents the first constant term, d ij Represents the distance between retrieval task execution server i and retrieval task execution server j.

[0097] In order to improve both the allocation effect and the allocation speed, a larger attenuation coefficient is set in the early stage to improve the global search ability of the algorithm. When the algorithm enters the middle and late stages, the attenuation coefficient is gradually reduced to improve the convergence speed of the algorithm and search for the global optimal solution more quickly. The attenuation coefficient can be determined according to the above formula (5).

[0098] Optionally, the execution distance d between the retrieval task execution server i and the retrieval task execution server j is ij It can be determined by the above formulas (6), (7) and (8), where, in this embodiment, δ 1,ij The data length L corresponding to the next retrieval task to be assigned in the task dispatcher on the retrieval task execution server i is i The processing speed V corresponding to the retrieval task execution server j j The ratio between 2,ij represents the storage size G corresponding to the next retrieval task to be assigned in the task dispatcher located on the retrieval task execution server i i The bandwidth F corresponding to the retrieval task execution server j j The ratio between .

[0099] S250, determine whether there are still retrieval task execution servers that the task dispatcher has not reached.

[0100] If so, continue to move forward, otherwise clear the allocated node table and judge the count value of the first counter m; and judge whether the count value of the first counter m reaches the total number of retrieval tasks in the retrieval task queue to be executed. If so, enter step S260, otherwise return to step S240.

[0101] At this time, no matter how many retrieval tasks are in the retrieval task queue to be executed, it will not affect the task allocation.

[0102] S260: In the current search, the best allocation scheme is obtained from among all allocation schemes generated by the task allocation machines.

[0103] The expected execution time corresponding to a single retrieval task can be obtained by dividing the data length of the retrieval task by the current computing power of the retrieval task execution server j. All expected execution times in the allocation plan can be added together to obtain the total expected execution time corresponding to the allocation plan. The allocation task with the smallest total expected execution time can be taken as the optimal allocation plan.

[0104] Optionally, the method for acquiring the current computing capacity of the retrieval task execution server j may include: using a pre-deployed computing capacity acquisition model to identify the operating characteristics corresponding to the retrieval task execution server j, and acquiring the current computing capacity of the retrieval task execution server j. The operating characteristics corresponding to the retrieval task execution server j at least include the number of processor cores, the maximum frequency of each core, the operating frequency of each core, the number of retrieval tasks, the total amount of memory, and the remaining amount of memory. The computing capacity acquisition model can be a pre-trained neural network model, which is trained with operating characteristics as input and computing capacity as output, so as to have the recognition effect of computing capacity.

[0105] For the paths involved in the optimal allocation solution, the weights are updated twice, and reference may be made to the aforementioned formulas (2), (3) and (4), where, in this embodiment, represents the cumulative weight between any two adjacent retrieval task execution servers i and j in the path involved in the optimal allocation solution, w best,ij 'Indicates updated Δw best,ij represents the update amount, Δw best,ij k represents the accumulated weight of the task allocation machine after (i, j), D2 represents the second constant term, L best Indicates the total execution distance corresponding to the optimal allocation solution.

[0106] S270, determining whether the current search times have reached the maximum search times.

[0107] If yes, then obtain the optimal allocation solution, otherwise return to step S230.

[0108] The retrieval tasks are allocated based on the optimal allocation plan. After the retrieval task execution server executes the retrieval task, the retrieval results are directly fed back to the user's interactive layer without passing through the retrieval task allocation server, thereby reducing the operating pressure of the retrieval task allocation server.

[0109] S280: Obtain an optimal allocation plan.

[0110] In another implementation, in order to speed up the allocation, the tasks can be merged into multiple subtask groups, so that the number of subtask groups is the same as the number of retrieval task execution servers. A subtask group is placed every time a retrieval task execution server is reached, and only one round of placement is required. For example: there are retrieval task execution servers A1-A10, and there are tasks B1-B25, then B1, B11, and B21 are merged into one subtask group, and B2, B12, and B22 are merged into one subtask group, and so on. The performance of each retrieval task execution server is different. On the basis of the optimal allocation plan, even if the subtask group is allocated, it can effectively avoid overloading of a single retrieval task execution server, thereby ensuring the stability of the retrieval performance.

[0111] In this embodiment, the storage part is separated from the retrieval part through a three-tier storage architecture, and a distributed retrieval server is used to perform retrieval tasks, which can effectively improve the retrieval efficiency and thus improve the user experience. At the same time, the retrieval layer architecture composed of the retrieval task allocation server and the retrieval task execution server can realize the orderly allocation of retrieval tasks, and the retrieval task allocation algorithm proposed in this application can effectively avoid the overload of a single retrieval task execution server, thereby causing the performance of the retrieval layer to decline. The retrieval task allocation algorithm takes into account both the allocation speed and the allocation effect, and allocates the retrieval task based on the weight, which can find the best allocation plan more quickly.

[0112] Figure 3 A schematic diagram of the structure of a task allocation device provided by an embodiment of the present application is shown as follows: Figure 3 As shown, the task allocation device 300 may include: an acquisition module 310 , a first determination module 320 and a second determination module 330 .

[0113] In this embodiment, an acquisition module 310 is used to acquire at least one task queue, wherein each task queue includes at least one task; a first determination module 320 is used to determine, for each of the task queues, at least one candidate execution mode corresponding to the task queue according to multiple execution nodes; a second determination module 330 is used to determine, based on the execution order of each of the task queues, the target execution mode corresponding to each of the candidate execution modes in turn according to the total expected execution time corresponding to each of the candidate execution modes.

[0114] In one implementation, the acquisition module 310 is specifically used to acquire multiple tasks at a preset sampling frequency within a preset time period; determine the number of tasks acquired per unit time based on the preset time period and the multiple tasks; and build at least one task queue based on the multiple tasks when the number of tasks acquired is greater than or equal to a first threshold.

[0115] In one implementation, the task allocation device 300 may also include: a selection module, which is used to select at least one first execution node from the multiple execution nodes based on the resource information of each of the execution nodes when the number of tasks acquired is less than a first threshold; and execute the multiple tasks through the at least one first execution node.

[0116] In one implementation, the first determination module 320 is specifically used to: determine at least one execution mode corresponding to the task queue through a probability transfer qualification condition; determine one of the candidate execution modes corresponding to the task queue from the at least one execution mode according to the total expected execution time corresponding to each execution mode; update the probability transfer qualification condition according to the candidate execution mode and the attenuation coefficient, and proceed to the step of determining at least one execution mode corresponding to the task queue through the probability transfer qualification condition, until the number of the obtained candidate execution modes meets the second threshold.

[0117] In one implementation, the first determination module 320 is specifically used to: determine the execution node corresponding to each of the tasks in turn through the probability transfer limitation condition, and obtain an execution mode corresponding to the task queue; when each execution mode is determined and there are execution nodes that have not been traversed among the multiple execution nodes, update the probability transfer limitation condition based on the attenuation coefficient, and continue to determine the execution mode corresponding to the task queue according to the updated probability transfer limitation condition.

[0118] In one implementation, the first determination module 320 is specifically used to: start from the second execution node, select the execution node with the highest probability from the multiple execution nodes in turn according to the probability transfer restriction condition, and expand until the execution nodes corresponding to each of the tasks in the task queue are determined, thereby obtaining an execution mode corresponding to the task queue; wherein the second execution node is the execution node with the smallest load among the multiple execution nodes.

[0119] In one implementation, the task allocation device 300 may further include: a first updating module, configured to update the probability transfer restriction condition based on the attenuation coefficient each time when traversing one of the execution nodes.

[0120] In one implementation, the task allocation device 300 may also include: a second update module, which is used to update the probability transfer limitation condition based on the attenuation coefficient when passing through the multiple execution nodes and the number of execution methods obtained is less than a third threshold, and continue to determine the execution method corresponding to the task queue according to the updated probability transfer limitation condition.

[0121] In one implementation, the second determination module 330 is specifically used to: calculate the total expected execution time of each of the candidate execution modes based on the task information of each of the tasks in each of the candidate execution modes and the remaining service capacity of each related execution node, wherein each of the related execution nodes is an execution node corresponding to each of the execution modes; and select the target execution mode corresponding to the task queue from at least one of the candidate execution modes corresponding to each of the task queues according to the total expected execution time.

[0122] In one implementation, the task allocation device 300 may also include: a third update module, which is used to update the remaining service capacity of each of the relevant execution nodes based on the target execution mode and the task information of each task corresponding to the task queue each time a target execution mode corresponding to the task queue is determined.

[0123] In one implementation, the task allocation device 300 may also include: a grouping module, used to merge the at least one task queue into at least one task group, wherein each task group includes at least one task queue, wherein the number of the task groups is the same as the number of the execution nodes; by corresponding the task groups to the execution nodes one by one, determining the execution node corresponding to each task group.

[0124] A task allocation device provided in an embodiment of the present application can implement each process implemented in the task allocation method embodiment, and will not be described again here to avoid repetition.

[0125] The task allocation device in the embodiment of the present application may be a device, or a component, an integrated circuit, or a chip in an electronic device. The embodiment of the present application does not specifically limit this.

[0126] The task allocation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0127] Optional, such as Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 410, a memory 420, and a program or instruction stored in the memory 420 and executable on the processor 410. When the program or instruction is executed by the processor 410, each process of the above-mentioned task allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0128] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned task allocation method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0129] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0130] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned task allocation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0131] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0132] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device 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, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A task allocation method, characterized in that: The method comprises: Obtain at least one task queue, wherein each task queue includes at least one task; For each of the task queues, determining at least one candidate execution mode corresponding to the task queue according to a plurality of execution nodes; Based on the execution order of each of the task queues, the target execution mode corresponding to each of the task queues is determined in turn according to the total expected execution time corresponding to each of the candidate execution modes.

2. The method according to claim 1, characterized in that The obtaining of at least one task queue includes: Acquire multiple tasks at a preset sampling frequency within a preset time period; Determine the number of tasks to be acquired per unit time according to the preset time period and the plurality of tasks; When the number of acquired tasks is greater than or equal to a first threshold, at least one task queue is constructed based on the plurality of tasks.

3. The method according to claim 2, characterized in that The method further comprises: When the number of acquired tasks is less than a first threshold, selecting at least one first execution node from the plurality of execution nodes according to resource information of each of the execution nodes; The plurality of tasks are executed by the at least one first execution node.

4. The method according to claim 1, characterized in that: The determining, according to the plurality of execution nodes, at least one candidate execution mode corresponding to the task queue includes: Determining at least one execution mode corresponding to the task queue through a probability transfer limiting condition; Determining, from the at least one execution mode, one of the candidate execution modes corresponding to the task queue according to the total expected execution time corresponding to each execution mode; According to the candidate execution modes and the attenuation coefficient, the probability transfer restriction condition is updated, and the step of determining at least one execution mode corresponding to the task queue through the probability transfer restriction condition is performed until the number of the obtained candidate execution modes meets the second threshold.

5. The method according to claim 4, characterized in that The determining, by means of a probability transfer limiting condition, at least one execution mode corresponding to the task queue includes: By means of probability transfer limiting conditions, the execution node corresponding to each of the tasks is determined in turn, and an execution mode corresponding to the task queue is obtained; When each execution mode is determined and there are execution nodes that have not been traversed among the multiple execution nodes, the probability transfer restriction condition is updated based on the attenuation coefficient, and the execution mode corresponding to the task queue is continued to be determined according to the updated probability transfer restriction condition.

6. The method according to claim 4, characterized in that The method further comprises: Each time when one of the execution nodes is traversed, the probability transition restriction condition is updated based on the attenuation coefficient.

7. The method according to claim 4, characterized in that The method further comprises: When passing through the multiple execution nodes and the number of execution modes obtained is less than the third threshold, the probability transfer restriction condition is updated based on the attenuation coefficient, and the execution mode corresponding to the task queue is continued to be determined according to the updated probability transfer restriction condition.

8. The method according to claim 1, characterized in that Determining the target execution mode corresponding to each of the task queues according to the total expected execution time corresponding to each of the candidate execution modes includes: Based on the task information of each task in each candidate execution mode and the remaining service capacity of each relevant execution node, the total expected execution time of each candidate execution mode is calculated, wherein each relevant execution node is an execution node corresponding to each execution mode; According to the total expected execution time, the target execution mode corresponding to the task queue is selected from the at least one candidate execution mode corresponding to each task queue.

9. The method according to claim 8, characterized in that The method further comprises: In each case where a target execution mode corresponding to the task queue is determined, the remaining service capacity of each of the related execution nodes is updated based on the target execution mode and the task information of each of the tasks corresponding to the task queue.

10. The method according to claim 1, characterized in that The method further comprises: Merging the at least one task queue into at least one task group, wherein each task group includes at least one task queue, and wherein the number of the task groups is the same as the number of the execution nodes; By making a one-to-one correspondence between the task groups and the execution nodes, the execution node corresponding to each task group is determined.