CN116708303A - Traffic distribution method, traffic distribution device, computer equipment and storage medium - Google Patents

Traffic distribution method, traffic distribution device, computer equipment and storage medium Download PDF

Info

Publication number
CN116708303A
CN116708303A CN202310905071.5A CN202310905071A CN116708303A CN 116708303 A CN116708303 A CN 116708303A CN 202310905071 A CN202310905071 A CN 202310905071A CN 116708303 A CN116708303 A CN 116708303A
Authority
CN
China
Prior art keywords
target
node
nodes
containers
flow distribution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310905071.5A
Other languages
Chinese (zh)
Inventor
李凤娟
朱志文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Jinan data Technology Co ltd
Original Assignee
Inspur Jinan data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Jinan data Technology Co ltd filed Critical Inspur Jinan data Technology Co ltd
Priority to CN202310905071.5A priority Critical patent/CN116708303A/en
Publication of CN116708303A publication Critical patent/CN116708303A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of computers, and discloses a flow distribution method, a flow distribution device, computer equipment and a storage medium, wherein the flow distribution method comprises the following steps: acquiring a container creation request, and inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request; screening target nodes from all nodes in the container cloud according to the residual resources of each node; determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level; and when the number of containers contained in the target nodes meets the target number, carrying out flow distribution on the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node. The invention can reasonably distribute the flow based on different architectures, and can ensure that a business system can continuously, robustly and stably provide service.

Description

