Load balancing task execution method and device, computer equipment, readable storage medium and program product

By conducting task checks before executing load balancing tasks in a distributed system, ensuring that the system status is suitable for execution of tasks, solving the problem that load balancing tasks in the existing technology affects system stability and improving task execution efficiency.

CN119645652APending Publication Date: 2025-03-18CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411790713.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art fails to effectively consider the system status when performing load balancing tasks of distributed systems, resulting in affecting the stability and availability of distributed systems, thereby reducing the execution efficiency of load balancing tasks.

Method used

Before executing load balancing tasks, the load balancing task is determined by obtaining the sharded view and service node view of the distributed system, and performing task checks to ensure that the system state is suitable for executing tasks.

Benefits of technology

Avoid executing load balancing tasks in unsuitable system states through task inspection, improving the stability and availability of distributed systems, thereby improving the execution efficiency of load balancing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645652A_ABST
    Figure CN119645652A_ABST
Patent Text Reader

Abstract

The invention relates to a load balancing task execution method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps that a fragment view and a service node view of the distributed system are acquired, the fragment view is used for representing first load information and distribution condition information of all fragments in the distributed system, and the service node view is used for representing service nodes contained in the distributed system and second load information and state information of all the service nodes; a load balancing task of the distributed system is determined according to the fragment view and the service node view, task checking is conducted on the load balancing task to obtain a target checking result, and the task checking is used for checking whether the current state of the distributed system is a state suitable for executing the load balancing task or not; and under the condition that the target check result indicates that the check is passed, executing the load balancing task by utilizing a task management module of the distributed system. By adopting the method, the execution efficiency of the load balancing task can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of distributed systems, and in particular to a method, apparatus, computer device, computer-readable storage medium, and computer program product for executing a load balancing task. Background Art

[0002] In a distributed system, the load balancing of each service node affects the stability and availability of the entire distributed system cluster. Therefore, it is necessary to monitor the status and load of each service node to generate corresponding load balancing tasks, thereby achieving load balancing of each service node.

[0003] In the prior art, most of the services in the distributed system are monitored in real time, corresponding load balancing tasks are generated according to the monitoring results, and the load balancing tasks are executed to achieve load balancing.

[0004] However, this approach will affect the stability and availability of the distributed system, resulting in lower efficiency in the execution of load balancing tasks. Summary of the invention

[0005] Based on this, it is necessary to provide a more efficient load balancing task execution method, device, computer equipment, computer readable storage medium and computer program product to address the above technical problems.

[0006] In a first aspect, the present application provides a load balancing task execution method, comprising:

[0007] Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0008] Determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0009] When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

[0010] In one of the embodiments, the load balancing task is checked to obtain a target check result, including: checking whether there is a global task in the distributed system to obtain a first check result; when the first check result indicates that there is no global task in the distributed system, determining the target check result based on the load balancing task.

[0011] In one of the embodiments, the target inspection result is determined according to the load balancing task, including: determining a target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task; checking whether the target shard has a target task, which is a task in execution state in the distributed system; and if the target task does not exist in the target shard, determining that the target inspection result is inspection passed.

[0012] In one of the embodiments, the load balancing task of the distributed system is determined based on the shard view and the service node view, including: determining whether there is a new service node or a failed service node in the distributed system based on the service node view; when it is determined that there is a new service node or a failed service node in the distributed system, generating a shard balancing task based on the distribution information and the first load information, and generating a service node balancing task based on the status information and the second load information; and determining the shard balancing task and the service node balancing task as the load balancing task.

[0013] In one of the embodiments, the method further includes: when the load balancing task meets preset conditions, splitting the load balancing task to obtain multiple subtasks; executing the multiple subtasks using the task management module, and determining that the load balancing task is completed when the multiple subtasks are all completed.

[0014] In one of the embodiments, the method further includes: when performing a task check on the load balancing task, obtaining the number of concurrent tasks in the load balancing task; and when the number of tasks is greater than a preset number threshold, determining that the target inspection result is an inspection failure.

[0015] In a second aspect, the present application also provides a load balancing task execution device, including:

[0016] An acquisition module is used to acquire a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0017] A determination module, used to determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0018] The execution module is used to execute the load balancing task by using the task management module of the distributed system when the target inspection result indicates that the inspection is passed.

[0019] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any embodiment of the first aspect when executing the computer program.

[0020] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any embodiment of the first aspect above.

[0021] In a fifth aspect, the present application further provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in any embodiment of the first aspect above.

[0022] The above-mentioned load balancing task execution method, apparatus, computer equipment, computer-readable storage medium and computer program product first obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize the first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize the service nodes included in the distributed system, as well as the second load information and status information of each service node; then, the load balancing task of the distributed system is determined based on the shard view and the service node view, and a task check is performed on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task; when the target check result indicates that the check has passed, the load balancing task is executed using the task management module of the distributed system. The load balancing task execution method provided in the present application will perform a task check on the load balancing task after executing the load balancing task, and will only execute the load balancing task if the check passes. Since the task check can check whether the current state of the distributed system is suitable for executing the load balancing task, it can avoid executing the load balancing task when the state of the distributed system is not suitable for executing the load balancing task, resulting in problems affecting the stability and availability of the distributed system, thereby effectively improving the efficiency of load balancing task execution. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 A schematic diagram of a flow chart of a method for executing a load balancing task in an embodiment;

[0025] Figure 2 A flowchart of a method for performing task inspection on the load balancing task to obtain a target inspection result in one embodiment;

[0026] Figure 3 A flowchart of a method for determining the target inspection result according to the load balancing task in an embodiment;

[0027] Figure 4 A flow chart of a method for determining a load balancing task of the distributed system according to the shard view and the service node view in one embodiment;

[0028] Figure 5 A flowchart of a method in an embodiment when the load balancing task meets a preset condition;

[0029] Figure 6 It is a flowchart of a method for performing task checking on the load balancing task in one embodiment;

[0030] Figure 7 A schematic diagram of a flow chart of a method for executing a load balancing task in another embodiment;

[0031] Figure 8 It is a structural block diagram of a load balancing task execution device in one embodiment;

[0032] Fig. 9 is an internal structure diagram of a computer device in one embodiment;

[0033] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

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

[0035] In a distributed system, the load balancing of each service node affects the stability and availability of the entire distributed system cluster. Therefore, it is necessary to monitor the status and load of each service node to generate corresponding load balancing tasks, thereby achieving load balancing of each service node.

[0036] In the prior art, most of the services nodes in the distributed system are monitored in real time, corresponding load balancing tasks are generated according to the monitoring results, and the load balancing tasks are executed to achieve load balancing.

[0037] However, this method does not consider the impact of the distributed system resources occupied during the execution of the load balancing task on the stability and availability of the distributed system when executing the load balancing task, which leads to low efficiency in the execution of the load balancing task.

[0038] In view of this, the present application provides a load balancing task execution method, which performs a task check on the load balancing task before executing the load balancing task to avoid the impact of the execution of the load balancing task on the stability and availability of the distributed system, thereby effectively improving the efficiency of the load balancing task execution.

[0039] The load balancing task execution method provided in the present application can be executed by a computer device, which can be a terminal or a server.

[0040] In an exemplary embodiment, Figure 1 As shown, a load balancing task execution method is provided, the method comprising the following steps:

[0041] Step 101: Obtain a shard view and a service node view of a distributed system.

[0042] Among them, the shard view is used to characterize the first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize the service nodes included in the distributed system, as well as the second load information and status information of each service node.

[0043] The distributed system is a computer system architecture that can connect multiple independent service nodes together through a network to achieve collaborative work.

[0044] Sharding is to divide a large data set into multiple smaller, relatively independent data subsets according to specific rules. These subsets are called shards. Each shard can be stored, managed, and processed independently.

[0045] Optionally, the first load information can be used to indicate the amount of data carried by each shard, and the distribution information is used to indicate the amount of shards distributed on each service node in the distributed system.

