Load balancing method for container cluster, computer equipment and storage medium

CN113986475BActive Publication Date: 2024-12-03CHINA MERCHANTS FINANCE HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111354180.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2024-12-03
Estimated Expiration
2041-11-16

Smart Images

  • Figure CN113986475B_ABST
    Figure CN113986475B_ABST
Patent Text Reader

Abstract

The present invention discloses a load balancing method, computer equipment and storage medium for a container cluster. The method comprises: a current routing node receives a current access request, each current access request includes current access information; the current routing node determines a target container node according to the current access information and a load balancing strategy, sends the current access request to the target container node, and updates regional hot service information; the main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to the hot service according to the current load information corresponding to each hot service; when the target scheduling strategy corresponding to the hot service is an expansion strategy, the main container node adds an expansion container node corresponding to the hot service in the current container area according to the current access volume. The method can ensure that the transmission distance between the current routing node and the expansion container node is short, which helps to improve the transmission efficiency and response efficiency of subsequent access requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of load balancing, and in particular to a load balancing method for a container cluster, a computer device, and a storage medium. Background Art

[0002] A container cluster is a cluster formed by multiple container nodes, each of which can be a cloud host. The existing container cluster divides all container nodes into N container areas according to specific area division rules. Each container area has a routing node and Mi container nodes. The routing node is a node used to implement data distribution and forwarding, and the container node is a node used to implement the processing of specific access requests. Generally speaking, the routing node can be connected to all container nodes in the container cluster to implement data distribution and forwarding.

[0003] In the load balancing process of existing container clusters, the routing nodes in each container area usually perform load balancing, which is generally based on a polling strategy, so that the routing nodes send the received access requests to the corresponding target container nodes for processing. The load balancing strategy of existing routing nodes generally determines the nodes with relatively idle resources as the target container nodes, without considering whether the link between the routing node and the container node is too long, which will result in a long information transmission time and affect the processing efficiency. Summary of the invention

[0004] The embodiments of the present invention provide a load balancing method for a container cluster, a computer device, and a storage medium to solve the problem that information transmission time in the existing container cluster is long, which affects processing efficiency.

[0005] An embodiment of the present invention provides a load balancing method for a container cluster, including:

[0006] The current routing node receives a current access request, each of the current access requests including current access information;

[0007] The current routing node determines the target container node according to the current access information and the load balancing strategy, sends the current access request to the target container node, and updates the regional hot service information, where the regional hot service information includes the current access volume and current load information corresponding to at least one hot service;

[0008] The main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service;

[0009] When the target scheduling strategy corresponding to the hot service is the expansion strategy, the main container node adds an expansion container node corresponding to the hot service in the current container area according to the current access volume.

[0010] Preferably, the current access information includes current access time and current service type;

[0011] The current routing node determines the target container node according to the current access information and the load balancing strategy, sends the current access request to the target container node, and updates the regional hot service information, including:

[0012] The current routing node queries the service container information table based on the current service type to determine the target container node corresponding to the current service type;

[0013] The current routing node sends the current access request to the target container node, and counts the current access volume corresponding to each current service type within the target statistical period corresponding to the current access time;

[0014] The current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node.

[0015] Preferably, the current routing node queries the service container information table based on the current service type to determine the target container node corresponding to the current service type, including:

[0016] The current routing node queries the service container information table based on the current service type to determine at least one candidate container node corresponding to the current service type;

[0017] The current routing node determines the idle resources to be selected and the container area to be selected corresponding to each of the container nodes to be selected;

[0018] When there is a candidate container node whose candidate container area is the current container area, the current routing node selects a candidate container node with the largest candidate free resource from the current container area and determines it as the target container node;

[0019] When there is no to-be-selected container node whose to-be-selected container area is the current container area, the current routing node determines the area distance between each of the to-be-selected container areas and the current container area, selects the to-be-selected container node with the shortest area distance and the largest to-be-selected idle resource, and determines it as the target container node.

[0020] Preferably, the current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node, including:

[0021] The current routing node determines at least one hot service according to the current access volume corresponding to each current service type;

[0022] The current routing node obtains current load information corresponding to a target container node that responds to at least one of the hot services;