Traffic distribution method, traffic distribution device, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a flow allocation method, a flow allocation device, a computer device, and a storage medium.
Background
A cloud multi-core refers to a set of cloud operating systems to manage a cluster of hardware servers of different architectures. The conventional cloud platform can only shield hardware details of a CPU of one architecture and manage the CPU through cloud management software, but the management mode cannot cover all user demands, and the distribution of flow can only be carried out according to the distribution proportion based on the container of the same platform architecture by human intervention, so that the environment and the configuration of the new version container are consistent with those of the old version, the pressure of environment configuration is increased intangibly, and the time and space limitations of flow distribution are increased. The distribution of the flow can only be based on the drainage of the flow of the same platform architecture, the automatic adjustment of the flow distribution can not be performed across the type of the platform architecture, the pressure ratio of the environment is large, the environmental stability is also very challenging, and the problems of resource waste, complex operation and maintenance, incapability of uniform management, poor user experience and the like exist.
Disclosure of Invention
In view of the above, the present invention provides a traffic distribution method, apparatus, computer device and storage medium, so as to solve the problem that traffic distribution cannot be performed across platform architecture types.
In a first aspect, the present invention provides a traffic distribution method, including:
obtaining a container creation request, wherein the container creation request comprises the target number of containers to be created;
inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request;
screening target nodes from all nodes in the container cloud according to the residual resources of each node;
determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level;
and when the number of containers contained in the target nodes meets the target number, carrying out flow distribution on the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node.
The flow distribution method provided by the invention has the following advantages:
acquiring a container creation request, and inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request; screening target nodes from all nodes in the container cloud according to the residual resources of each node; determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level; and when the number of containers contained in the target nodes meets the target number, carrying out flow distribution on the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node. The method can be used for inquiring the nodes meeting the requirements based on the container creation request as target nodes for flow distribution, then distributing the flows according to the architecture type, the residual resources of the target nodes and the like, flexibly distributing the flows in different dimensions, distributing the requests to different containers of different architectures, realizing load balancing, realizing higher efficiency in flow distribution, relieving the service pressure of each node, enabling the system to provide a more stable running environment, and enabling the service system to continuously, robustly and stably provide services.
In an alternative embodiment, the remaining resources include a utilization rate of the central processor, and the selecting the target node from all nodes in the container cloud according to the remaining resources of each node includes:
and when the utilization rate of the central processing unit of the first node is smaller than or equal to a preset threshold value, determining the first node as a target node, wherein the first node is any node in the container cloud.
In an alternative embodiment, when it is determined that the number of containers contained in the target node does not meet the target number, the method further includes:
when the number of the containers is greater than the target number, expelling the containers greater than the target number, so that the number of the containers of the target node is equal to the target number;
or,
and when the number of the containers is smaller than the target number, newly building containers at the target node, so that the number of the containers of the target node is equal to the target number.
In an alternative embodiment, the traffic distribution level includes at least one, and the traffic distribution to the containers of the target nodes according to the target number, the traffic distribution level of each target node, and the architecture type of each target node includes:
selecting a target level from all flow distribution levels;
Determining the number of target nodes belonging to a first architecture type in a target level, wherein the first architecture type is any one of architecture types of the target nodes corresponding to the target level;
determining a flow distribution proportion of the first architecture type in the first flow distribution level according to the target number and the target node number of the first architecture type;
the flow to be distributed is distributed to the target nodes corresponding to the target levels according to the flow distribution proportion corresponding to each architecture type in the target levels;
when the flow to be allocated still has the allowance, selecting the next flow allocation level from the flow allocation levels, and allocating the allowance by utilizing the target node corresponding to the next flow allocation level until all the flows are allocated.
According to the method, the target nodes can be divided into a plurality of target levels according to the flow distribution levels, the number of each architecture type in each target node and the number of the target nodes under each architecture type are counted respectively, the flow distribution proportion of each flow distribution level is determined, when the target levels can not distribute all the flows to be distributed, the next flow distribution level is selected for distribution, the distribution of the flows can be completed flexibly and orderly, the pressure of each node is balanced, and the stable operation of the system is ensured.
In an alternative embodiment, selecting a target level from all traffic distribution levels includes:
and selecting the traffic distribution level with the highest priority among the traffic distribution levels as a target level.
In an alternative embodiment, the traffic distribution proportion of the first architecture type in the first traffic distribution level is determined according to the target number and the target node number of the first architecture type, specifically by the following formula:
L 1 =N pod *N node1 *m1
wherein L is 1 Allocating proportions, N, for traffic of a first architecture type pod For the target number N node1 For the number of target nodes of the first architecture type, m1 is a preset weight of the first architecture type.
In an alternative embodiment, after each target node creates a target number of containers, the method further comprises:
monitoring the state of each container in the target node;
when the state of the first container is determined to be abnormal, the first container is evicted from the target nodes, and the flow distribution is carried out on the containers of the target nodes again according to the number of the remaining containers of each target node, the flow distribution level of each target node and the architecture type of each target node, wherein the first container is any container in the target nodes.
In a second aspect, the present invention provides a flow distribution device comprising:
the acquisition module is used for acquiring a container creation request, wherein the container creation request comprises the target number of containers to be created;
the query module is used for querying the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request;
the screening module is used for screening out target nodes from all nodes in the container cloud according to the residual resources of each node;
the determining module is used for determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level;
and the distribution module is used for distributing the flow of the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node when the number of the containers contained in the target nodes is determined to meet the target number.
In a third aspect, the present invention provides a computer device comprising: the flow distribution device comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions, so that the flow distribution method of the first aspect or any implementation mode corresponding to the first aspect is executed.
In a fourth aspect, the present invention provides a computer readable storage medium having stored thereon computer instructions for causing a computer to perform the flow distribution method of the first aspect or any of its corresponding embodiments.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a flow distribution method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another flow distribution method according to an embodiment of the present invention;
FIG. 3 is a flow chart of yet another flow distribution method according to an embodiment of the present invention;
FIG. 4 is a flow chart of yet another flow distribution method according to an embodiment of the present invention
Fig. 5 is a block diagram of a flow distribution device according to an embodiment of the present invention;
Fig. 6 is a schematic diagram of a hardware structure of a computer device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In a container cloud platform with different architectures, cloud management software is generally used for managing containers under nodes with different architecture types, but the method can not cover all client requirements, and the problems of resource waste, complex operation and maintenance, incapability of unified maintenance and management, poor user experience and the like still exist. In the related art, when a container management platform (Kubernetes, abbreviated as K8 s) is applied, the distribution of the traffic can only be based on containers (pod) with the same platform architecture, and the traffic distribution of the pod traffic of the new version and the old version can be realized according to the distribution proportion through human intervention, the environment and the configuration of the pod of the new version are consistent with those of the old version, the pressure of the environment configuration is increased intangibly, and the time and space limitations of the traffic distribution are increased.
Based on this, in accordance with an embodiment of the present invention, there is provided a flow distribution method embodiment, it being noted that the steps shown in the flow chart of the drawings may be performed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flow chart, in some cases the steps shown or described may be performed in an order different from that shown or described herein.
In this embodiment, a flow distribution method is provided, which may be used in the above-mentioned computer devices, such as a server, a container cloud platform, etc., and fig. 1 is a flowchart of a flow distribution method according to an embodiment of the present invention, as shown in fig. 1, where the flow includes the following steps:
step S101, a container creation request is acquired.
Specifically, the container creation request includes a target number of containers to be created.
In an alternative example, for example, the user initiates a container creation request according to the actual service need, where the request contains the number of containers required for the service, i.e. the target number.
Step S102, inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request.
Specifically, after the creation request is obtained, the remaining resources of all the nodes in the container cloud platform and the architecture type of each node are queried, wherein the remaining resources refer to unused resources which can be used for other computation.
In an alternative example, the architecture types may include, for example: container cloud platforms such as superwei semiconductor (Advanced Micro Devices, AMD) architecture types, advanced reduced instruction set machine (Advanced RISC Machine, ARM) architecture types, and the like may contain architecture types.
And step S103, screening out target nodes from all nodes in the container cloud according to the residual resources of each node.
Specifically, a residual resource threshold may be set, and when the residual resource of the node is greater than or equal to the residual resource threshold, the node is used as a target node, and all the target nodes can be screened out by traversing all the nodes, where the target node is a candidate node for traffic distribution.
Step S104, determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level.
Specifically, a mapping relationship between the remaining resources and the traffic distribution levels may be established, and the remaining resources of each target node are matched with each traffic distribution level in the mapping relationship, so as to determine the traffic distribution level of the target node.
In an alternative example, for example, if the remaining resources of the target node a are located 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 one of all the traffic allocation levels.
Step S105, when it is determined that the number of containers included in the target node meets the target number, performing traffic distribution on 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.
Specifically, when the number of containers contained in the target node is determined to meet the target number, the allocation sequence of the target node can be determined according to the flow allocation level, and then the allocation strategy of the target node under the flow allocation level is determined according to the target number and the architecture type of the target node, so that the flow allocation is performed on the target node.
In an alternative example, the flow allocation levels may be set with labels according to a certain rule, and flow allocation is performed according to the sequence of the labels, and when all the nodes in the flow allocation level of the first label are saturated, the flow allocation operation of the flow allocation level of the next label is performed.
According to the flow distribution method provided by the embodiment, a container creation request is obtained, and the remaining resources of all nodes in the container cloud and the architecture type of each node are inquired according to the container creation request; screening target nodes from all nodes in the container cloud according to the residual resources of each node; determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level; and when the number of containers contained in the target nodes meets the target number, carrying out flow distribution on the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node. The method can be used for inquiring the nodes meeting the requirements based on the container creation request as target nodes for flow distribution, then distributing the flows according to the architecture type, the residual resources of the target nodes and the like, flexibly distributing the flows in different dimensions, distributing the requests to different containers of different architectures, realizing load balancing, realizing higher efficiency in flow distribution, relieving the service pressure of each node, enabling the system to provide a more stable running environment, and enabling the service system to continuously, robustly and stably provide services.
In an alternative embodiment, the remaining resources include a utilization rate of the central processor, and the selecting the target node from all nodes in the container cloud according to the remaining resources of each node includes:
and when the utilization rate of the central processing unit of the first node is smaller than or equal to a preset threshold value, determining the first node as a target node, wherein the first node is any node in the container cloud.
Specifically, the remaining resources include the utilization rate of the central processing unit, for example, the utilization rate of the CPU, and the node with the utilization rate of the CPU less than or equal to the preset threshold is taken as the target node, for example, the node with the utilization rate of the CPU less than 20%, which is specific to the actual situation.
In an alternative embodiment, when it is determined that the number of containers contained in the target node does not meet the target number, the method further includes:
when the number of the containers is greater than the target number, expelling the containers greater than the target number, so that the number of the containers of the target node is equal to the target number;
or,
and when the number of the containers is smaller than the target number, newly building containers at the target node, so that the number of the containers of the target node is equal to the target number.
Specifically, after the target node is determined, the number of containers under the target node is obtained, and when the number of containers under the target node is inconsistent with the target number, the containers under the target node are processed. When the number of the containers is larger than the target number, the redundant containers are evicted, the number of the containers under the target node is guaranteed to be equal to the target number, and when the number of the containers is smaller than the target number, new containers are created in the target node, and the number of the containers under the target node is guaranteed to be equal to the target number.
In an alternative example, for example, the target number is 5, when the number of containers under the target node a is 8, 3 containers are evicted to other nodes, so that the number of containers under the target node a is 5; when the number of containers under the target node B is 2, 3 containers are newly created under the target node B, so that the number of containers under the target node B is 5.
In this embodiment, a flow distribution method is provided, which may be used in the above-mentioned computer devices, such as a server, a container cloud platform, etc., and fig. 2 is a flowchart of the flow distribution method according to an embodiment of the present invention, as shown in fig. 2, where the flow includes the following steps:
step S201, a container creation request is acquired.
Step S202, inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request.
And step S203, screening out target nodes from all nodes in the container cloud according to the residual resources of each node.
Step S204, determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level.
Please refer to the steps S101, S102, S103 and S104 of the embodiment shown in fig. 1 in detail, and the details of step S201, step S202, step S203 and step S204 are not described herein.
In step S205, when it is determined that the number of containers included in the target node meets the target number, the flow distribution level of each target node and the architecture type of each target node are used to distribute the flow to the containers of the target node.
The step S205 includes:
step S2051, selecting a target level from all the traffic distribution levels.
Specifically, a scheduling order may be set for the traffic allocation levels, and a target level may be selected from all the traffic allocation levels according to the scheduling order.
In an alternative example, for example, the traffic allocation level may be scheduled with priority, where the CPU usage rate is low, then the traffic allocation level with the lowest CPU usage rate may be selected from all the traffic allocation levels as the target level.
In an alternative 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.
In step S2052, the number of target nodes belonging to the first architecture type in the target level is determined.
Specifically, the first architecture type is any architecture type of architecture types to which the target node corresponding to the target level belongs. I.e., the number of target nodes for each architecture type in the target level. For example, the architecture type of each node may be determined by information such as the node identification of each node, and then the number of target nodes for each architecture type may be counted.
In an alternative example, for example, 5 nodes of ARM architecture type, 3 nodes of ADM architecture type, and 1 node of other architecture type are included in the target level.
In step S2053, the traffic distribution proportion of the first architecture type in the first traffic distribution level is determined according to the target number and the target node number of the first architecture type.
Specifically, in an alternative example, for example, traffic scheduling may be performed from a first target level selected, the number of target nodes of each architecture type in the target level may be determined, and the traffic allocation proportion of the architecture type may be determined, for example, the allocated proportion of the number of target nodes is higher.
In an alternative embodiment, the traffic distribution proportion of the first architecture type in the first traffic distribution level is determined according to the target number and the target node number of the first architecture type, specifically by the following formula:
L 1 =N pod *N node1 * m1 (equation 1)
Wherein L is 1 Allocating proportions, N, for traffic of a first architecture type pod For the target number N node1 For the number of target nodes of the first architecture type, m1 is a preset weight of the first architecture type.
By the method, different preset weights can be set for each architecture type according to actual conditions, such as the attributes of the architecture type, the flow distribution proportion of each architecture type in the target level can be determined, and the practicability is higher.
Step S2054, distributing the flow to be distributed to the target nodes corresponding to the target levels according to the flow distribution proportion corresponding to each architecture type in the target levels.
Specifically, in an alternative example, for example, the traffic to be allocated is 50G, there are three architecture types, through the evaluation of formula 1, the traffic allocation proportion of the first architecture type is 40%, the traffic allocation proportion of the second architecture type is 40%, the traffic allocation proportion of the third architecture type is 20%, then the target nodes of the first architecture type allocate 20G traffic in total, the target nodes of the second architecture type allocate 20G traffic in total, the target nodes of the third architecture type allocate 10G traffic in total, in the case that there are multiple target nodes in the architecture type, the target nodes may allocate traffic according to a certain rule, for example, there are 5 target nodes in the first architecture type, each node may allocate 4G traffic, or allocate traffic according to the remaining resources of each target node, and the allocation is not limited in any way.
Step S2055, when there is a margin in the flow to be allocated, selecting a next flow allocation level from the flow allocation levels, and allocating the margin by using the target node corresponding to the next flow allocation level until all the flows are allocated.
Specifically, when the traffic of all the target nodes of the target level is completely allocated, for example, the traffic reaches a set threshold, but the traffic to be allocated still has a margin, selecting a next traffic allocation level from the traffic allocation levels, for example, the traffic allocation level of the next priority, determining the number of target nodes of each architecture type in the next traffic allocation level, determining the traffic allocation proportion of each architecture type in the first traffic allocation level by using the formula 1, and allocating the margin until all the traffic to be allocated is completely allocated.
According to the method, the target nodes can be divided into a plurality of target levels according to the flow distribution levels, the number of each architecture type in each target node and the number of the target nodes under each architecture type are counted respectively, the flow distribution proportion of each flow distribution level is determined, when the target levels can not distribute all the flows to be distributed, the next flow distribution level is selected for distribution, the distribution of the flows can be completed flexibly and orderly, the pressure of each node is balanced, and the stable operation of the system is ensured.
In an alternative embodiment, selecting a target level from all traffic distribution levels includes:
And selecting the traffic distribution level with the highest priority among the traffic distribution levels as a target level.
Specifically, the priority of the traffic distribution levels can be determined according to the residual resources of all the target nodes in each traffic distribution level, and the traffic distribution level with the highest priority in the traffic distribution levels is selected as the target level.
In an alternative embodiment, after each target node creates a target number of containers, the method steps as shown in fig. 3 are further included:
in step S301, the status of each container in the target node is monitored.
Specifically, the health of each container can be obtained by checking the state of the container through a command and performing health check on the container.
In step S302, when the state of the first container is determined to be abnormal, the first container is evicted from the target nodes, and the containers of the target nodes are re-allocated according to the number of remaining containers of each target node, the flow allocation level of each target node, and the architecture type of each target node.
Specifically, the first container is any container in the target nodes, when the state of the first container is determined to be abnormal, the first container is evicted from the target nodes to other nodes, and then the containers of the target nodes are subjected to traffic distribution again according to the number of the remaining containers of each target node, the traffic distribution level of each target node and the architecture type of each target node, and the other nodes are the target nodes which do not participate in the traffic distribution.
In an alternative embodiment, the health check on the container may be performed when the creation of the container is completed, or may be performed at a custom operation time, where the health check may include the health status of the container, or may include whether the flow allocation of the container has reached a threshold, and if the flow threshold is reached, the flow allocation policy may be recalculated, so as to ensure that all flows may be allocated in time.
By the method, the health state of the container can be monitored in real time, the container with abnormal state can be processed in time, and the stability of the program running environment is ensured.
In order to make the method provided by the present invention clearer, the present invention further provides an embodiment in a specific scenario, for example, in a "one-cloud-multicore" application scenario as shown in fig. 4, which refers to a set of cloud operating systems for managing hardware server clusters of different architectures, including a plurality of architecture types of target nodes, such as an ultrafine semiconductor (Advanced Micro Devices, AMD) architecture, an advanced reduced instruction set machine (Advanced RISC Machine, ARM) architecture, a loonggarch architecture, and the like, each of which downloads a plurality of containers (pod) for initiating a create container request of the "one-cloud-multicore" application as required, where the "one-cloud-multicore" application may set whether to open an intelligent traffic splitting policy, and when it is determined that the intelligent traffic splitting policy is opened after the "one-cloud-multicore" application controller receives the create request of a user, obtaining CPU utilization rate of each node, screening out target nodes according to the CPU utilization rate, setting different flow distribution grades according to CPU utilization, grouping containers under workload according to target quantity of containers in requests, expelling containers under target nodes with the quantity larger than the target quantity, creating containers under target nodes with the quantity smaller than the target quantity, enabling the quantity of the containers under all the target nodes to be equal to the target quantity, detecting the creation of pod by a detection program (such as webhook), filtering nodes which do not meet the requirements according to annotation (whether to open a flow segmentation strategy) of the pod and a flow distribution method shown in figure 1, selecting optimal binding nodes to bind with the pod and feeding back the final state of the pod, until all flow distribution is completed.
The intelligent flow segmentation strategy under a specific flow distribution level can be realized by the following formula:
a 1 =N pod_AMD *N node_AMD *50% (formula 2)
a 2 =N pod_ARM *N node_ARM *30% (formula 3)
a 3 =N pod_LoongArch *N node_LoongArch *10% (formula 4)
a 4 =N pod_other *N node_other *10% (formula 5)
Wherein a is 1 Distributing proportion, N, for AMD architecture type traffic pod_AMD Number of pod per node, N, of AMD architecture type node_AMD The number of target nodes of the ADM architecture type is 50% of the preset weight of the AMD architecture type; a, a 2 For ARM architecture type traffic allocation proportion, N pod_ARM Number of pod for each node of ARM architecture type, N node_ARM The number of target nodes of the ARM architecture type is 30% of preset weight of the ARM architecture type; a, a 3 Flow distribution ratio for LoongArch architecture type, N pod_LoongArch Number of pod per node for LoongArch architecture type, N node_LoongArch The number of target nodes of the LoongArch architecture type is 10%, and the preset weight of the LoongArch architecture type is 10%; a, a 4 Allocating proportions, N, for traffic of other architecture types pod_other Number of pod for each node of other architecture types, N node_other For the number of target nodes of other architecture types, 10% is the preset weight of other architecture types, N pod_AMD 、N pod_ARM 、N pod_LoongArch N pod_other The same is true for the target number of pod in the create request.
Taking 10G traffic to be allocated as an example, the traffic allocated to each architecture type can be expressed by the following formula:
Wherein Q is AMD Traffic, Q, allocated for nodes of AMD architecture type ARM Traffic allocated for ARM architecture type nodes, Q LoongArch Allocating traffic for nodes of the LoongArch architecture type, Q other Traffic allocated for nodes of other architecture types.
After a cloud multi-core application is created, a grid policy controller (Meshpolicy controller) monitors a service creation event, creates a grid policy for a corresponding service according to whether to open a traffic intelligent segmentation policy, creates virtual service (virtual service) and target rule (destinationrule) resources for the service, and marks the service to configure the traffic intelligent segmentation policy of the cloud multi-core application (i.e. a traffic distribution method as shown in fig. 1). After the 'cloud multi-core' application is created, a flow monitoring module can be arranged, and a ready probe and a survival probe for health examination are started by adopting a monitoring flow statistics based on Prometheus (Prometheus) and a health examination mechanism of the 'cloud multi-core' application so as to monitor the pod state of the application in real time.
For example, a ready probe (readiness probe) may be used to perform a container ready check to determine if the service is already working properly (i.e., see if the container is ready to accept Http requests), if the service is not loaded to completion or working abnormally, the IP address of the Pod where the service is located will be removed from the node of the service and will not accept or respond to any more requests; an online checking mechanism of a survival probe (LivenessProbe) is used for judging whether a container is in an operating state, when conditions such as service breakdown or deadlock occur, a container orchestration engine (k 8 s) deletes the container, then related restarting operation is carried out according to a restarting strategy (restart policy) set by the container, if health checking is in a normal state (for example, a health checking request (for example, HTTPGetAction request) passes through an IP, a port and a PATH of the container, checking is carried out by using an HTTP GET mode request, a response code is returned to be 200< = the response code < 400), if the health checking is still abnormal after restarting based on the restart policy, a health checking result is abnormal, and a pod state is set to be abnormal. When the pod state is normal and the monitored flow reaches the pod flow threshold, the intelligent flow splitting mechanism can be triggered, and the flow distribution method shown in fig. 1 is used for flow distribution, or when the health checking mechanism sets the pod as abnormal, the flow distribution method shown in fig. 1 is also used for flow distribution.
In this embodiment, a flow distribution device is further provided, and this device is used to implement the foregoing embodiments and preferred embodiments, and will not be described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The present embodiment provides a flow distribution device, as shown in fig. 5, including:
an obtaining module 501, configured to obtain a container creation request, where the container creation request includes a target number of containers to be created;
a query module 502, configured to query, according to a container creation request, remaining resources of all nodes in the container cloud and a architecture type of each node;
a screening module 503, configured to screen a target node from all nodes in the container cloud according to the remaining resources of each node;
a determining module 504, configured to determine a traffic 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 traffic allocation level;
The first allocation module 505 is configured to, when it is determined that the number of containers included in the target node meets the target number, allocate the 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.
In some alternative embodiments, the remaining resources in the screening module 503 include usage of the central processor, and the screening module 503 includes:
and the determining unit is used for determining the first node as a target node when the utilization rate of the central processing unit of the first node is smaller than or equal to a preset threshold value, wherein the first node is any node in the container cloud.
In some alternative embodiments, when it is determined that the number of containers contained by the target node does not meet the target number, the apparatus further includes:
an eviction module 506, configured to evict, when the number of containers is greater than the target number, containers greater than the target number, so that the number of containers of the target node is equal to the target number;
or,
and a new module 507, configured to newly create containers 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.
In some alternative embodiments, the flow distribution level includes at least one, the distribution module 505, comprising:
A selecting unit for selecting a target level from all the flow distribution levels;
a determining unit, configured to determine the number of target nodes belonging to a first architecture type in the target level, where the first architecture type is any architecture type of architecture types to which the target node corresponding to the target level belongs; determining a flow distribution proportion of the first architecture type in the first flow distribution level according to the target number and the target node number of the first architecture type;
the flow distribution unit is used for distributing the flow to be distributed to the target nodes corresponding to the target levels respectively according to the flow distribution proportion corresponding to each architecture type in the target levels respectively; when the flow to be allocated still has the allowance, selecting the next flow allocation level from the flow allocation levels, and allocating the allowance by utilizing the target node corresponding to the next flow allocation level until all the flows are allocated.
In some alternative embodiments, the selecting unit specifically includes:
and selecting the traffic distribution level with the highest priority among the traffic distribution levels as a target level.
In some optional embodiments, the determining unit determines, according to the target number, the target node number of the first architecture type, a traffic allocation proportion of the first architecture type in the first traffic allocation level, specifically by the following formula:
L 1 =N pod *N node1 *m1
Wherein L is 1 Allocating proportions, N, for traffic of a first architecture type pod For the target number N node1 For the number of target nodes of the first architecture type, m1 is a preset weight of the first architecture type.
In some alternative embodiments, after each target node creates a target number of containers, the apparatus further comprises:
the monitoring module is used for monitoring the state of each container in the target node;
the second allocation module 508 is configured to, when the state of the first container is abnormal, evict the first container from the target nodes, and re-allocate the traffic to the containers of the target nodes according to 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 nodes.
Further functional descriptions of the above respective modules and units are the same as those of the above corresponding embodiments, and are not repeated here.
The flow distribution means in this embodiment are presented in the form of functional units, here referred to as ASIC (Application Specific Integrated Circuit ) circuits, processors and memories executing one or more software or fixed programs, and/or other devices that can provide the above described functionality.
The embodiment of the invention also provides a computer device which is provided with the flow distribution device shown in the figure 5.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a computer device according to an alternative embodiment of the present invention, as shown in fig. 6, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are communicatively coupled to each other using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions executing within the computer device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In some alternative embodiments, multiple processors and/or multiple buses may be used, if desired, along with multiple memories and multiple memories. Also, multiple computer devices may be connected, each providing a portion of the necessary operations (e.g., as a server array, a set of blade servers, or a multiprocessor system). One processor 10 is illustrated in fig. 6.
The processor 10 may be a central processor, a network processor, or a combination thereof. The processor 10 may further include a hardware chip, among others. 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.
Wherein the memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform a method for implementing the embodiments described above.
The memory 20 may include a storage program area that may store an operating system, at least one application program required for functions, and a storage data area; the storage data area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, memory 20 may optionally include memory located remotely from processor 10, which may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk, or solid state disk; the memory 20 may also comprise a combination of the above types of memories.
The computer device also includes a communication interface 30 for the computer device to communicate with other devices or communication networks.
The embodiments of the present invention also provide a computer readable storage medium, and the method according to the embodiments of the present invention described above may be implemented in hardware, firmware, or as a computer code which may be recorded on a storage medium, or as original stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and to be stored in a local storage medium, so that the method described herein may be stored on such software process on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, a solid state disk or the like; further, the storage medium may also comprise a combination of memories of the kind described above. It will be appreciated that a computer, processor, microprocessor controller or programmable hardware includes a storage element that can store or receive software or computer code that, when accessed and executed by the computer, processor or hardware, implements the methods illustrated by the above embodiments.
Although embodiments of the present invention have been described in connection with the accompanying drawings, various modifications and variations may be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope of the invention as defined by the appended claims.