[0046] The second load information may be used to indicate the amount of data carried by each service node. The status information is used to indicate whether the service node is available.

[0047] In some exemplary embodiments, a monitoring management platform or monitoring management tool of a distributed system may be used to obtain a shard view and a service node view of the distributed system at the current moment.

[0048] Step 102: determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result.

[0049] The task check is used to check whether the current state of the distributed system is suitable for executing the load balancing task.

[0050] Optionally, the load balancing task may be a task for making the distributed system reach a load balancing state.

[0051] The target inspection result may include a first result and a second result, wherein the first result is used to characterize that the current state of the distributed system is suitable for executing the load balancing task, and the second result is used to characterize that the current state of the distributed system is not suitable for executing the load balancing task.

[0052] For example, since the load balancing task may involve migrating or merging data on some shards or service nodes, and there are other tasks in the distributed system that may be using the data that needs to be processed, if the distributed system is not checked, it may cause conflicts between the load balancing task and other tasks, thereby affecting the stability and availability of the distributed system operation.

[0053] In some exemplary embodiments, after obtaining the shard view and service node view of the distributed system at the current moment, it is possible to first determine whether the distributed system is currently in a load balancing state based on the first load information and the second load information.

[0054] Further, when it is determined that the distributed system is not currently in a load balancing state, a load balancing task can be generated, and after the load balancing task is generated, a task check process is performed based on the load balancing task to determine whether the current state of the distributed system is a state suitable for executing the load balancing task. Specifically, it can be detected whether there are other tasks other than the load balancing task in the distributed system to determine whether the current state of the distributed system is a state suitable for executing the load balancing task.

[0055] Step 103: When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

[0056] Optionally, as described above, the target inspection result may include a first result and a second result. When the target inspection result indicates that the inspection is passed, that is, the target inspection result is the first result.

[0057] The task management module may be a TaskManager module, which has pre-set management logic built into it.

[0058] In some exemplary embodiments, after performing a task check on the load balancing task to obtain a target check result and determining that the target check result indicates that the check has passed, the task management module in the distributed system is used to execute the load balancing task so that the state of the distributed system is changed to a load balancing state, thereby improving the processing performance of the distributed system.

[0059] The above-mentioned load balancing task execution method first obtains the shard view and service node view of the distributed system, the shard view is used to characterize the first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize the service nodes included in the distributed system, as well as the second load information and status information of each service node; then the load balancing task of the distributed system is determined according to the shard view and the service node view, and the load balancing task is checked to obtain the target check result, the task check is used to check whether the current state of the distributed system is suitable for executing the load balancing task; when the target check result indicates that the check is passed, the task management module of the distributed system is used to execute the load balancing task. The load balancing task execution method provided by the present application will perform a task check on the load balancing task after executing the load balancing task, and will only execute the load balancing task if the check is passed. Since the task check can check whether the current state of the distributed system is suitable for executing the load balancing task, it can avoid executing the load balancing task when the state of the distributed system is not suitable for executing the load balancing task, resulting in problems that affect the stability and availability of the distributed system, thereby effectively improving the efficiency of the execution of the load balancing task.

[0060] In an exemplary embodiment, Figure 2 As shown, the load balancing task is checked to obtain a target check result, including the following steps:

[0061] Step 201: Check whether there is a global task in the distributed system to obtain a first check result.

[0062] Optionally, the global task refers to a task that has a wide impact on the operating status, data consistency, resource allocation, etc. of the entire distributed system, and usually needs to be coordinated and executed across multiple service nodes or the entire system. For example, the expansion and reduction of the distributed system, data backup and recovery, and global data consistency maintenance.

[0063] In some exemplary embodiments, after a load balancing task is generated, it may be checked whether there is a global task being executed in the current distributed system, and a first checking result may be generated.

[0064] Step 202: When the first inspection result indicates that there is no global task in the distributed system, determine the target inspection result according to the load balancing task.

[0065] In some exemplary embodiments, after a load balancing task is generated, it may be checked whether there is a global task being executed in the current distributed system, and a first checking result may be generated.