[0023] The current routing node updates the regional hot service information according to the current access volume and current load information corresponding to at least one of the hot services.

[0024] Preferably, after the main container node monitors the regional hot service information and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, the load balancing method of the container cluster further includes:

[0025] When the target scheduling strategy corresponding to the hot service is the monitoring adjustment strategy, the main container node adjusts the monitoring update time, repeatedly monitors the regional hot service information in each container area, and determines the target scheduling strategy corresponding to the hot service according to the current load information corresponding to each hot service.

[0026] Preferably, the main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, including:

[0027] The main container node monitors the regional hot service information in each container area, and compares the current load information corresponding to each of the hot services with the expansion load threshold;

[0028] When the current load information corresponding to each of the hot services is greater than the capacity expansion load threshold, the main container node determines the capacity expansion strategy as the target scheduling strategy corresponding to the hot service;

[0029] When the current load information corresponding to each of the hot services is not greater than the capacity expansion load threshold, the main container node determines the monitoring adjustment strategy as the target scheduling strategy corresponding to the hot service.

[0030] Preferably, when the target scheduling strategy corresponding to the hot service is an expansion strategy, the main container node adds an expansion container node corresponding to the hot service in the current container area according to the current access volume, including:

[0031] When the target scheduling strategy corresponding to the hot service is the capacity expansion strategy, the main container node determines the number of required containers corresponding to the hot service according to the current access volume;

[0032] The main container node obtains the current number of containers corresponding to the hot service in the current container area;

[0033] The main container node determines a target expansion quantity according to the required container quantity and the current container quantity;

[0034] The main container node adds an expansion container node corresponding to the hot service in the current container area according to the target expansion quantity.

[0035] Preferably, the load balancing method for the container cluster further includes:

[0036] The current routing node periodically updates the target service information, wherein the target service information includes the target access volume and the number of existing containers corresponding to at least one target service;

[0037] The main container node monitors the target service information, and determines the number of target containers according to the target access volume of each target service;

[0038] The main container node determines whether a release condition is met according to the target container quantity and the existing container quantity;

[0039] When the release condition is met, the main container node releases the existing container nodes in the current container area.

[0040] An embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the load balancing method of the container cluster is implemented. The computer device is a current routing node or a primary container node.

[0041] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the load balancing method for the container cluster is implemented.

[0042] In the load balancing method, computer device and storage medium of the above-mentioned container cluster, after the current routing node sends the current access request to the target container node, it is necessary to update the regional hot service information so that when the main container node determines that the target scheduling strategy corresponding to the hot service is the expansion strategy based on the regional hot service information, dynamic expansion can be performed, and an expansion container node corresponding to the hot service is added in the current container area to ensure that the transmission distance between the current routing node and the expansion container node is short, which helps to improve the transmission efficiency and response efficiency of subsequent access requests. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0044] Figure 1is a schematic diagram of a load balancing system for a container cluster in one embodiment of the present invention;

[0045] Figure 2 is a flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0046] Figure 3 is another flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0047] Figure 4 is another flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0048] Figure 5 is another flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0049] Figure 6 is another flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0050] Figure 7 is another flow chart of a load balancing method for a container cluster in one embodiment of the present invention;

[0051] Figure 8 It is another flow chart of the load balancing method of the container cluster in one embodiment of the present invention. DETAILED DESCRIPTION

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

[0053] The load balancing method of the container cluster provided in the embodiment of the present invention can be applied as follows: Figure 1 Specifically, the load balancing method of the container cluster is applied in the load balancing system of the container cluster, and the load balancing system of the container cluster includes Figure 1 The main container node and N container areas are shown, and each container area is provided with a routing node and Mi container nodes. The routing node is a node used to implement data distribution and forwarding, and the container node is a node used to implement processing of specific access requests.

[0054] In one embodiment, if Figure 2 As shown, a load balancing method for a container cluster is provided, and the method is applied in Figure 1 The load balancing system of the container cluster in is used as an example to illustrate the following steps:

[0055] S201: The current routing node receives a current access request, each current access request includes current access information;

[0056] S202: The current routing node determines the target container node according to the current access information and the load balancing strategy, sends the current access request to the target container node, and updates the regional hot service information, where the regional hot service information includes the current access volume and current load information corresponding to at least one hot service;

