Traffic distribution method, device, computer equipment and storage medium

By acquiring and screening target nodes in the container cloud platform and distributing traffic based on remaining resources and architecture types, the traffic distribution problem across platform architecture types is solved, achieving load balancing and a stable operating environment.

CN116708303BActive Publication Date: 2025-09-12JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310905071.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-21
Publication Date
2025-09-12
Estimated Expiration
2043-07-21

AI Technical Summary

Technical Problem

Existing cloud platforms are unable to distribute traffic across platform architecture types, resulting in wasted resources, complex operations and maintenance, poor user experience, high pressure on environmental configuration, and inability to achieve load balancing.

Method used

By obtaining the container creation request, querying the remaining resources and architecture type of the nodes in the container cloud, filtering the target nodes, and determining the traffic allocation level based on the mapping relationship between the remaining resources and the traffic allocation level, flexible traffic allocation across the platform architecture is achieved.

Benefits of technology

It realizes traffic distribution across platform architectures, alleviates node business pressure, provides a more stable operating environment, and improves system load balancing and business system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116708303B_ABST
    Figure CN116708303B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and discloses a flow distribution method, device, computer equipment and storage medium, including: obtaining a container creation request, querying the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request; screening out a target node from all nodes in the container cloud according to the remaining resources of each node; determining the flow distribution level of each target node according to the remaining resources of each target node and the mapping relationship between the remaining resources and the flow distribution level; when it is determined that the number of containers contained in the target node meets the target number, based on the target number, the flow distribution level of each target node and the architecture type of each target node, the flow distribution of the containers of the target node is performed. The present invention can reasonably distribute flow based on different architectures, so that the business system can continuously provide services in a robust and stable manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a flow distribution method, device, computer equipment and storage medium. Background Art

[0002] One cloud, multiple cores refers to using a single cloud operating system to manage hardware server clusters with different architectures. Conventional cloud platforms can only shield hardware details for CPUs of one architecture and manage them through cloud management software. However, this management model cannot cover all user needs. Traffic distribution can only be based on containers with the same platform architecture. Manual intervention is required to distribute traffic between new and old versions of containers according to the distribution ratio. The environment and configuration of the new version of the container must be consistent with the old version, which invisibly increases the pressure on environmental configuration and also increases the time and space limitations of traffic distribution. Traffic distribution can only be based on the same platform architecture to divert traffic. It cannot automatically adjust traffic distribution across platform architecture types. This puts a lot of pressure on the environment and poses a great challenge to environmental stability. It also leads to problems such as resource waste, complex operation and maintenance, lack of unified management, and poor user experience. Summary of the Invention

[0003] In view of this, the present invention provides a traffic distribution method, apparatus, computer device and storage medium to solve the problem of inability to distribute traffic across platform architecture types.

[0004] In a first aspect, the present invention provides a flow distribution method, comprising:

[0005] Obtain a container creation request, where the container creation request includes a target number of containers to be created;

[0006] Query the remaining resources of all nodes in the container cloud and the architecture type of each node based on the container creation request;

[0007] Filter the target node from all nodes in the container cloud based on the remaining resources of each node;

[0008] Determine the traffic allocation level of each target node based on the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level;

[0009] When it is determined that the number of containers contained in the target node meets the target number, traffic is distributed to the containers of the target node according to the target number, the traffic distribution level of each target node, and the architecture type of each target node.

[0010] The flow distribution method provided by the present invention has the following advantages:

[0011] Obtain a container creation request, and query the remaining resources of all nodes in the container cloud and the architecture type of each node based on the container creation request; select the target node from all nodes in the container cloud based on the remaining resources of each node; determine the traffic allocation level of each target node based on the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level; when it is determined that the number of containers contained in the target node meets the target number, allocate traffic to the containers of the target node based on the target number, the traffic allocation level of each target node, and the architecture type of each target node. Based on the container creation request, you can query the nodes that meet the requirements as the target nodes for traffic allocation, and then allocate traffic based on the architecture type, the remaining resources of the target node, etc. You can flexibly allocate traffic in different dimensions, distribute requests to different containers with different architectures, achieve load balancing, be more efficient in traffic distribution, and better alleviate the business pressure of each node, so that the system can provide a more stable operating environment and enable the business system to continue to provide services robustly and stably.