[0066] Furthermore, when the first inspection result indicates that there is no global task in the distributed system, the target inspection result is determined according to the load balancing task.

[0067] In the case where the first check indicates that a global task exists in the distributed system, the target check result is directly determined to be a check failure, and the check failure is used to indicate that the load balancing task is not to be executed.

[0068] As mentioned above, there are not only global tasks but also other types of tasks in the distributed system. When it is determined that there are no global tasks, it is also necessary to determine whether there are other types of tasks.

[0069] In an exemplary embodiment, Figure 3 As shown, determining the target inspection result according to the load balancing task includes the following steps:

[0070] Step 301: Determine a target shard that participates in the load balancing task from multiple shards in the distributed system according to the load balancing task.

[0071] In some exemplary embodiments, as described above, there are multiple shards in the distributed system. After obtaining the shard view, it is possible to determine which shards need to perform load balancing tasks based on the first load information of the shards, that is, the shards with unbalanced loads. These unbalanced load shards are also the target shards.

[0072] Since the load balancing task includes identification information of the shard that needs to execute the load balancing task, the target shard participating in the load balancing task can be determined from multiple shards in the distributed system based on the identification information.

[0073] Step 302: Check whether the target task exists in the target slice.

[0074] The target task is a task in execution state in the distributed system.

[0075] In some exemplary embodiments, after determining the target shards involved in the load balancing task, it may be checked whether these shards currently have tasks being executed.

[0076] Specifically, the currently executing tasks in the distributed system can be obtained, and the shards involved in each task can be compared with the target shards to determine whether the target shard has the target task. The status information of the target shard can also be obtained to determine whether the target shard has the target task based on the status information.

[0077] Step 303: If the target task does not exist in the target slice, determine that the target inspection result is passed.

[0078] In some exemplary embodiments, after checking whether the target shard has the target task, and determining that the target shard does not have the target task, the target check result is determined to be passed, that is, the current state of the distributed system is suitable for executing the load balancing task. It can be further explained that the current execution of the load balancing task will not conflict with other tasks and affect the stability of the distributed system operation.

[0079] In other exemplary embodiments, if it is confirmed that the target slice has a target task, the target inspection result is determined to be a check failure.

[0080] In an exemplary embodiment, Figure 4 As shown, the load balancing task of the distributed system is determined according to the shard view and the service node view, including the following steps:

[0081] Step 401: Determine whether there is a new service node or a failed service node in the distributed system according to the service node view.

[0082] In some exemplary embodiments, as described above, the service node view includes each service node and status information of each service node. Therefore, it is possible to determine whether there are new servers or failed servers in the distributed system based on each service node and status information of each service node.

[0083] Step 402: When it is determined that there is a new service node or a failed service node in the distributed system, a shard balancing task is generated according to the distribution information and the first load information, and a service node balancing task is generated according to the state information and the second load information.

[0084] Optionally, the shard balancing task is used to adjust the amount of data carried by each shard, and the service node balancing task is used to adjust the amount of data carried by each service node.

[0085] In some exemplary embodiments, when it is determined that there is a new service node or a failed service node in the distributed system, it can be determined that the distributed system may be in a load balancing state due to the emergence of the new server or the failed server.

[0086] Furthermore, at this time, the decision parameters for shard balancing can be first determined based on the distribution information and the first load information, and a shard balancing task can be generated based on the decision parameters for shard balancing. After determining the shard task, the decision parameters for service node balancing can be determined based on the status information and the second load information, and a service node balancing task can be generated based on the decision parameters for service node balancing.

[0087] In other exemplary embodiments, when it is determined that there is no newly added service node or failed service node in the distributed system, no load balancing task may be generated.

[0088] Step 403: determine the shard balancing task and the service node balancing task as the load balancing task.

[0089] In some exemplary embodiments, after determining the shard balancing task and the service node balancing task, the shard balancing task and the service node balancing task may be determined as the load balancing task.

[0090] In an optional embodiment of the present application, when the target inspection result indicates that the inspection has passed, before using the task management module of the distributed system to execute the load balancing task, it also includes: assigning an identification information, such as an ID, to the load balancing task, and the identification information can be used to query the execution status of the load balancing task.

[0091] In an exemplary embodiment, Figure 5 As shown, when the load balancing task meets the preset conditions, the method further includes the following steps:

[0092] Step 501: split the load balancing task to obtain multiple subtasks.

[0093] Optionally, the preset condition may be a condition pre-set by a technician according to actual needs, for example, when the load balancing task is a large task.

[0094] In some exemplary embodiments, when the load balancing task meets a preset condition, the load balancing task may be split to obtain a plurality of subtasks.

[0095] Step 502: Utilize the task management module to execute the multiple subtasks, and when the multiple subtasks are all completed, determine that the load balancing task is completed.

[0096] In an exemplary embodiment, after the load balancing task is split and processed to obtain multiple subtasks, the task management module can be used to execute the multiple subtasks. When the multiple subtasks are completed, the status of the load balancing task is adjusted to completed. The execution status of the load balancing task can be queried in real time through the identification information described above.

[0097] In an exemplary embodiment, Figure 6 As shown, when performing task checking on the load balancing task, the method further includes the following steps:

[0098] Step 601: Obtain the number of concurrent tasks in the load balancing task.

[0099] The parallel tasks refer to multiple tasks that can be executed simultaneously in the distributed system.

[0100] In some exemplary embodiments, when performing a task check on the load balancing task, the number of concurrent tasks in the load balancing task may also be obtained.

[0101] Step 602: When the number of tasks is greater than a preset number threshold, determine that the target inspection result is an inspection failure.

[0102] Optionally, the preset quantity threshold may be pre-set by a technician based on actual needs.

[0103] In some exemplary embodiments, after obtaining the number of concurrent tasks in the load balancing task, it may be determined whether the number of tasks is greater than a preset number threshold.

[0104] Furthermore, when it is determined that the number of tasks is greater than a preset number threshold, the target inspection result can be directly determined as an inspection failure. Since a large number of concurrent tasks may affect the stability and availability of the distributed system, it is possible to screen for this during task inspection to avoid affecting the stability and availability of the distributed system when executing load balancing tasks.

[0105] In an optional embodiment of the present application, TaskInfo is also provided, and TaskInfo can be used to extract the persistence information of the load balancing task. When the load balancing task is actually executed, the task can be persistently set at the key nodes of execution according to the predetermined plan. In this way, in the event of various failure scenarios, such as software system crashes, network connection interruptions, and hardware component failures, the load balancing task can continue from the state before the moment of the failure with the help of the information retained by the persistence operation completed at the key nodes, effectively preventing the load balancing task from having to be restarted due to the failure and wasting part of the work that has been completed before, and well ensuring the continuity of the execution of the load balancing task and the consistency of the related data before and after the failure.

[0106] In an exemplary embodiment, Figure 7 As shown, another load balancing task execution method is provided, the method comprising the following steps:

[0107] Step 701: Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0108] Step 702: Determine whether there is a new service node or a failed service node in the distributed system according to the service node view; if it is determined that there is a new service node or a failed service node in the distributed system, generate a shard balancing task according to the distribution situation information and the first load information, and generate a service node balancing task according to the state information and the second load information; determine the shard balancing task and the service node balancing task as the load balancing task;

[0109] Step 703: Check whether there is a global task in the distributed system to obtain a first check result; if the first check result indicates that there is no global task in the distributed system, determine a target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task;

[0110] Step 704, check whether the target task exists in the target shard, where the target task is a task in execution in the distributed system; if the target task does not exist in the target shard, determine that the target check result is passed; if the target check result indicates that the check is passed, use the task management module of the distributed system to execute the load balancing task.

[0111] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0112] Based on the same inventive concept, the embodiment of the present application also provides a load balancing task execution device for implementing the load balancing task execution method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more load balancing task execution device embodiments provided below can refer to the limitations on the load balancing task execution method above, and will not be repeated here.

[0113] In an exemplary embodiment, Figure 8 As shown, a load balancing task execution device 800 is provided, comprising: an acquisition module 801, a determination module 802 and an execution module 803, wherein:

[0114] An acquisition module 801 is used to acquire a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0115] A determination module 802 is used to determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0116] The execution module 803 is used to execute the load balancing task by using the task management module of the distributed system when the target inspection result indicates that the inspection is passed.

[0117] In one embodiment, the determination module 802 is specifically used to check whether there is a global task in the distributed system to obtain a first inspection result; when the first inspection result indicates that there is no global task in the distributed system, the target inspection result is determined according to the load balancing task.

[0118] In one embodiment, the determination module 802 is specifically used to determine the target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task; check whether the target shard has a target task, which is a task in execution state in the distributed system; if the target task does not exist in the target shard, determine that the target inspection result is inspection passed.

[0119] In one embodiment, the determination module 802 is specifically used to determine whether there are new service nodes or failed service nodes in the distributed system based on the service node view; when it is determined that there are new service nodes or failed service nodes in the distributed system, a shard balancing task is generated based on the distribution information and the first load information, and a service node balancing task is generated based on the status information and the second load information; the shard balancing task and the service node balancing task are determined as the load balancing task.

[0120] In one embodiment, the execution module 803 is also used to split the load balancing task to obtain multiple subtasks when the load balancing task meets preset conditions; use the task management module to execute the multiple subtasks, and determine that the load balancing task is completed when the multiple subtasks are all completed.

[0121] In one embodiment, the execution module 803 is also used to obtain the number of concurrent tasks in the load balancing task when performing a task check on the load balancing task; when the number of tasks is greater than a preset number threshold, determine that the target inspection result is an inspection failure.

[0122] Each module in the above-mentioned load balancing task execution device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0123] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig. 9As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a load balancing task execution method is implemented.

[0124] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a load balancing task execution method is implemented.

[0125] Those skilled in the art will understand that Fig. 9 or Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0126] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0127] Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0128] Determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0129] When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented: checking whether there is a global task in the distributed system to obtain a first check result; when the first check result indicates that there is no global task in the distributed system, determining the target check result according to the load balancing task.

[0131] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining a target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task; checking whether the target shard has a target task, which is a task in execution state in the distributed system; and if the target task does not exist in the target shard, determining that the target inspection result is inspection passed.

[0132] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining whether there are new service nodes or failed service nodes in the distributed system based on the service node view; when it is determined that there are new service nodes or failed service nodes in the distributed system, generating a shard balancing task based on the distribution information and the first load information, and generating a service node balancing task based on the status information and the second load information; and determining the shard balancing task and the service node balancing task as the load balancing task.

[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the load balancing task meets the preset conditions, the load balancing task is split to obtain multiple subtasks; the task management module is used to execute the multiple subtasks, and when the multiple subtasks are all completed, it is determined that the load balancing task is completed.

[0134] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when performing a task check on the load balancing task, the number of concurrent tasks in the load balancing task is obtained; when the number of tasks is greater than a preset number threshold, the target inspection result is determined to be an inspection failure.

[0135] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0136] Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0137] Determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0138] When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

[0139] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: checking whether there is a global task in the distributed system to obtain a first check result; when the first check result indicates that there is no global task in the distributed system, determining the target check result based on the load balancing task.

[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining a target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task; checking whether the target shard has a target task, which is a task in execution state in the distributed system; and if the target task does not exist in the target shard, determining that the target inspection result is inspection passed.

[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining whether there are new service nodes or failed service nodes in the distributed system based on the service node view; when it is determined that there are new service nodes or failed service nodes in the distributed system, generating a shard balancing task based on the distribution information and the first load information, and generating a service node balancing task based on the status information and the second load information; and determining the shard balancing task and the service node balancing task as the load balancing task.

[0142] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the load balancing task meets the preset conditions, the load balancing task is split to obtain multiple subtasks; the task management module is used to execute the multiple subtasks, and when the multiple subtasks are all completed, it is determined that the load balancing task is completed.

[0143] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when performing a task check on the load balancing task, the number of concurrent tasks in the load balancing task is obtained; when the number of tasks is greater than a preset number threshold, the target inspection result is determined to be an inspection failure.

[0144] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0145] Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node;

[0146] Determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task;

[0147] When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

[0148] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: checking whether there is a global task in the distributed system to obtain a first check result; when the first check result indicates that there is no global task in the distributed system, determining the target check result based on the load balancing task.

[0149] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining a target shard participating in the load balancing task from multiple shards in the distributed system according to the load balancing task; checking whether the target shard has a target task, which is a task in execution state in the distributed system; and if the target task does not exist in the target shard, determining that the target inspection result is inspection passed.

[0150] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining whether there are new service nodes or failed service nodes in the distributed system based on the service node view; when it is determined that there are new service nodes or failed service nodes in the distributed system, generating a shard balancing task based on the distribution information and the first load information, and generating a service node balancing task based on the status information and the second load information; and determining the shard balancing task and the service node balancing task as the load balancing task.

[0151] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the load balancing task meets the preset conditions, the load balancing task is split to obtain multiple subtasks; the task management module is used to execute the multiple subtasks, and when the multiple subtasks are all completed, it is determined that the load balancing task is completed.

[0152] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when performing a task check on the load balancing task, the number of concurrent tasks in the load balancing task is obtained; when the number of tasks is greater than a preset number threshold, the target inspection result is determined to be an inspection failure.

[0153] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0154] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0155] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for executing a load balancing task, characterized in that: The method comprises: Obtain a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node; Determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task; When the target inspection result indicates that the inspection is passed, the load balancing task is executed using the task management module of the distributed system.

2. The method according to claim 1, characterized in that The performing task inspection on the load balancing task to obtain a target inspection result includes: Checking whether there is a global task in the distributed system to obtain a first checking result; In a case where the first inspection result indicates that no global task exists in the distributed system, the target inspection result is determined according to the load balancing task.

3. The method according to claim 2, characterized in that The determining the target inspection result according to the load balancing task includes: Determine, according to the load balancing task, a target shard participating in the load balancing task from a plurality of shards in the distributed system; Check whether the target task exists in the target shard, where the target task is a task in execution state in the distributed system; When the target task does not exist in the target slice, it is determined that the target inspection result is inspection passed.

4. The method according to claim 1, characterized in that: The determining the load balancing task of the distributed system according to the shard view and the service node view includes: Determine whether there is a new service node or a failed service node in the distributed system according to the service node view; When it is determined that there is a newly added service node or a failed service node in the distributed system, a shard balancing task is generated according to the distribution information and the first load information, and a service node balancing task is generated according to the state information and the second load information; The shard balancing task and the service node balancing task are determined as the load balancing task.

5. The method according to claim 1, characterized in that The method further comprises: When the load balancing task meets a preset condition, splitting the load balancing task to obtain a plurality of subtasks; The task management module is used to execute the multiple subtasks, and when the multiple subtasks are all completed, it is determined that the load balancing task is completed.

6. The method according to claim 1, characterized in that The method further comprises: When performing task checking on the load balancing task, obtaining the number of concurrent tasks in the load balancing task; When the number of tasks is greater than a preset number threshold, the target inspection result is determined to be inspection failure.

7. A load balancing task execution device, characterized in that: The device comprises: An acquisition module, used to acquire a shard view and a service node view of a distributed system, wherein the shard view is used to characterize first load information and distribution information of each shard in the distributed system, and the service node view is used to characterize service nodes included in the distributed system, as well as second load information and status information of each service node; A determination module, used to determine the load balancing task of the distributed system according to the shard view and the service node view, and perform a task check on the load balancing task to obtain a target check result, wherein the task check is used to check whether the current state of the distributed system is a state suitable for executing the load balancing task; The execution module is used to execute the load balancing task by using the task management module of the distributed system when the target inspection result indicates that the inspection is passed.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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

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