[0057] S203: The main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service;

[0058] S204: When the target scheduling strategy corresponding to the hot service of the main container node is the expansion strategy, an expansion container node corresponding to the hot service is added in the current container area according to the current access volume.

[0059] The current routing node refers to the routing node that receives the current access request at the current moment. The current access request refers to the access request triggered at the current moment. The current access information refers to the information recorded in the current access request, and the current access information includes the current access time and the current service type. The current access time is the time when the current access request is triggered. The current service type refers to the type of service that the current access request needs to access.

[0060] As an example, in step S201, the current routing node in each container area may receive a current access request sent by a user operation client, each current access request including current access information of which service needs to be accessed, so as to determine its corresponding target container node according to the current access information.

[0061] Among them, the load balancing strategy refers to a pre-configured scheduling strategy for achieving load balancing, which can be specifically a proximity scheduling strategy. The target container node is a container node used to respond to the current access request, that is, a container node used to execute the current service corresponding to the current service type in the current access request. Regional hot service information is used to reflect the hot service information corresponding to each container area, specifically including current load information and current visits. Hot service refers to a popular service, that is, a service with a large number of visits. The current visit volume refers to the number of visits received by the target container node corresponding to each hot service at the current moment. The current load information refers to the information on the CPU and content load in the target container node corresponding to each hot service at the current moment.

[0062] As an example, in step S202, after receiving each current access request, the current routing node needs to parse and identify the current access request, determine the current access information, and then determine the target container node that can respond to and process the current access information based on the pre-configured load balancing strategy and the current access information. Then, the current access request is sent to the target container node so that the target container node responds to and processes the current access request. Finally, the current routing node needs to update the regional hot service information corresponding to the current container area. The regional hot service information can effectively reflect the relevant information of the top few hot services with large access volume in the current container area, including but not limited to the current load information and the current access volume.

[0063] The target scheduling strategy is a pre-configured strategy for scheduling processing according to regional hot service information. As an example, the target scheduling strategy can be any one of a capacity expansion strategy and a monitoring adjustment strategy. The capacity expansion strategy is a pre-configured strategy for expanding container nodes for a certain hot service. The monitoring adjustment strategy is a pre-configured strategy for adjusting the monitoring update time of a certain hot service.

[0064] As an example, in step S203, the main container node monitors the regional thermal service information in each container area in real time, and evaluates whether the current load information meets the corresponding expansion condition according to the current load information in each regional thermal service information; if the current load information in the regional thermal service information meets the expansion condition, the expansion strategy is determined as the target scheduling strategy; if the current load information in the regional thermal service information does not meet the expansion condition, the monitoring adjustment strategy is determined as the target scheduling strategy. Among them, the expansion condition is a condition pre-configured to evaluate whether expansion is required.

[0065] The expanded container node refers to a container node that is newly added in the current container area to handle hot services and is expanded according to the expansion strategy.

[0066] As an example, in step S204, when the target scheduling strategy corresponding to a certain hot service is an expansion strategy, the main container node determines that the expansion condition is met. At this time, the target expansion number of container nodes that need to be expanded in the current container area can be determined based on the current load information of the target container node that processes the hot service and the current number of visits to the hot service received by the current routing node, so as to add an expansion container node for processing the hot service in the current container area, so that the subsequent current routing node can directly send the current access request corresponding to the hot service received to the expansion container node in the current container area for processing.

[0067] like Figure 1As shown, there is no container node for implementing the hot service S1 in container area A, but there is a container node Node_B1 for implementing the hot service S1 in container area B. When the current routing node of container area A receives the current access request corresponding to the hot service S1, it determines the container node Node_B1 in container area B as the target container node and sends the current access request to the target container node Node_B1 in container area B. Then, the current routing node corresponding to container area A updates the regional hot service information. The main container node monitors the regional hot service information corresponding to container area A. When the current load information in the regional hot service information meets the expansion condition, the expansion strategy is determined as the target scheduling strategy. At this time, the container area A can be expanded, and the expansion container node _Ax corresponding to the execution of the hot service S1 is added in the container area A, so that the container area A can send the current access request to the expansion container node _Ax for processing based on the proximity principle when it receives the current access request next time.

[0068] In the load balancing method of the container cluster provided in this embodiment, after the current routing node sends the current access request to the target container node, it is necessary to update the regional hot service information so that when the main container node determines that the target scheduling strategy corresponding to the hot service is the expansion strategy based on the regional hot service information, dynamic expansion can be performed, and an expansion container node corresponding to the hot service is added in the current container area to ensure that the transmission distance between the current routing node and the expansion container node is short, which helps to improve the transmission efficiency and response efficiency of subsequent access requests.

[0069] In one embodiment, after step S203, that is, after the main container node monitors the regional hot service information and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, the load balancing method of the container cluster further includes:

[0070] When the target scheduling strategy corresponding to the hot service is the monitoring adjustment strategy, the main container node adjusts the monitoring update time, repeatedly monitors the regional hot service information in each container area, and determines the target scheduling strategy corresponding to the hot service based on the current load information corresponding to each hot service.

[0071] As an example, when the target scheduling strategy corresponding to the hot service of the main container node is the monitoring adjustment strategy, the main container node determines that the expansion conditions are not met. At this time, the monitoring adjustment strategy needs to be determined as the target scheduling strategy corresponding to the hot service. The monitoring adjustment strategy can be executed to shorten the monitoring update time. For example, the monitoring update time is updated from T to 1 / 2T to shorten the monitoring update time, so that the main container node can more frequently execute repeated monitoring of the regional hot service information in each container area, and determine the target scheduling strategy corresponding to the hot service according to the current load information corresponding to each hot service, so that when it is detected that the target scheduling strategy corresponding to a hot service is the expansion strategy, it can respond quickly.

[0072] In one embodiment, the current access information includes the current access time and the current service type;

[0073] like Figure 3 As shown, in step S202, the current routing node determines the target container node according to the current access information and the load balancing strategy, sends the current access request to the target container node, and updates the regional hot service information, including:

[0074] S301: The current routing node queries the service container information table based on the current service type to determine the target container node corresponding to the current service type;

[0075] S302: The current routing node sends the current access request to the target container node, and counts the current access volume corresponding to each current service type within the target statistical period corresponding to the current access time;

[0076] S303: The current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node.

[0077] The current access time is the time when the current access request is triggered. The current service type is the type of service that the current access request needs to access.

[0078] The service container information table is an information table used to record the corresponding relationship between different service types and their container nodes.

[0079] As an example, in step S301, after parsing the current access request and determining the current access information, the current routing node may query a pre-configured service container information table according to the current service type, and determine the target container node corresponding to the current service type according to the query result. The target container node is a container node determined in this allocation that can process the current access request corresponding to the current service type.

[0080] The target statistical period is a pre-set unit time for realizing regional hot service information statistics. The current visit volume refers to the visit volume corresponding to each current service type counted by the current routing node.

[0081] As an example, in step S302, after determining the target container node, the current routing node may send the current access request to the target container node so that the target container node responds to the current access request. Next, the current routing node needs to count the current access volume corresponding to each current service type within the target statistical period corresponding to the current access time. For example, when the current access time is t1 and the target statistical period is ΔT, the current routing node needs to count the current access volume corresponding to each current service type within the period [t1-ΔT, t1] in order to determine the access status of all current service types within the target statistical period.

[0082] As an example, in step S303, the current routing node can determine which service types are hot services based on the current visits corresponding to each current service type, determine the current visits corresponding to the hot services, and then obtain the current load information corresponding to the target container node corresponding to the hot service, and update the regional hot service information corresponding to the current container area based on the current visits corresponding to the hot service and the current load information corresponding to its target container node.

[0083] It can be understood that the current routing node queries the service container information table based on the current service type in the current access request, determines the target container node, and then counts the current access volume corresponding to each current service type, determines at least one hot service in the current container area, and updates the regional hot service information based on the current access volume and current load information, so that the regional hot service information can accurately reflect the hot services and related information in each container area in real time, so as to determine the subsequent target scheduling strategy based on the regional hot service information and ensure the real-time effectiveness of the target scheduling strategy.

[0084] In one embodiment, if Figure 4 As shown, step S301, that is, the current routing node queries the service container information table based on the current service type to determine the target container node corresponding to the current service type, includes:

[0085] S401: The current routing node queries the service container information table based on the current service type to determine at least one candidate container node corresponding to the current service type;

[0086] S402: The current routing node determines the idle resources to be selected and the container area to be selected corresponding to each container node to be selected;

[0087] S403: When there is a candidate container node whose candidate container area is the current container area, the current routing node selects a candidate container node with the largest candidate idle resources from the current container area and determines it as the target container node;

[0088] S404: When there is no candidate container node whose candidate container area is the current container area, the current routing node determines the area distance between each candidate container area and the current container area, selects the candidate container node with the shortest area distance and the largest candidate free resource, and determines it as the target container node.

[0089] The container node to be selected refers to a container node that can process the current service corresponding to the current service type.

[0090] As an example, in step S401, after parsing the current access request and determining the current access information, the current routing node may query a pre-configured service container information table according to the current service type, and determine at least one candidate container node corresponding to the current service type according to the query result, so as to determine the corresponding target container node according to the at least one candidate container node.

[0091] The idle resources to be selected refer to the idle resources in the container node to be selected, and the container region to be selected refers to the container region where the container node to be selected is located.

[0092] As an example, in step S402, after determining at least one candidate container node, the current routing node may monitor and obtain the candidate idle resources corresponding to each candidate container node and the candidate container area in which it is located, so as to select and determine the target container node that responds to and processes the current access request from at least one candidate container node based on the candidate idle resources and the candidate container area.

[0093] The current container area refers to the container area where the current routing node is located.

[0094] As an example, in step S403, when there is a candidate container node whose candidate container area is the current container area, that is, there is at least one candidate container node in the same container area as the current routing node. Since the distance from the current routing node to the candidate container node in the same container area is short, the candidate container node with the largest candidate idle resource can be selected from the current container area, determined as the target container node, and the current access request is sent to the target container node. It can be understood that since the current routing node and the target container node are in the same container area, the transmission distance between the current routing node and the target container node can be guaranteed to be short, which helps to improve the transmission efficiency of the current access request, and then improve the response efficiency of the current access request.

[0095] As an example, in step S404, when there is no candidate container node whose candidate container area is the current container area, that is, there is no candidate container node in the same container area as the current routing node, that is, all candidate container nodes and the current routing node are in different container areas. At this time, the current routing node needs to determine the regional distance between the candidate container area corresponding to each candidate container node and the current container area; then select the candidate container node with the shortest regional distance and the largest number of available free resources to be selected, and determine it as the target container node. It can be understood that since the current routing node and all candidate container nodes are not in the same container area, at this time, selecting the candidate container node with the shortest regional distance and the largest number of available free resources to be selected and determining it as the target container node can ensure that the transmission distance between the current routing node and the target container node is short, which helps to improve the transmission efficiency of the current access request, and then improve the response efficiency of the current access request.

[0096] In one embodiment, if Figure 5 As shown, step S303, that is, the current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node, including:

[0097] S501: The current routing node determines at least one hot service according to the current access volume corresponding to each current service type;

[0098] S502: The current routing node obtains current load information corresponding to the target container node that responds to at least one hot service;

[0099] S503: The current routing node updates the regional hot service information according to the current access volume and current load information corresponding to at least one hot service.

[0100] As an example, in step S501, the current routing node may count the current visits corresponding to each current service type within the target statistical period corresponding to the current access time, and may determine the current services corresponding to the first few current service types with the largest current visits as hot services; or, may determine the current services corresponding to the current service types whose current visits are greater than the visit volume threshold as hot services, to ensure that the determined hot services are services with the largest visits in the recent period.

[0101] As an example, in step S502, the current routing node may monitor the current load information of the target container node that responds to and processes each hot service. The current load information includes, but is not limited to, information such as the CPU and memory corresponding to the target container node, so as to subsequently evaluate whether expansion processing is required based on the current load information.

[0102] As an example, in step S503, the current routing node may update the regional hot service information according to the current access volume corresponding to at least one hot service and the current load information of the target container node processing the hot service, so as to subsequently perform capacity expansion processing according to the regional hot service information.

[0103] In one embodiment, if Figure 6 As shown, step S203, that is, the main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, including:

[0104] S601: The main container node monitors the regional hot service information in each container area, and compares the current load information corresponding to each hot service with the expansion load threshold;

[0105] S602: When the current load information corresponding to each hot service is greater than the capacity expansion load threshold, the main container node determines the capacity expansion strategy as the target scheduling strategy corresponding to the hot service;

[0106] S603: When the current load information corresponding to each hot service is not greater than the capacity expansion load threshold, the main container node determines the monitoring adjustment strategy as the target scheduling strategy corresponding to the hot service.

[0107] The capacity expansion load threshold is a pre-configured threshold used to determine whether the current load information reaches the standard for capacity expansion. Since the current load information includes the measured information corresponding to the CPU and memory, the capacity expansion load threshold also includes the evaluation threshold corresponding to the CPU and memory.

[0108] As an example, in step S601, the main container node may monitor the regional thermal service information in each container area, and compare the current load information corresponding to the thermal service with the pre-configured expansion load threshold to evaluate whether the current load information meets the expansion standard, thereby determining the subsequent target scheduling strategy.

[0109] As an example, in step S602, when the current load information corresponding to each hot service is greater than the expansion load threshold, the main container node determines that the current load information corresponding to the hot service meets the expansion standard. At this time, the expansion strategy needs to be determined as the target scheduling strategy corresponding to the hot service, so as to subsequently expand the capacity in the current container area to increase the expansion container node for processing the hot service, which helps to improve the transmission efficiency and response efficiency of subsequent access requests.

[0110] As an example, in step S603, when the current load information corresponding to each thermal service is not greater than the expansion load threshold, the main container node determines that the current load information corresponding to the thermal service does not meet the expansion standard. At this time, it is necessary to determine the monitoring adjustment strategy as the target scheduling strategy corresponding to the thermal service, so as to adjust the monitoring update time of the thermal service according to the monitoring adjustment strategy, so as to monitor the real-time situation of the thermal service more effectively and in real time, so that when the current load information corresponding to the thermal service meets the expansion conditions in the future, it can respond in time to determine the expansion strategy as the target scheduling strategy.

[0111] For example, the main container node monitors that container area A includes three hot services S1 / S2 / S3 and the current load information such as CPU and memory corresponding to each hot service. If it is analyzed that the current load information such as CPU and memory corresponding to hot service S1 meets the expansion conditions, that is, it matches the CPU threshold and memory threshold corresponding to the expansion conditions, then the expansion strategy is determined as the target scheduling strategy, so that the container node used to process the hot service S1 is expanded according to the expansion strategy; if it is analyzed that the current load information such as CPU and memory corresponding to hot service S2 does not meet the expansion conditions, that is, it does not match the CPU threshold and memory threshold corresponding to the expansion conditions, then the monitoring adjustment strategy is determined as the target scheduling strategy corresponding to the hot service, so that the monitoring update time of the hot service is adjusted according to the monitoring adjustment strategy, and the real-time situation of the hot service can be monitored more effectively and in real time, so that when the current load information corresponding to the hot service meets the expansion conditions later, the expansion strategy can be promptly responded to and determined as the target scheduling strategy.

[0112] In one embodiment, if Figure 7 As shown, step S204, that is, when the target scheduling strategy corresponding to the hot service of the main container node is the expansion strategy, according to the current access volume, a new expansion container node corresponding to the hot service is added in the current container area, including:

[0113] S701: When the target scheduling strategy corresponding to the hot service is the capacity expansion strategy, the main container node determines the number of required containers corresponding to the hot service according to the current access volume;

[0114] S702: The main container node obtains the current number of containers corresponding to the hot service in the current container area;

[0115] S703: The main container node determines the target expansion quantity according to the required container quantity and the current container quantity;

[0116] S704: The main container node adds an expansion container node corresponding to the hot service in the current container area according to the target expansion quantity.

[0117] As an example, in step S701, when the target scheduling strategy corresponding to the hot service is the expansion strategy, the main container node needs to determine the number of demand containers corresponding to the hot service based on the current access volume corresponding to the hot service received by the current routing node and the first acceptance volume corresponding to each target container node. In this example, the number of demand containers is the quotient of the current access volume corresponding to the hot service and the first acceptance volume corresponding to each target container node. The first acceptance volume refers to the number of access requests corresponding to the hot service that each target container node can accept.

[0118] As an example, in step S702, the main container node counts the number of target container nodes corresponding to the hot service in the current container area where the current routing node is located, and determines the current number of containers corresponding to the hot service in the current container area. The current number of containers can reflect how many container nodes in the current container area are used to process the hot service.

[0119] As an example, in step S703, after determining the required number of containers and the current number of containers, the main container node can determine the target expansion number based on the required number of containers and the current number of containers. The target expansion number can be understood as the number of container nodes that need to be newly expanded. In this example, the difference between the required number of containers and the current number of containers can be directly determined as the target expansion number, or the difference between the required number of containers and the current number of containers can be calculated first, and then the sum of the difference and the preset redundant number can be determined as the target expansion number. The redundant number here refers to the number of pre-configured container nodes used to configure redundant processing.

[0120] As an example, in step S704, the main container node may add an expansion container node corresponding to the hot service in the current container area according to the target expansion quantity, so that after the current routing node receives the current access request corresponding to the new hot service, it can send the current access request to the expansion container node in the current container area, which can shorten the transmission distance of the new current access request and help improve its transmission efficiency and response efficiency.

[0121] In one embodiment, if Figure 8 As shown, the load balancing method of the container cluster also includes:

[0122] S801: The current routing node periodically updates target service information, where the target service information includes target access volume and the number of existing containers corresponding to at least one target service;

[0123] S802: The main container node monitors target service information and determines the number of target containers according to the target access volume of each target service;

[0124] S803: The main container node determines whether the release condition is met according to the number of target containers and the number of existing containers;

[0125] S804: When the release condition is met, the main container node releases the existing container nodes in the current container area.

[0126] The target service refers to the service that can be processed by the container nodes in the current container area. The target service information is information related to the target service. The target access volume refers to the number of visits to the target service within a specific statistical period within the current time. The number of existing containers refers to the number of container nodes used to process a certain target service in the current container area.

[0127] As an example, in step S801, the current routing node periodically updates its target service information to determine the target access volume corresponding to each target service and the number of existing containers corresponding to the existing container nodes for processing the target service in the current container area.

[0128] The target container quantity refers to the quantity of container nodes required to process each target service according to the target access volume of the target service.

[0129] As an example, in step S802, the main container node can monitor the target service information of the current routing node, and can determine the number of target containers according to the target access volume of each target service in the target service information. In this example, the number of target containers is the quotient of the target access volume corresponding to a certain target service and the second acceptance volume corresponding to each existing container node. The second acceptance volume refers to the number of access requests corresponding to the target service that each existing container node can accept.

[0130] The release condition is a pre-set condition for evaluating whether an existing container node corresponding to a target service needs to be released.

[0131] As an example, in step S803, the main container node can determine whether the pre-configured release condition is met based on the target container quantity and the existing container quantity. In this example, the main container node can first calculate the difference between the existing container quantity and the target container quantity, and determine it as the container quantity difference; compare the container quantity difference with the pre-set quantity difference threshold; if the container quantity difference is greater than the quantity difference threshold, it is determined that the existing container quantity has reached the release condition that is much greater than the target container quantity required, and it is determined that it meets the release condition; if the container quantity difference is not greater than the quantity difference threshold, it is determined that the existing container quantity has not reached the release condition that is much greater than the target container quantity required, and it is determined that it does not meet the release condition.

[0132] As an example, in step S804, when the main container node meets the release condition, it can determine that the number of existing containers has reached the release condition that is much greater than the target number of containers it needs. At this time, the existing container nodes in the current container area are released. Specifically, the existing container nodes that match the difference in the number of containers can be released, so that the existing container nodes corresponding to the target service in the current container area can meet its needs without causing the existing container node resources to be idle, which helps to improve the resource utilization of the existing container nodes.

[0133] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0134] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the load balancing method of the container cluster in the above embodiment is implemented, for example Figure 2 S201-S204 as shown, or Figures 3 to 8 As shown in , to avoid repetition, it will not be repeated here. The computer device is the current routing node or the main container node.

[0135] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the load balancing method of the container cluster in the above embodiment is implemented, for example Figure 2 S201-S204 as shown, or Figures 3 to 8 To avoid repetition, it will not be described here.

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

[0137] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0138] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A load balancing method for a container cluster. It is characterized in that include: The current routing node receives a current access request, each of the current access requests includes current access information, and the current access information includes a current access time and a current service type; The current routing node queries the service container information table based on the current service type to determine at least one candidate container node corresponding to the current service type; The current routing node determines the idle resources to be selected and the container area to be selected corresponding to each of the container nodes to be selected; When there is a candidate container node whose candidate container area is the current container area, the current routing node selects a candidate container node with the largest candidate free resource from the current container area and determines it as the target container node; When there is no to-be-selected container node whose to-be-selected container area is the current container area, the current routing node determines the area distance between each of the to-be-selected container areas and the current container area, selects the to-be-selected container node with the shortest area distance and the largest to-be-selected idle resource, and determines it as the target container node; The current routing node sends the current access request to the target container node, and counts the current access volume corresponding to each current service type within the target statistical period corresponding to the current access time; The current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node, wherein the regional hot service information includes the current access volume and current load information corresponding to at least one hot service; The main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service; When the target scheduling strategy corresponding to the hot service is the expansion strategy, the main container node adds an expansion container node corresponding to the hot service in the current container area according to the current access volume.

2. The load balancing method for a container cluster as claimed in claim 1, It is characterized in that The current routing node updates the regional hot service information according to the current access volume corresponding to each current service type and the current load information corresponding to each target container node, including: The current routing node determines at least one hot service according to the current access volume corresponding to each current service type; The current routing node obtains current load information corresponding to a target container node that responds to at least one of the hot services; The current routing node updates the regional hot service information according to the current access volume and current load information corresponding to at least one of the hot services.

3. The load balancing method for a container cluster as claimed in claim 1, It is characterized in that After the main container node monitors the regional hot service information and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, the load balancing method of the container cluster further includes: When the target scheduling strategy corresponding to the hot service is the monitoring adjustment strategy, the main container node adjusts the monitoring update time, repeatedly monitors the regional hot service information in each container area, and determines the target scheduling strategy corresponding to the hot service according to the current load information corresponding to each hot service.

4. The load balancing method for a container cluster as claimed in claim 3, It is characterized in that The main container node monitors the regional hot service information, and determines the target scheduling strategy corresponding to each hot service according to the current load information corresponding to each hot service, including: The main container node monitors the regional hot service information in each container area, and compares the current load information corresponding to each of the hot services with the expansion load threshold; When the current load information corresponding to each of the hot services is greater than the capacity expansion load threshold, the main container node determines the capacity expansion strategy as the target scheduling strategy corresponding to the hot service; When the current load information corresponding to each of the hot services is not greater than the capacity expansion load threshold, the main container node determines the monitoring adjustment strategy as the target scheduling strategy corresponding to the hot service.

5. The load balancing method for a container cluster as claimed in claim 1, It is characterized in that When the target scheduling strategy corresponding to the hot service is the expansion strategy, the main container node adds an expansion container node corresponding to the hot service in the current container area according to the current access volume, including: When the target scheduling strategy corresponding to the hot service is the capacity expansion strategy, the main container node determines the number of required containers corresponding to the hot service according to the current access volume; The main container node obtains the current number of containers corresponding to the hot service in the current container area; The main container node determines a target expansion quantity according to the required container quantity and the current container quantity; The main container node adds an expansion container node corresponding to the hot service in the current container area according to the target expansion quantity.

6. The load balancing method for a container cluster according to claim 1, It is characterized in that The load balancing method of the container cluster also includes: The current routing node periodically updates the target service information, wherein the target service information includes the target access volume and the number of existing containers corresponding to at least one target service; The main container node monitors the target service information, and determines the number of target containers according to the target access volume of each target service; The main container node determines whether a release condition is met according to the target container quantity and the existing container quantity; When the release condition is met, the main container node releases the existing container nodes in the current container area.

7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the load balancing method for the container cluster according to any one of claims 1 to 6 is implemented, and the computer device is a current routing node or a primary container node.

8. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the load balancing method for a container cluster as claimed in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • CDN node overload scheduling method and system

    CN111586134A

  • Content service method, system, device and computer readable storage medium

    CN112929319A