[0012] In an optional embodiment, the remaining resources include the usage of the central processing unit, and the target node is selected from all nodes in the container cloud based on the remaining resources of each node, including:

[0013] When the usage rate of the central processing unit of the first node is less than or equal to a preset threshold, the first node is determined to be a target node, wherein the first node is any node in the container cloud.

[0014] In an optional implementation, when it is determined that the number of containers included in the target node does not meet the target number, the method further includes:

[0015] When the number of containers is greater than the target number, the containers larger than the target number will be evicted so that the number of containers on the target node is equal to the target number;

[0016] or,

[0017] When the number of containers is less than the target number, a new container is created at the target node so that the number of containers at the target node equals the target number.

[0018] In an optional embodiment, the traffic distribution level includes at least one, and traffic distribution is performed on containers of the target nodes based on the number of targets, the traffic distribution level of each target node, and the architecture type of each target node, including:

[0019] Select a target level from all traffic allocation levels;

[0020] Determining the number of target nodes in the target level that belong to a first architecture type, wherein the first architecture type is any architecture type among the architecture types to which the target nodes corresponding to the target level belong;

[0021] determining a traffic allocation ratio of the first architecture type in the first traffic allocation level based on the target number and the target number of nodes of the first architecture type;

[0022] Allocate the traffic to be allocated to the target nodes corresponding to the target level in accordance with the traffic allocation ratio corresponding to each architecture type in the target level;

[0023] When there is still surplus traffic to be allocated, the next traffic allocation level is selected from the traffic allocation levels, and the surplus is allocated using the target node corresponding to the next traffic allocation level until all traffic is allocated.

[0024] Through the above method, the target nodes can be divided into multiple target levels according to the traffic allocation level, and the number of each architecture type in each target node and the number of target nodes under each architecture type can be counted respectively to determine the traffic allocation ratio of each traffic allocation level. When the target level cannot allocate all the traffic to be allocated, the next traffic allocation level will be selected for allocation. This can flexibly and orderly complete the distribution of traffic, balance the pressure of each node, and ensure the stable operation of the system.

[0025] In an optional embodiment, the target level is selected from all traffic distribution levels, including:

[0026] The traffic allocation class with the highest priority among the traffic allocation classes is selected as the target class.

[0027] In an optional embodiment, the traffic allocation ratio of the first architecture type in the first traffic allocation level is determined based on the target number and the target number of nodes of the first architecture type, specifically by the following formula:

[0028] L1=N pod *N node1 *m1

[0029] Among them, L1 is the traffic allocation ratio of the first architecture type, N pod is the target number, N node1 is the target number of nodes of the first architecture type, and m1 is the preset weight of the first architecture type.

[0030] In an optional embodiment, after creating the target number of containers on each target node, the method further includes:

[0031] Monitor the status of each container in the target node;

[0032] When it is determined that the status of the first container is abnormal, the first container is expelled from the target node, and the traffic of the containers of the target node is redistributed according to the number of remaining containers of each target node, the traffic distribution level of each target node, and the architecture type of each target node, where the first container is any container in the target node.

[0033] In a second aspect, the present invention provides a flow distribution device, comprising:

[0034] An acquisition module, configured to acquire a container creation request, wherein the container creation request includes a target number of containers to be created;

[0035] The query module is used to query the remaining resources of all nodes in the container cloud and the architecture type of each node based on the container creation request;

[0036] The screening module is used to filter out target nodes from all nodes in the container cloud based on the remaining resources of each node;

[0037] a determination module, configured to determine the flow allocation level of each target node according to the remaining resources of each target node and a mapping relationship between the remaining resources and the flow allocation level;

[0038] The allocation module is used to allocate traffic to the containers of the target node according to the target number, the traffic allocation level of each target node, and the architecture type of each target node when it is determined that the number of containers contained in the target node meets the target number.

[0039] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, computer instructions being stored in the memory, and the processor executing the traffic distribution method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0040] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the traffic distribution method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1is a flow chart of a flow distribution method according to an embodiment of the present invention;

[0043] Figure 2 is a flow chart of another flow distribution method according to an embodiment of the present invention;

[0044] Figure 3 is a flow chart of another flow distribution method according to an embodiment of the present invention;

[0045] Figure 4 Schematic diagram of another flow distribution method according to an embodiment of the present invention

[0046] Figure 5 is a structural block diagram of a flow distribution device according to an embodiment of the present invention;

[0047] Figure 6 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0048] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings 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 those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.

[0049] In container cloud platforms with different architectures, cloud management software is typically used to manage containers on nodes of different architecture types. However, this approach doesn't cover all customer needs and still presents challenges such as wasted resources, complex operations and maintenance, a lack of unified maintenance and management, and a poor user experience. In related technologies, container management platforms (Kubernetes, or K8s) distribute traffic only based on containers (pods) within the same platform architecture. Manual intervention is required to distribute traffic between new and old pod versions according to their allocation ratios. The environment and configuration of new pod versions remain consistent with those of the old version, which inadvertently increases the pressure on environmental configuration and imposes time and space limitations on traffic distribution.

[0050] Based on this, according to an embodiment of the present invention, an embodiment of a traffic distribution method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0051] In this embodiment, a traffic distribution method is provided, which can be used for the above-mentioned computer equipment, such as servers, container cloud platforms, etc. Figure 1 Flowchart of the flow distribution method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0052] Step S101: Obtain a container creation request.

[0053] Specifically, the container creation request includes a target number of containers to be created.

[0054] In an optional example, for example, a user initiates a container creation request based on actual business needs, and the request includes the number of containers required by the business, that is, the target number.

[0055] Step S102: query the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request.

[0056] Specifically, after receiving the creation request, the remaining resources of all nodes in the container cloud platform and the architecture type of each node are queried. The remaining resources refer to the unused resources that can be used for other calculations.

[0057] In an optional example, the architecture type may include, for example, Advanced Micro Devices (AMD) architecture type, Advanced RISC Machine (ARM) architecture type, and other architecture types that can be included in the container cloud platform.

[0058] Step S103: Filter out the target node from all nodes in the container cloud according to the remaining resources of each node.

[0059] Specifically, a remaining resource threshold can be set. When the remaining resources of a node are greater than or equal to the remaining resource threshold, the node is used as the target node. By traversing all nodes, all target nodes can be screened out. The target nodes are candidate nodes for traffic distribution.

[0060] Step S104 : determining the traffic allocation level of each target node according to the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level.

[0061] Specifically, a mapping relationship between remaining resources and traffic allocation levels may be established, and the remaining resources of each target node may be matched with each traffic allocation level in the mapping relationship to determine the traffic allocation level of the target node.

[0062] In an optional example, for example, if the remaining resources of the target node A are within the interval of the first traffic allocation level, the traffic allocation level of A is determined to be the first traffic allocation level, and the first traffic allocation level is any traffic allocation level among all traffic allocation levels.

[0063] Step S105 : When it is determined that the number of containers included in the target node meets the target number, traffic is distributed to the containers of the target node according to the target number, the traffic distribution level of each target node, and the architecture type of each target node.

[0064] Specifically, when it is determined that the number of containers contained in the target node meets the target number, the allocation order of the target nodes can be determined according to the traffic allocation level, and then the allocation strategy of the target node under the traffic allocation level to which it belongs can be determined according to the target number and the architecture type of the target node, and traffic can be allocated to the target node.

[0065] In an optional example, the traffic distribution levels can be labeled according to certain rules, and traffic distribution can be performed in the order of the labels. When all the nodes in the first-numbered traffic distribution level are saturated, the traffic distribution operation of the next-numbered traffic distribution level can be performed.

[0066] The traffic distribution method provided in this embodiment obtains a container creation request, queries the remaining resources of all nodes in the container cloud and the architecture type of each node based on the container creation request; selects the target node from all nodes in the container cloud based on the remaining resources of each node; determines the traffic distribution level of each target node based on the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic distribution level; when it is determined that the number of containers contained in the target node meets the target number, the traffic is distributed to the containers of the target node based on the target number, the traffic distribution level of each target node and the architecture type of each target node. Based on the container creation request, the node that meets the requirements can be queried as the target node for traffic distribution, and then the traffic is distributed based on the architecture type, the remaining resources of the target node, etc. The traffic can be flexibly distributed in different dimensions, and the request can be distributed to different containers of different architectures to achieve load balancing. It is more efficient in traffic distribution and can better alleviate the business pressure of each node, so that the system can provide a more stable operating environment and enable the business system to continuously provide services robustly and stably.

[0067] In an optional embodiment, the remaining resources include the usage of the central processing unit, and the target node is selected from all nodes in the container cloud based on the remaining resources of each node, including:

[0068] When the usage rate of the central processing unit of the first node is less than or equal to a preset threshold, the first node is determined to be a target node, wherein the first node is any node in the container cloud.

[0069] Specifically, the remaining resources include the utilization rate of the central processing unit, such as the CPU utilization rate. The node whose CPU utilization rate is less than or equal to the preset threshold is used as the target node, such as the node whose CPU utilization rate is less than 20%. The specific value can be determined according to the actual situation.

[0070] In an optional implementation, when it is determined that the number of containers included in the target node does not meet the target number, the method further includes:

[0071] When the number of containers is greater than the target number, the containers larger than the target number will be evicted so that the number of containers on the target node is equal to the target number;

[0072] or,

[0073] When the number of containers is less than the target number, a new container is created at the target node so that the number of containers at the target node equals the target number.

[0074] Specifically, after determining the target node, the number of containers under the target node is obtained. If the number of containers under the target node is inconsistent with the target number, the containers under the target node are processed. If the number of containers is greater than the target number, the excess containers are evicted to ensure that the number of containers under the target node is equal to the target number. If the number of containers is less than the target number, a new container is created at the target node to ensure that the number of containers under the target node is equal to the target number.

[0075] In an optional example, for example, if the target number is 5, when the number of containers under target node A is 8, 3 containers are evicted to other nodes, so that the number of containers under target node A is 5; when the number of containers under target node B is 2, 3 new containers are created under target node B, so that the number of containers under target node B is 5.

[0076] In this embodiment, a traffic distribution method is provided, which can be used for the above-mentioned computer equipment, such as servers, container cloud platforms, etc. Figure 2 Flowchart of the flow distribution method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0077] Step S201: Obtain a container creation request.

[0078] Step S202: query the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request.

[0079] Step S203 : Filter out the target node from all nodes in the container cloud according to the remaining resources of each node.

[0080] Step S204 : determining the traffic allocation level of each target node according to the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level.

[0081] For details of steps S201, S202, S203 and S204, please refer to Figure 1 Step S101 , step S102 , step S103 and step S104 of the illustrated embodiment are not described in detail here.

[0082] Step S205 : When it is determined that the number of containers included in the target node meets the target number, traffic is distributed to the containers of the target node according to the target number, the traffic distribution level of each target node, and the architecture type of each target node.

[0083] The above step S205 includes:

[0084] Step S2051: Select a target level from all traffic distribution levels.

[0085] Specifically, a scheduling order may be set for the traffic allocation levels, and a target level may be selected from all traffic allocation levels according to the scheduling order.

[0086] In an optional example, for example, among the traffic allocation classes, the one with low CPU usage can be scheduled first, then the traffic allocation class with the lowest CPU usage can be selected from all the traffic allocation classes as the target class.

[0087] In an optional example, or according to the size of the traffic to be allocated, a traffic allocation level that best matches the size of the traffic to be allocated may be selected from all traffic allocation levels as the target level.

[0088] Step S2052: Determine the number of target nodes of the first architecture type in the target level.

[0089] Specifically, the first architecture type is any of the architecture types to which the target nodes corresponding to the target level belong. That is, the target number of nodes of each architecture type at the target level is determined. For example, the architecture type of each node can be determined using information such as a node identifier of each node, and then the target number of nodes of each architecture type can be counted.

[0090] In an optional example, for example, the target level includes 5 nodes of the ARM architecture type, 3 nodes of the ADM architecture type, and 1 node of other architecture types.

[0091] Step S2053 : determining a traffic allocation ratio of the first architecture type in the first traffic allocation level according to the target number and the target number of nodes of the first architecture type.

[0092] Specifically, in an optional example, traffic scheduling can be started from the selected first target level, the number of target nodes of each architecture type in the target level is determined, and the traffic allocation ratio of the architecture type is determined, for example, the ratio allocated to a larger number of target nodes is higher.

[0093] In an optional embodiment, the traffic allocation ratio of the first architecture type in the first traffic allocation level is determined based on the target number and the target number of nodes of the first architecture type, specifically by the following formula:

[0094] L1=N pod *N node1 *m1(Formula 1)

[0095] Among them, L1 is the traffic allocation ratio of the first architecture type, N pod is the target number, N node1 is the target number of nodes of the first architecture type, and m1 is the preset weight of the first architecture type.

[0096] Through the above method, different preset weights can be set for each architecture type based on actual conditions, such as the attributes of the architecture type, so that the traffic distribution ratio of each architecture type within the target level can be determined, which is more practical.

[0097] Step S2054 , allocating the to-be-allocated traffic to the target nodes corresponding to the target levels in accordance with the traffic allocation ratio corresponding to each architecture type in the target level.

[0098] Specifically, in an optional example, for example, the traffic to be allocated is 50G, and there are three architecture types. Through the evaluation of Formula 1, the traffic allocation ratio of the first architecture type is 40%, the traffic allocation ratio of the second architecture type is 40%, and the traffic allocation ratio of the third architecture type is 20%. Then the target nodes of the first architecture type are allocated a total of 20G traffic, the target nodes of the second architecture type are allocated a total of 20G traffic, and the target nodes of the third architecture type are allocated a total of 10G traffic. When there are multiple target nodes under the architecture type, the traffic can be allocated between the target nodes according to certain rules. For example, there are 5 target nodes under the first architecture type, and 4G traffic can be allocated to each node, or the traffic can be allocated according to the remaining resources of each target node. The specific allocation can be made according to the actual situation, and no excessive restrictions are made here.

[0099] Step S2055: When there is still surplus traffic to be allocated, the next traffic allocation level is selected from the traffic allocation levels, and the surplus is allocated using the target node corresponding to the next traffic allocation level until all traffic is allocated.

[0100] Specifically, when the traffic of all target nodes in the target level has been allocated, for example, the set threshold has been reached, but there is still surplus traffic to be allocated, the next traffic allocation level is selected from the traffic levels, such as the traffic allocation level of the next priority, and the number of target nodes of each architecture type in the next traffic allocation level is determined. Formula 1 is used to determine the traffic allocation ratio of each architecture type in the first traffic allocation level, and the surplus is allocated until all the traffic to be allocated is allocated.

[0101] Through the above method, the target nodes can be divided into multiple target levels according to the traffic allocation level, and the number of each architecture type in each target node and the number of target nodes under each architecture type can be counted respectively to determine the traffic allocation ratio of each traffic allocation level. When the target level cannot allocate all the traffic to be allocated, the next traffic allocation level will be selected for allocation. This can flexibly and orderly complete the distribution of traffic, balance the pressure of each node, and ensure the stable operation of the system.

[0102] In an optional embodiment, the target level is selected from all traffic distribution levels, including:

[0103] The traffic allocation class with the highest priority among the traffic allocation classes is selected as the target class.

[0104] Specifically, the priorities of the traffic allocation levels may be determined according to the remaining resources of all target nodes in each traffic allocation level, and the traffic allocation level with the highest priority among the traffic allocation levels may be selected as the target level.

[0105] In an optional embodiment, after each target node creates a target number of containers, the following steps are also included: Figure 3 The method steps shown are:

[0106] Step S301: monitor the status of each container in the target node.

[0107] Specifically, you can use commands to view the status of containers, perform health checks on containers, and obtain the health status of each container.

[0108] In step S302, when it is determined that the status of the first container is abnormal, the first container is expelled from the target node, and traffic is redistributed to the containers of the target node based on the number of remaining containers of each target node, the traffic distribution level of each target node, and the architecture type of each target node.

[0109] Specifically, the first container is any container in the target node. When the status of the first container is determined to be abnormal, the first container is expelled from the target node to other nodes, and then the traffic of the containers of the target node is redistributed according to the number of remaining containers of each target node, the traffic distribution level of each target node, and the architecture type of each target node. Other nodes should be target nodes that do not participate in traffic distribution.

[0110] In an optional implementation, a health check of the container can be performed when the container is created, or a customized runtime can be used to perform a health check at a customized time. The health check can include the health status of the container and whether the traffic distribution of the container has reached a threshold. If the traffic threshold is reached, the traffic distribution strategy can be recalculated to ensure that all traffic can be distributed in a timely manner.

[0111] Through the above method, the health status of the container can be monitored in real time, and containers with abnormal status can be handled in a timely manner to ensure the stability of the program running environment.

[0112] In order to make the method provided by the present invention clearer, the present invention also provides an embodiment in a specific scenario, for example, Figure 4In the "One Cloud, Multiple Cores" application scenario shown above, a cloud operating system is used to manage hardware server clusters of different architectures, including target nodes of multiple architecture types, such as Advanced Micro Devices (AMD) architecture, Advanced RISC Machine, ARM) architecture, LoongArch architecture, etc., multiple containers (pods) are mounted under each target node to initiate a container creation request for the "One Cloud Multi-Core" application as needed. The "One Cloud Multi-Core" application can set whether to enable the intelligent traffic splitting strategy. After the "One Cloud Multi-Core" application controller receives the user's creation request, when it determines to enable the intelligent traffic splitting strategy, it obtains the CPU usage of each node, filters out the target nodes according to the CPU usage, and sets different traffic allocation levels according to the CPU usage. For each traffic allocation level, the containers under the workload are grouped according to the target number of containers in the request, and the containers under the target node with a number greater than the target number are expelled. A container is created under the target node with a number of containers less than the target number, so that the number of containers under all target nodes is equal to the target number. The detection program (such as webhook) detects the creation of the pod and, based on the pod annotation (whether the traffic splitting strategy is enabled) and Figure 1 The traffic distribution method shown in the figure filters out nodes that do not meet the requirements, selects the optimal binding node to bind to the pod, and feedbacks the final status of the pod until all traffic distribution is completed.

[0113] The intelligent traffic splitting strategy under a specific traffic distribution level can be implemented by the following formula:

[0114] a1=N pod_AMD *N node_AMD *50% (Formula 2)

[0115] a2=N pod_ARM *N node_ARM *30% (Formula 3)

[0116] a3=N pod_LoongArch *N node_LoongArch *10% (Formula 4)

[0117] a4=N pod_other *N node_other *10% (Formula 5)

[0118] Among them, a1 is the traffic distribution ratio of AMD architecture type, N pod_AMD N is the number of pods per node of AMD architecture type. node_AMDis the number of target nodes of ADM architecture type, 50% is the preset weight of AMD architecture type; a2 is the traffic distribution ratio of ARM architecture type, N pod_ARM N is the number of pods per node of the ARM architecture type. node_ARM is the number of target nodes of ARM architecture type, 30% is the preset weight of ARM architecture type; a3 is the traffic distribution ratio of LoongArch architecture type, N pod_LoongArch N is the number of pods per node of the LoongArch architecture type. node_LoongArch is the number of target nodes of the LoongArch architecture type, 10% is the preset weight of the LoongArch architecture type; a4 is the traffic distribution ratio of other architecture types, N pod_other N is the number of pods per node for other architecture types. node_other is the number of target nodes for other architecture types, 10% is the preset weight for other architecture types, N pod_AMD 、N pod_ARM 、N pod_LoongArch and N pod_other Same as the target number of pods in the create request.

[0119] Taking 10G of traffic to be allocated as an example, the traffic allocated to each architecture type can be expressed by the following formula:

[0120]

[0121]

[0122]

[0123]

[0124] Among them, Q AMD Traffic allocated to nodes of AMD architecture type, Q ARM Traffic allocated to ARM architecture type nodes, Q LoongArch Allocate traffic to nodes of the LoongArch architecture type, Q other Traffic allocated to nodes of other architecture types.

[0125] After the One Cloud Multi-Core application is created, the Mesh Policy Controller listens to the service creation event and creates a Mesh Policy for the corresponding service based on whether the traffic intelligent segmentation strategy is enabled. It creates a virtual service and destination rule resources for the service and marks the service with a traffic intelligent segmentation strategy for the One Cloud Multi-Core application (e.g., Figure 1 After creating a "One Cloud, Multiple Cores" application, you can set up a traffic monitoring module. This module uses Prometheus-based traffic statistics and the "One Cloud, Multiple Cores" application's own health check mechanism. It also enables readiness and survival probes for health checks to monitor the application's pod status in real time.

[0126] For example, you can use the readiness probe (ReadinessProbe) to check the container readiness and determine whether the service is working properly (that is, check whether the container is ready to accept Http requests). If the service is not loaded or works abnormally, the IP address of the Pod where the service is located will be removed from the service node and will no longer accept or respond to any requests. Use the liveness probe (LivenessProbe) online inspection mechanism to determine whether the container is in a running state. When the service crashes or deadlocks, the container orchestration engine (kubernetes, k8s for short) will delete the container and then perform related restart operations according to the restart policy (restart policy) set. If the health check is normal (for example, the health check request (such as HTTPGetAction class request) passes the container's IP, port, PATH path, and uses HTTP GET to request the check, and the return response code is 200 <= response code < 400), if the health check is still abnormal after restarting based on the restart policy, the health check result is abnormal and the pod status is set to abnormal. When the pod status is normal and the monitored traffic reaches the pod traffic threshold, the intelligent traffic splitting mechanism can be triggered using Figure 1 The traffic distribution method shown in the figure is used for traffic distribution, or when the health check mechanism sets the pod as abnormal, it is also used Figure 1 The flow distribution method shown is used to distribute the flow.

[0127] This embodiment also provides a flow distribution device for implementing the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.

[0128] This embodiment provides a flow distribution device, such as Figure 5 Shown, including:

[0129] An acquisition module 501 is configured to acquire a container creation request, wherein the container creation request includes a target number of containers to be created;

[0130] A query module 502 is configured to query the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request;

[0131] The screening module 503 is used to screen out target nodes from all nodes in the container cloud according to the remaining resources of each node;

[0132] A determination module 504 is configured to determine the traffic allocation level of each target node based on the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level;

[0133] The first allocation module 505 is configured to allocate traffic to the containers of the target node according to the target number, the traffic allocation level of each target node, and the architecture type of each target node when it is determined that the number of containers included in the target node meets the target number.

[0134] In some optional implementations, the remaining resources in the screening module 503 include a usage rate of a central processing unit, and the screening module 503 includes:

[0135] The determination unit is configured to determine that the first node is a target node when the usage rate of the central processing unit of the first node is less than or equal to a preset threshold, wherein the first node is any node in the container cloud.

[0136] In some optional implementations, when it is determined that the number of containers included in the target node does not meet the target number, the apparatus further includes:

[0137] An eviction module 506 is configured to evict containers that are greater than a target number when the number of containers is greater than a target number, so that the number of containers on the target node is equal to the target number;

[0138] or,

[0139] The new creation module 507 is configured to create a new container at the target node when the number of containers is less than the target number, so that the number of containers at the target node is equal to the target number.

[0140] In some optional embodiments, the traffic allocation level includes at least one, allocation module 505, including:

[0141] A selection unit, used for selecting a target level from all flow distribution levels;

[0142] a determining unit configured to determine a number of target nodes belonging to a first architecture type in a target level, wherein the first architecture type is any architecture type to which the target nodes corresponding to the target level belong; and determine a traffic allocation ratio of the first architecture type in a first traffic allocation level based on the target number and the number of target nodes of the first architecture type;

[0143] The traffic allocation unit is used to allocate the traffic to be allocated to the target nodes corresponding to the target levels in turn according to the traffic allocation ratio corresponding to each architecture type in the target level; when there is still surplus traffic to be allocated, the next traffic allocation level is selected from the traffic allocation level, and the surplus is allocated using the target nodes corresponding to the next traffic allocation level until all traffic is allocated.

[0144] In some optional implementations, the selecting unit specifically includes:

[0145] The traffic allocation class with the highest priority among the traffic allocation classes is selected as the target class.

[0146] In some optional implementations, the determining unit determines the traffic allocation ratio of the first architecture type in the first traffic allocation level based on the target number and the target number of nodes of the first architecture type, specifically by the following formula:

[0147] L1=N pod *N node1 *m1

[0148] Among them, L1 is the traffic allocation ratio of the first architecture type, N pod is the target number, N node1 is the target number of nodes of the first architecture type, and m1 is the preset weight of the first architecture type.

[0149] In some optional implementations, after each target node creates a target number of containers, the apparatus further includes:

[0150] The monitoring module is used to monitor the status of each container in the target node;

[0151] The second allocation module 508 is configured to evict the first container from the target node when the status of the first container is abnormal, and redistribute traffic to the containers of the target node based on the number of remaining containers of each target node, the traffic allocation level of each target node, and the architecture type of each target node, where the first container is any container in the target node.

[0152] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0153] The flow distribution device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0154] The embodiment of the present invention also provides a computer device having the above Figure 5 The flow distribution device shown.

[0155] See also Figure 6 , Figure 6 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0156] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.

[0157] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.

[0158] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0159] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0160] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0161] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0162] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A flow distribution method, characterized in that: The method comprises: Obtaining a container creation request, wherein the container creation request includes a target number of containers to be created; Querying the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request; Filtering a target node from all nodes in the container cloud according to the remaining resources of each node; Determining the traffic allocation level of each target node according to the remaining resources of each target node and the mapping relationship between the remaining resources and the traffic allocation level; When it is determined that the number of containers included in the target node meets the target number, traffic is distributed to the containers of the target node according to the target number, the traffic distribution level of each target node, and the architecture type of each target node.

2. The method according to claim 1, characterized in that The remaining resources include the usage rate of a central processing unit, and the step of selecting a target node from all nodes in the container cloud according to the remaining resources of each node includes: When the usage rate of the central processing unit of the first node is less than or equal to a preset threshold, the first node is determined to be a target node, wherein the first node is any node in the container cloud.

3. The method according to claim 1 or 2, characterized in that When it is determined that the number of containers included in the target node does not meet the target number, the method further includes: When the number of containers is greater than the target number, the containers greater than the target number are evicted so that the number of containers on the target node is equal to the target number. or, When the number of containers is less than the target number, a new container is created at the target node so that the number of containers at the target node is equal to the target number.

4. The method according to claim 1 or 2, characterized in that The traffic allocation level includes at least one, and the traffic allocation to the containers of the target nodes according to the number of targets, the traffic allocation level of each target node, and the architecture type of each target node includes: Select a target level from all traffic allocation levels; Determining the number of target nodes in the target level that belong to a first architecture type, wherein the first architecture type is any architecture type among the architecture types to which the target nodes corresponding to the target level belong; determining a traffic allocation ratio of the first architecture type in a first traffic allocation level based on the target number and the target number of nodes of the first architecture type; Allocate the traffic to be allocated to the target nodes corresponding to the target levels respectively according to the traffic allocation ratio corresponding to each architecture type in the target level; When there is still a surplus in the traffic to be allocated, the next traffic allocation level is selected from the traffic allocation levels, and the surplus is allocated using the target node corresponding to the next traffic allocation level until all traffic is allocated.

5. The method according to claim 4, characterized in that The target level is selected from all traffic allocation levels, including: The traffic allocation level with the highest priority among the traffic allocation levels is selected as the target level.

6. The method according to claim 4, characterized in that The traffic allocation ratio of the first architecture type in the first traffic allocation level is determined according to the target number and the target number of nodes of the first architecture type, specifically by the following formula: in, The traffic allocation ratio for the first architecture type, is the target quantity, is the target number of nodes for the first architecture type, The preset weight for the first architecture type.

7. The method according to any one of claims 1 to 2 or 5 to 6, characterized in that After each of the target nodes creates the target number of containers, the method further includes: Monitoring the status of each container in the target node; When it is determined that the status of the first container is abnormal, the first container is expelled from the target node, and traffic is redistributed for the containers of the target node based on the number of remaining containers of each target node, the traffic allocation level of each target node, and the architecture type of each target node, wherein the first container is any container in the target node.

8. A flow distribution device, characterized in that: The device comprises: an acquisition module, configured to acquire a container creation request, wherein the container creation request includes a target number of containers to be created; A query module, configured to query the remaining resources of all nodes in the container cloud and the architecture type of each node according to the container creation request; A screening module, configured to screen out target nodes from all nodes in the container cloud according to the remaining resources of each node; a determination module, configured to determine the flow allocation level of each of the target nodes according to the remaining resources of each of the target nodes and a mapping relationship between the remaining resources and the flow allocation level; The allocation module is configured to allocate traffic to the containers of the target node according to the target number, the traffic allocation level of each target node, and the architecture type of each target node when it is determined that the number of containers included in the target node meets the target number.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the flow distribution method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the flow distribution method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Traffic distribution method and device, equipment, storage medium and program product

    CN115941604A

  • Flow control method and device, electronic equipment and storage medium

    CN116233005A