Claims (10)

1. A method of flow distribution, the method comprising:
obtaining a container creation request, wherein the container creation request comprises the target number of containers to be created;
inquiring the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request;
screening target nodes from all nodes in the container cloud according to the residual resources of each node;
determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level;
and when the number of containers contained in the target nodes is determined to meet the target number, carrying out flow distribution on the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node.
2. The method of claim 1, wherein the remaining resources comprise utilization of a central processor, and wherein the screening the target nodes from all nodes in the container cloud based on the remaining resources of each of the nodes comprises:
and when the utilization rate of the central processing unit of the first node is smaller than or equal to a preset threshold value, determining the first node as a target node, wherein the first node is any node in the container cloud.
3. The method according to claim 1 or 2, wherein when it is determined that the number of containers contained by the target node does not meet the target number, the method further comprises:
when the number of containers is larger than the target number, expelling the containers larger than the target number, so that the number of containers of the target node is equal to the target number,
or,
and when the number of the containers is smaller than the target number, newly building containers at the target node, so that the number of the containers of the target node is equal to the target number.
4. The method according to claim 1 or 2, wherein the traffic distribution level comprises at least one, and wherein said allocating traffic to the container of the target node according to the target number, the traffic distribution level of each of the target nodes, and the architecture type of each of the target nodes comprises:
Selecting a target level from all flow distribution levels;
determining the number of target nodes belonging to a first architecture type in the target level, wherein the first architecture type is any one of architecture types of the target nodes corresponding to the target level;
determining the flow distribution proportion of the first architecture type in a first flow distribution level according to the target number and the target node number of the first architecture type;
distributing the flow to be distributed to the target nodes corresponding to the target levels respectively according to the flow distribution proportion corresponding to each architecture type in the target levels respectively;
when the flow to be allocated still has the allowance, selecting the next flow allocation level from the flow allocation levels, and allocating the allowance by utilizing the target node corresponding to the next flow allocation level until all the flows are allocated.
5. The method of claim 4, wherein selecting a target level from all traffic distribution levels comprises:
and selecting the flow distribution grade with the highest priority among the flow distribution grades as the target grade.
6. The method according to claim 4, wherein the determining the traffic distribution ratio of the first architecture type in the first traffic distribution level according to the target number and the target number of nodes of the first architecture type is specifically determined by the following formula:
L 1 =N pod *N node1 *m1
wherein L is 1 Allocating proportions, N, for traffic of the first architecture type pod For the target number N node1 And m1 is the preset weight of the first architecture type for the number of target nodes of the first architecture type.
7. The method of any one of claims 1 to 3 or 5 to 6, wherein after each of the target nodes creates the target number of containers, the method further comprises:
monitoring the status of each of the containers in the target node;
when the state of the first container is determined to be abnormal, the first container is evicted from the target nodes, and the containers of the target nodes are subjected to flow distribution again according to the number of the remaining containers of each target node, the flow distribution level of each target node and the architecture type of each target node, wherein the first container is any container in the target nodes.
8. A flow distribution device, the device comprising:
the device comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a container creation request, and the container creation request comprises the target number of containers to be created;
the query module is used for querying the residual resources of all nodes in the container cloud and the architecture type of each node according to the container creation request;
the screening module is used for screening target nodes from all nodes in the container cloud according to the residual resources of each node;
the determining module is used for determining the flow distribution level of each target node according to the residual resources of each target node and the mapping relation between the residual resources and the flow distribution level;
and the distribution module is used for distributing the flow of the containers of the target nodes according to the target number, the flow distribution grade of each target node and the architecture type of each target node when the number of the containers contained in the target nodes is determined to meet the target number.
9. A computer device, comprising:
a memory and a processor, the memory and the processor being communicatively connected to each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the flow distribution method of any of claims 1 to 7.
10. A computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the flow distribution method of any of claims 1 to 7.
CN202310905071.5A 2023-07-21 2023-07-21 Traffic distribution method, traffic distribution device, computer equipment and storage medium Pending CN116708303A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310905071.5A CN116708303A (en) 2023-07-21 2023-07-21 Traffic distribution method, traffic distribution device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310905071.5A CN116708303A (en) 2023-07-21 2023-07-21 Traffic distribution method, traffic distribution device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116708303A true CN116708303A (en) 2023-09-05

Family

ID=87843559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310905071.5A Pending CN116708303A (en) 2023-07-21 2023-07-21 Traffic distribution method, traffic distribution device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116708303A (en)

Similar Documents

Publication Publication Date Title
US10623481B2 (en) Balancing resources in distributed computing environments
US8122453B2 (en) Method and system for managing resources in a data center
US7308687B2 (en) Method and system for managing resources in a data center
EP3335120B1 (en) Method and system for resource scheduling
US20190163517A1 (en) Predictive rightsizing for virtual machines in cloud computing systems
US7890712B2 (en) Method, apparatus and program product for managing memory in a virtual computing system
US20170031622A1 (en) Methods for allocating storage cluster hardware resources and devices thereof
US9466036B1 (en) Automated reconfiguration of shared network resources
CN105049268A (en) Distributed computing resource allocation system and task processing method
CN108776934A (en) Distributed data computational methods, device, computer equipment and readable storage medium storing program for executing
CN107851039A (en) System and method for resource management
CN103607424B (en) Server connection method and server system
CN110221920B (en) Deployment method, device, storage medium and system
CN111930493A (en) NodeManager state management method and device in cluster and computing equipment
US20230275849A1 (en) Intelligent allocation of resources in a computing system
US20200272526A1 (en) Methods and systems for automated scaling of computing clusters
CN112860387A (en) Distributed task scheduling method and device, computer equipment and storage medium
CN116467082A (en) Big data-based resource allocation method and system
CN106686081B (en) Resource allocation method and device for database service system
US20140282581A1 (en) Method and apparatus for providing a component block architecture
CN109257256A (en) Apparatus monitoring method, device, computer equipment and storage medium
CN116962532A (en) Cluster task scheduling method and device, computer equipment and storage medium
CN113301087A (en) Resource scheduling method, device, computing equipment and medium
CN109962941B (en) Communication method, device and server
CN116708303A (en) Traffic distribution method, traffic distribution device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination