[go: up one dir, main page]

CN111666131B - Load balancing distribution method, device, computer equipment and storage medium - Google Patents

Load balancing distribution method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111666131B
CN111666131B CN202010631600.3A CN202010631600A CN111666131B CN 111666131 B CN111666131 B CN 111666131B CN 202010631600 A CN202010631600 A CN 202010631600A CN 111666131 B CN111666131 B CN 111666131B
Authority
CN
China
Prior art keywords
usage information
host machine
load balancing
running
container group
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.)
Active
Application number
CN202010631600.3A
Other languages
Chinese (zh)
Other versions
CN111666131A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010631600.3A priority Critical patent/CN111666131B/en
Publication of CN111666131A publication Critical patent/CN111666131A/en
Application granted granted Critical
Publication of CN111666131B publication Critical patent/CN111666131B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Multi Processors (AREA)

Abstract

本申请涉及一种负载均衡分配方法、装置、计算机设备和存储介质。该方法包括:针对对应于同一服务对象的多个容器组,分别获取上报的所述容器组所运行于的宿主机的资源使用信息;所述资源使用信息,是由运行于所述宿主机中的第一进程,从所述宿主机中采集并上报的;根据每个所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重;所述资源使用信息与所述负载均衡权重相关;按照所述负载均衡权重,将针对所述服务对象的访问请求向所述服务对象所对应的容器组进行分配。采用本方法能够提高负载均衡调度的准确性。

The present application relates to a load balancing distribution method, device, computer equipment and storage medium. The method includes: for multiple container groups corresponding to the same service object, respectively obtaining the reported resource usage information of the host machine on which the container group runs; the resource usage information is collected and reported from the host machine by the first process running in the host machine; according to the resource usage information of each host machine, determining the load balancing weight of the container group running in the host machine; the resource usage information is related to the load balancing weight; according to the load balancing weight, the access request for the service object is allocated to the container group corresponding to the service object. The use of this method can improve the accuracy of load balancing scheduling.

Description

Load balancing distribution method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for load balancing and distributing, a computer device, and a storage medium.
Background
With the rapid development of science and technology, cloud technology has developed. In a cluster system such as a container cloud, requests are reasonably distributed to a container group in the container cloud through load balancing scheduling, and the cluster system belongs to an important application in cloud technology.
In the traditional method, a worker can preset the weight of each container group, and a load balancer can schedule the flow according to the preset weight. This conventional scheduling method according to preset weights has a problem that the real load is not known, so that the scheduling is not accurate enough.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a load balancing distribution method, apparatus, computer device, and storage medium that can improve accuracy.
A method of load balancing distribution, the method comprising:
The method comprises the steps of respectively acquiring resource use information of a host machine operated by a reported container group aiming at a plurality of container groups corresponding to the same service object, wherein the resource use information is acquired and reported from the host machine by a first process operated in the host machine;
determining the load balancing weight of a container group running in each host according to the resource use information of each host;
And distributing the access request aiming at the service object to the container group corresponding to the service object according to the load balancing weight.
A method of load balancing distribution, the method comprising:
the host collects the resource use information of the host according to the running first process;
The resource usage information is used for indicating the load balancer to determine the load balancing weight of the container group running on the host according to the resource usage information;
And receiving an access request which is distributed by the load balancer according to the load balancing weight and is aimed at a service object corresponding to the container group running on the host machine through the container group running on the host machine.
A load balancing distribution apparatus, the apparatus comprising:
The device comprises an acquisition module, a reporting module and a reporting module, wherein the acquisition module is used for respectively acquiring the reported resource use information of a host machine in which the container groups run aiming at a plurality of container groups corresponding to the same service object, wherein the resource use information is acquired and reported from the host machine by a first process running in the host machine;
The weight determining module is used for determining the load balancing weight of the container group running in the host according to the resource use information of each host;
And the request distribution module is used for distributing the access request aiming at the service object to the container group corresponding to the service object according to the load balancing weight.
In one embodiment, the obtaining module is further configured to obtain, for a plurality of container groups corresponding to the same service object, resource usage information of a host machine on which each of the container groups forwarded by the controller operates.
In one embodiment, the weight determining module is further configured to determine, according to the resource usage information of the host, a load balancing weight of a container group running in the host through a second process running in a load balancer, and modify, by the second process, an original load balancing weight of the container group recorded in a load balancing program running in the load balancer to the determined load balancing weight.
In one embodiment, the weight determining module is further configured to determine, for each host, a load balancing weight of a container group running in the host according to the resource usage information of the host and total resource usage information corresponding to the service object, where the total resource usage information is a sum of resource usage information of hosts running in the container groups corresponding to the service object.
In one embodiment, the weight determining module is further configured to determine, when the resource usage information includes CPU usage information and network bandwidth usage information, a first occupation ratio corresponding to the host according to the CPU usage information of the host, where the first occupation ratio is a ratio of the CPU usage information of the host to total CPU usage information corresponding to the service object, the total CPU usage information is a sum of CPU usage information of hosts operated by respective container groups corresponding to the service object, determine, according to the network bandwidth usage information of the host, a second occupation ratio corresponding to the host, where the second occupation ratio is a ratio of the network bandwidth usage information of the host to total network bandwidth usage information corresponding to the service object, where the total network bandwidth usage information is a sum of network bandwidth usage information of hosts operated by respective container groups corresponding to the service object, and determine, according to the first occupation ratio and the second occupation ratio, a load balancing among the container groups operated by the host.
In one embodiment, the weight determining module is further configured to, when the CPU usage information is an amount of idle CPU resources and the network bandwidth usage information is an amount of idle network bandwidth, take a minimum value for the first occupancy rate and the second occupancy rate, and obtain a load balancing weight of a container group running in the host.
In one embodiment, the weight determining module is further configured to divide the minimum value of the first occupancy rate and the second occupancy rate according to the number of the container groups running in the host machine when a plurality of container groups run in the host machine, and use the divided value as a load balancing weight of each container group running in the host machine.
A load balancing distribution apparatus, the apparatus comprising:
The acquisition module is used for acquiring the resource use information of the host according to the running first process;
The resource utilization information is used for indicating the load balancer to determine the load balancing weight of a container group running on the host according to the resource utilization information;
And the request receiving module is used for receiving the access request which is distributed by the load balancer according to the load balancing weight and is aimed at the service object corresponding to the container group running on the host machine through the container group running on the host machine.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the load balancing distribution method described in the embodiments of the application when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the load balancing distribution method described in the embodiments of the present application.
The method, the device, the computer equipment and the storage medium for load balancing distribution are used for respectively acquiring the reported resource usage information of a host machine operated by the container groups corresponding to the same service object, wherein the resource usage information is acquired and reported from the host machine by a first process operated in the host machine, the load balancing weight of the container groups operated in the host machine is determined according to the resource usage information of each host machine, the resource usage information is related to the load balancing weight, and the access request for the service object is distributed to the container groups corresponding to the service object according to the load balancing weight. The resource use information of the host can accurately represent the real load condition of the host, and further the load balancing weight of the container group can be dynamically determined more accurately according to the resource use information of the host, so that the load balancing distribution can be more accurately carried out based on the load balancing weight.
Drawings
FIG. 1 is an application environment diagram of a load balancing distribution method in one embodiment;
FIG. 2 is a flow chart of a load balancing distribution method in one embodiment;
FIG. 3 is a diagram of the relationship between a service object, a container group, and a host in one embodiment;
FIG. 4 is a block diagram of a load balancing distribution method in one embodiment;
FIG. 5 is a flow chart of a load balancing distribution method according to another embodiment;
FIG. 6 is a block diagram of a load balancing distribution system in one embodiment;
FIG. 7 is a block diagram of a load balancing distribution system in another embodiment;
FIG. 8 is a timing diagram of a load balancing distribution method in one embodiment;
FIG. 9 is a block diagram of a load balancing distribution apparatus in one embodiment;
FIG. 10 is a block diagram of a load balancing distribution apparatus according to another embodiment;
FIG. 11 is an internal block diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The load balancing distribution method provided by the application can be applied to an application environment shown in figure 1. Referring to fig. 1, the application scenario includes a terminal 110, a Service object (Service) 120, a load balancer (lb, loadBalance) 130, a container group (pod) 140, and a host 150, which are communicatively connected to each other. The container group 140 operates in a host machine 150. At least one container group 140 may be run in the same host 150. The same service object 120 corresponds to at least one container group 140. The service object 120 provides a unified fixed IP address as an entry address for the container group 140, and distributes the received access request to the corresponding container group 140 through the load balancer 130 according to the load balancing principle.
It is understood that a plurality of hosts 104 form a cluster, and that the hosts 104 act as nodes in the cluster. The clusters in the embodiments of the present application may be distributed clusters or non-distributed clusters, and the types of the clusters are not limited herein. Thus, the host 104 may be an independent physical server or virtual server, or may be a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, and basic cloud computing services such as big data and artificial intelligence platforms.
A first process may be executed in the host 150 to collect resource usage information for the host 150 from the host 150 and report the resource usage information to the load balancer 130. For each container group 140 corresponding to the same service object 120, the load balancer 130 may determine the load balancing weight of the container group 140 running in the host 150 according to the resource usage information of the host 150 on which the container groups 140 run, where the size of the resource usage rate represented by the resource usage information is inversely related to the size of the load balancing weight. The terminal 110 may initiate an access request to the service object 120, and the load balancer 130 may allocate the access request for the service object 120 to the container group 140 corresponding to the service object 120 according to the load balancing weight of the container group 140 corresponding to the accessed service object 120. Thus, the load balancing scheduling of the access request can be performed according to the resource use condition of the host.
It can be understood that the load balancing distribution method in the embodiment of the application is equivalent to using cloud technology to perform cloud computing processing.
Cloud technology (Cloud technology) refers to a hosting technology for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data.
Cloud technology (Cloud technology) is based on the general terms of network technology, information technology, integration technology, management platform technology, application technology and the like applied by Cloud computing business models, and can form a resource pool, so that the Cloud computing business model is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
Cloud computing (clouding) is a computing model that distributes computing tasks across a large pool of computers, enabling various application systems to acquire computing power, storage space, and information services as needed. The network that provides the resources is referred to as the "cloud". Resources in the cloud are infinitely expandable in the sense of users, and can be acquired at any time, used as needed, expanded at any time and paid for use as needed.
As a basic capability provider of cloud computing, a cloud computing resource pool (abbreviated as a cloud platform, generally referred to as IaaS (Infrastructure AS A SERVICE) platform) is established, in which multiple types of virtual resources are deployed for external clients to select for use.
According to the logic function division, a PaaS (Platform AS A SERVICE, platform service) layer can be deployed on an IaaS (Infrastructure AS A SERVICE, infrastructure service) layer, and a SaaS (Software AS A SERVICE, service) layer can be deployed above the PaaS layer, or the SaaS can be directly deployed on the IaaS. PaaS is a platform on which software runs, such as a database, web container, etc. SaaS is a wide variety of business software such as web portals, sms mass senders, etc. Generally, saaS and PaaS are upper layers relative to IaaS.
It can be understood that the container group in the embodiment of the present application is a combination of a plurality of containers in the container cloud. In the embodiments of the application, the load balancing distribution is performed through cloud computing, and the computing tasks are distributed on the container cloud formed by a large number of hosts, namely, the resource pool is provided by the container cloud, so that various application systems can acquire computing power, storage space and information service according to the needs.
In one embodiment, as shown in fig. 2, a load balancing distribution method is provided, and the method is applied to the load balancer 130 in fig. 1 for illustration, and includes the following steps:
Step 202, for a plurality of container groups corresponding to the same service object, acquiring the reported resource usage information of the host machine on which the container group operates.
Wherein the container group is a combination of a group of containers. Containers are a set of processes that are resource constrained and isolated from each other. It will be appreciated that the container contains a complete runtime environment.
The Service object, i.e. Service, is an object abstracted at the upper layer of the container group, and is used to provide a fixed IP address for the container group as an access interface for providing services to the outside.
It will be appreciated that the IP address to which the container group corresponds will change as soon as it is restarted. Therefore, the access request of the client is received by a service object with a fixed IP address, so that no influence is caused on the access of the client no matter how the IP address of the container group changes, namely, the access request received by the service object can be forwarded to the container group corresponding to the service object according to the mapping relation between the service object and the container group. Therefore, the container group corresponds to the target server corresponding to the service object. The target server is the object which finally and truly processes the access request.
The host is a computer for performing computation that needs to install virtual machine software. It will be appreciated that the container group is running in a host, and that the host provides computing power for the container group running thereon. The host may be a virtual machine or a physical machine. A plurality of hosts form a cluster. A cluster is a computer system that is connected by a set of integrated computer software and/or hardware to perform computing work in a highly close collaboration.
It is understood that a service object may correspond to at least one container group, one container group running on each host. One host may run at least one container group. Multiple container groups corresponding to the same service object may run on the same or different hosts. That is, the container groups running in the same host may be container groups corresponding to different service objects.
To facilitate an understanding of the relationship between the service objects, the container groups, and the hosts, an example will now be described in connection with the topology diagram of FIG. 3. Referring to fig. 3, service object a (i.e., serviceA) corresponds to container group 1 and container group 2 (i.e., container group 1 and container group 2 are target servers of service object a), service object B (i.e., serviceB) corresponds to container group 3 (i.e., container group 3 is a target server of service object B), and container group 2 and container group 3 run on the same host 2. I.e. the container groups running on the host 2 are the container groups corresponding to two different service objects, service object a and service object B, respectively. The container group 1 and the container group 2 corresponding to the same service object a run on two different hosts, namely the host 1 and the host 2.
And the resource use information is used for describing the resource use condition in the host. The resource use information is collected and reported from the host by a first process running in the host.
The first process is a process capable of collecting resource usage information of the host from the host.
In one embodiment, the first process may be a native process in the host, i.e., the native process in the host may be modified to have the function of collecting the resource usage information of the host. For example, the first process may be a proxy daemon in the host, i.e., a agent process. It will be appreciated that the first process may also be a non-native process that is newly added in the host.
In one embodiment, the resource usage information may be a resource usage rate, or may be specific usage information of a resource for characterizing the resource usage rate. In one embodiment, the resources may include at least one of CPU, network bandwidth, disk, and memory. Accordingly, the resource usage information may include at least one of CPU usage information, network bandwidth usage information, disk usage information, and memory usage information.
Specifically, each host machine can run a first process, and the first process can collect the resource usage information of the host machine from the host machine in which each host machine runs and report the collected resource usage information. When the load balancer needs to determine the liability balance weight of each container group corresponding to the same service object, the load balancer can acquire the resource use information of the host machine operated by each container group of the same service object from the reported resource use information of each host machine.
It can be understood that the resource usage information may be directly reported by the host, or may be reported by the host to a third party, and forwarded by the third party to the load balancer. That is, the host may directly report the collected resource usage information of the host to the load balancer through the first process, or may report the resource usage information of the host to the third party device, and the third party device forwards the resource usage information to the load balancer.
Step 204, determining the load balancing weight of the container group running in the host according to the resource usage information of each host.
Wherein the resource usage information is related to the load balancing weights.
The resource usage information can characterize the size of the resource usage of the host. In one embodiment, the resource usage information may be the resource usage itself. In another embodiment, the resource usage information may also be information characterizing the size of the resource usage, i.e. information reflecting the resource usage.
In one embodiment, the size of the resource usage characterized by the resource usage information is inversely related to the load balancing weight size.
When the resource usage information characterizes the greater the resource usage of the host, it indicates that the host is able to use less remaining resources, and the less load balancing weight of the container group running in the host. On the contrary, when the resource usage information characterizes the smaller resource usage rate of the host, it indicates that the host can use more residual resources, and the load balancing weight of the container group running in the host is larger.
It will be appreciated that the determination in step 204 is that the load balancing weights of the group of containers running in the host and corresponding to the service object.
And 206, distributing the access request aiming at the service object to the container group corresponding to the service object according to the load balancing weight.
Specifically, the terminal may send an access request to a service object, and the load balancer may allocate the access request for the service object to the container group corresponding to the service object according to the load balancing weight of the container group corresponding to the accessed service object, that is, implement load balancing scheduling.
The access request of the client or the terminal is first sent to the service object. And the load balancer forwards the access request received to the service object to the container group corresponding to the service object according to the load balancing weight of the container group corresponding to the service object. It will be appreciated that when a service object is for only one container group, then the access request received by the service object is forwarded to the unique corresponding container group. When the service object corresponds to a plurality of container groups, the access request received by the service object can be forwarded to the container group corresponding to the service object according to the load balancing weight of the container group corresponding to the service object.
An example will now be given by way of example in fig. 3. If a large number of requests access to the service object B, the container group 3 corresponding to the service object B is accessed, so that the load of the host 2 is increased, and the processing capacity of the container group 2 of the service object a on the host 2 is reduced. In the conventional method, the load balancer cannot sense this point, or sends the access request received by the service object a to the container group 2 according to the statically configured scheduling algorithm. This results in a decrease in the service efficiency of the service object a as a whole. According to the scheme of the application, the load balancer can obtain the resource usage information of the hosts 1 and 2 corresponding to the service object A, and determine that the load of the host 2 is heavy, so that the processing capacity of the container group 2 running on the host 2 can be perceived to slide down, and further, less load balancing weight is dynamically allocated to the container group 2, and more load balancing weight is dynamically allocated to the container group 1. Furthermore, the access requests for the service object a can be dynamically allocated to the container group 1 and the container group 2 according to the load balancing weights of the corresponding container groups (the container group 1 and the container group 2) of the service object a, so that more access requests can be transferred to the container group 1, and the service efficiency of the service object a as a whole is improved.
The load balancing distribution method comprises the steps of respectively obtaining reported resource usage information of a host machine operated by a container group corresponding to the same service object, collecting and reporting the resource usage information from the host machine by a first process operated in the host machine, determining load balancing weights of the container groups operated in the host machine according to the resource usage information of each host machine, wherein the resource usage information is related to the load balancing weights, and distributing access requests for the service object to the container groups corresponding to the service object according to the load balancing weights. The real load condition of the host can be accurately represented by the resource use information of the host, and then the load balancing weight of the container group can be more accurately and dynamically determined according to the resource use information of the host, so that the load balancing distribution can be more accurately performed based on the dynamically determined load balancing weight. In addition, practical tests show that when the host machine has unbalanced load, the method in the embodiments of the application greatly improves the responsiveness of the service object, and the resource cost used by the method in the embodiments of the application is very low.
In one embodiment, respectively acquiring the resource usage information of the host machine where the reported container groups are operated for a plurality of container groups corresponding to the same service object comprises acquiring the resource usage information of the host machine where each container group forwarded by the controller is operated for a plurality of container groups corresponding to the same service object.
The resource use information forwarded by the controller is collected from the host machine and reported to the controller by a first process running in the host machine.
Wherein the controller is a model that controls the resource to achieve the "desired" transition. And the controller is equivalent to a state machine and is used for controlling the specific state and behavior of the container group.
Specifically, the host machine can collect the resource usage information of the host machine through a first process running on the host machine, and report the resource usage information to the controller through the first process. The controller may forward the reported resource usage information to the load balancer.
For ease of understanding, an example will now be described in connection with the architecture diagram of fig. 4. Referring to fig. 4, a container group 1 and a container group 2 are respectively operated on a host 1 and a host 2. The host 1 and the host 2 respectively run a agent daemon (i.e. a first process) to collect respective resource usage (i.e. belonging to resource usage information), and report the collected resource usage to the controller, which can notify the load balancer lb of the reported resource usage. The load balancer runs a weight setting process weight-setter (i.e., a second process) and a load balancing program (e.g., linux IPVS, i.e., a load balancing software program of the Linux system). The load balancer can determine the load balancing weight of the container groups running in each host machine according to the reported resource utilization rate of the host machine through a weight setting process, and the original load balancing weight of each container group recorded in the load balancing program is modified into the determined load balancing weight through the weight setting process. Subsequently, after the service object receives the access request, the load balancer may allocate the access request for the service object to the service object according to the modified load balancing weight of each container group corresponding to the service object.
In the above embodiment, the host machine reports the resource usage information of the host machine to the controller through the first process, and then the resource usage information is forwarded to the load balancer by the controller, so that the resource usage information of the host machine can be reported under the original framework only by adding the first process, which is very convenient and fast, and unnecessary cost caused by excessive modification is avoided.
In one embodiment, step 204 of determining the load balancing weights of the container groups running in the hosts according to the resource usage information of each host includes determining the load balancing weights of the container groups running in the hosts according to the resource usage information of the hosts through a second process running in a load balancer, and modifying the original load balancing weights of the container groups recorded in a load balancing program running in the load balancer to the determined load balancing weights through the second process.
The second process is a process running in the load balancer and used for setting load balancing weights. I.e. may be referred to as a weight setting process. The load balancing program is a software program running in the load balancer and having the load balancing weights of the container groups recorded therein. It will be appreciated that the load balancing program may implement the load balancing distribution process according to the recorded load balancing weights.
Specifically, the load balancer can determine the load balancing weight of the container group running in the host according to the reported resource usage information of the host through the second process running in the load balancer. The load balancer may modify the original load balancing weights of the container group running in the load balancing program of the load balancer into the load balancing weights determined in step 204 through the second process, so as to dynamically modify the load balancing weights of the set container group. Thus, the dynamically modified load balancing weights are recorded in the load balancing program. The load balancer can dynamically allocate the access request aiming at the service object to the container group corresponding to the service object according to the dynamically modified load balancing weight recorded in the load balancing program.
In the above embodiment, by setting the second process in the load balancer, the load balancing weight of the container group in the host can be dynamically determined and modified according to the resource usage information of the host, which is very convenient, and avoids changing the original framework, thereby avoiding cost waste.
In one embodiment, step 204 of determining the load balancing weights of the container groups running in the hosts according to the resource usage information of each host includes determining, for each of the hosts, the load balancing weights of the container groups running in the hosts according to the resource usage information of the host and the total resource usage information corresponding to the service object.
The total resource usage information is the sum of the resource usage information of each host machine operated by each container group corresponding to the service object.
Specifically, when the load balancer needs to determine the load balancing weight of each container group of the same service object, each host machine on which each container group corresponding to the service object operates can be determined, and the total resource usage information corresponding to the service object is obtained according to the sum of the determined resource usage information of each host machine. For each host machine in which each container group corresponding to the service object operates, the load balancer can determine the load balancing weight of the container group operating in the host machine according to the resource usage information of the host machine and the total resource usage information corresponding to the service object.
For ease of understanding, an example will now be described in connection with fig. 3. Assuming that the access request received by the service object a needs to be subjected to load balancing allocation, the load balancing weights of the container group 1 and the container group 2 corresponding to the service object a need to be determined. The load balancer can acquire the resource usage information of the host 1 operated by the container group 1 and the resource usage information of the host 2 operated by the container group 2. The load balancer may determine total resource usage information corresponding to the service object a (i.e., the sum of the resource usage information corresponding to the hosts 1 and 2). The load balancer can determine the load balancing weight corresponding to the container group 1 on the host 1 according to the resource usage information of the host 1 and the total resource usage information corresponding to the service object a. Similarly, the load balancer may determine the load balancing weight corresponding to the container group 2 on the host 2 according to the resource usage information of the host 2 and the total resource usage information corresponding to the service object a.
In one embodiment, for each host, the load balancer may determine, through a second process, a load balancing weight of a container group running in the host according to the resource usage information of the host and total resource usage information corresponding to the service object. Further, the original load balancing weight of the container group recorded in the load balancing program running in the load balancing device is modified to be the determined load balancing weight through the second process.
In the above embodiment, according to the resource usage information of the host and the total resource usage information corresponding to the service object, the load balancing weight of the container group running in the host can be accurately and conveniently determined. Thereby improving the accuracy of subsequent load balancing distribution.
In one embodiment, determining the load balancing weight of the container group running in the host according to the resource usage information of the host and the total resource usage information corresponding to the service object includes determining a first occupation ratio corresponding to the host according to the CPU usage information of the host when the resource usage information includes the CPU usage information and the network bandwidth usage information, determining a second occupation ratio corresponding to the host according to the network bandwidth usage information of the host, and determining the load balancing weight of the container group running in the host according to the first occupation ratio and the second occupation ratio.
The first ratio is a ratio of CPU usage information of the host to total CPU usage information corresponding to the service object. That is, the first duty ratio is a CPU resource duty ratio. The total CPU usage information is the sum of CPU usage information of each host on which each container group corresponding to the service object operates.
The second ratio is a ratio of network bandwidth usage information of the host to total network bandwidth usage information corresponding to the service object. The second ratio is the network bandwidth ratio. The total network bandwidth usage information is the sum of the network bandwidth usage information of each host machine on which each container group corresponding to the service object operates.
It is understood that CPU usage information characterizes the amount of resources that the CPU is using. Accordingly, the CPU usage information may be an amount of CPU resources that are used (i.e., occupied) or an amount of CPU resources that are idle (i.e., spare, unused). Network bandwidth usage information characterizing the network bandwidth usage. Accordingly, the network bandwidth usage information may be the amount of network bandwidth that is used or the amount of network bandwidth that is idle.
In one embodiment, the data structure of the resource usage information of the host (i.e., the fabric node_cfg) may be as follows:
the structure indicates that, for a container group (pod) corresponding to a service object (service), the redundant cpu hertz and network bandwidth of the host (i.e., node) on which the container group operates are acquired, and resource usage information of the host is obtained.
In one embodiment, determining the load balancing weight for the group of containers running in the host based on the first and second occupancy rates includes minimizing the first and second occupancy rates to obtain the load balancing weight for the group of containers running in the host when the CPU usage information is an amount of idle CPU resources and the network bandwidth usage information is an amount of idle network bandwidth.
It will be appreciated that the load balancer may directly take the minimum as the load balancing weight for the set of containers running in the host. The minimum value may be further subjected to a numerical conversion process (e.g., linear conversion) to obtain a load balancing weight of the container group running in the host.
In the above embodiment, since the usage conditions of either the CPU or the network bandwidth affect the load condition of the host, the load balancing weight is determined by selecting one with a smaller idle amount from the CPU idle condition and the network bandwidth idle condition, so that the accuracy can be improved.
In one embodiment, when only one container group is running in the host, then the minimum value taken may be used as the load balancing weight for that container group. When there are multiple container groups in the host, then the load balancing weights of the container groups running in the host may be further determined according to the minimum value.
In one embodiment, taking the minimum value of the first occupancy rate and the second occupancy rate to obtain the load balancing weight of the container group running in the host machine comprises taking the minimum value of the first occupancy rate and the second occupancy rate when a plurality of container groups run in the host machine, dividing the taken minimum value according to the number of the container groups running in the host machine, and taking the divided value as the load balancing weight of the container group running in the host machine.
It will be understood that "plurality" in various embodiments of the application means at least two.
In one embodiment, the load balancer may determine the number of container groups running in the host, divide the minimum value by equal amounts according to the number of container groups running in the host, and use the divided value as the load balancing weight of each container group running in the host.
For example, for the structure node_cfg of the resource usage information of each host, calculating the ratio of the number of idle CPU hertz (i.e., cpu_hz, the amount of idle CPU resources) to the total amount of idle CPU resources (i.e., the sum of the amounts of idle CPU resources node cpu_hz of the respective hosts) of all the hosts corresponding to the service object (service), to obtain the first occupation ratio cpu_ratio. And calculating the ratio of the idle network bandwidth amount (i.e. net_pps) to the idle total network bandwidth amount (i.e. the sum of the idle network bandwidth amounts node net_pps of the respective hosts) of all the hosts corresponding to the service object (service), to obtain a second ratio net_ratio. Finally, taking min (cpu_ratio), namely the first occupation ratio and the second occupation ratio as minimum values, and taking the minimum values as load balancing weights of the container groups (pod) on the host. If N container groups (pod) are on the same host (node), then min (cpu_ratio)/N may be used as the load balancing weight of each container group on the host. That is, the minimum value is equally divided, and the divided value is used as the load balancing weight of each container group on the host machine.
In the embodiment, when a plurality of container groups are operated in the host, the minimum value is divided according to the number of the container groups operated in the host, and the divided value is used as the load balancing weight of the container groups operated in the host, so that each container group in the same host can be considered, and the accuracy of the load balancing weight of each container group is improved.
In one embodiment, determining the load balancing weight for the group of containers running in the host based on the first and second occupancy rates includes maximizing the first and second occupancy rates when the CPU usage information is an amount of occupied CPU resources and the network bandwidth usage information is an amount of occupied network bandwidth, and determining the load balancing weight for the group of containers running in the host based on the maximized values. The magnitude of the load balancing weight of the container group is inversely related to the magnitude of the maximum value. That is, the larger the maximum value taken, the larger the amount of occupied resources, the smaller the load balancing weight. The smaller the maximum value taken, the smaller the amount of occupied resources, and the larger the load balancing weight.
In other embodiments, the load balancer may also combine (e.g., linearly calculate) the first and second duty cycles to determine a new value as the load balancing weight for the set of containers running in the host.
In the above embodiment, the CPU usage information and the network bandwidth usage information can reflect the load condition of the host relatively accurately, so that the load balancing weight of the container group running in the host can be determined accurately according to the CPU usage duty ratio (i.e., the first duty ratio) and the network bandwidth usage duty ratio (i.e., the second duty ratio) of the host. Thereby improving the accuracy of subsequent load balancing distribution.
As shown in fig. 5, in one embodiment, a load balancing distribution method is provided, and the method is applied to the host 150 in fig. 1 for illustration. The method comprises the following steps:
Step 502, the host collects the resource usage information of the host according to the running first process.
And 504, reporting the resource use information to the load balancer, wherein the resource use information is used for indicating the load balancer to determine the load balancing weight of the container group running on the host machine according to the resource use information.
In step 506, the access request of the service object corresponding to the container group running on the host machine and distributed to the load balancer according to the load balancing weight is received through the container group running on the host machine.
In one embodiment, the first process is a native process running in the host's local end and used to gather the host's resource usage information. In other embodiments, the first process may also be a newly added non-native process.
In one embodiment, the resource usage information is used to instruct the load balancer to determine, according to the resource usage information, a load balancing weight of a container group running on the host through the second process, and modify an original load balancing weight of the container group running in a load balancing program of the load balancer to the determined load balancing weight. Wherein the second process is the process that is responsible for running in the equalizer and is used to determine and modify the load balancing weights.
In the above embodiment, the first process is run in the host to collect and report the resource usage information of the host, so that the real load condition of the host can be accurately represented, and further, according to the resource usage information of the host, the load balancing weight of the container group can be dynamically determined more accurately, so that the received access request can be more accurately distributed in a load balancing manner.
As shown in fig. 6, in one embodiment, a resource balanced allocation system 600 is provided, the system 600 comprising a host 602, a set of containers 604 running in the host 602, and a load balancer 606, wherein:
The host 602 is configured to collect resource usage information of the host according to a first process, and report the resource usage information to the load balancer 606.
The load balancer 606 is configured to determine, for a plurality of container groups 604 corresponding to the same service object, a load balancing weight of the container group 604 running in the host 602 according to resource usage information of the host 602 in which each container group 604 runs, where the resource usage information is related to the load balancing weight.
The load balancer 606 is further configured to distribute, according to the load balancing weight, an access request for the service object to the container group 602 corresponding to the service object.
As shown in fig. 7, in one embodiment, the system further includes a controller 605.
The host 604 is further configured to collect resource usage information of the host according to the first process, and report the resource usage information to the controller 605.
The controller 605 is also configured to forward the resource usage information to the load balancer.
In one embodiment, the load balancer 606 has a second process and a load balancing program running therein, wherein the load balancing program has the original load balancing weights of the container group recorded therein;
The load balancer 606 is further configured to determine, according to resource usage information of a host machine in which each container group is running, a load balancing weight of the container group running in the host machine for a plurality of container groups corresponding to the same service object through the second process, and modify, through the second process, the original load balancing weight recorded in the load balancing program to the determined load balancing weight.
In one embodiment, the load balancer 606 is further configured to determine, for each host, a load balancing weight of a container group running in the host according to the resource usage information of the host and total resource usage information corresponding to the service object, where the total resource usage information is a sum of resource usage information of hosts running in the container groups corresponding to the service object.
In one embodiment, the load balancer 606 is further configured to determine, when the resource usage information includes CPU usage information and network bandwidth usage information, a first occupation ratio corresponding to the host according to the CPU usage information of the host, where the first occupation ratio is a ratio of the CPU usage information of the host to total CPU usage information corresponding to the service object, the total CPU usage information is a sum of CPU usage information of hosts operated by container groups corresponding to the service object, determine, according to the network bandwidth usage information of the host, a second occupation ratio corresponding to the host, where the second occupation ratio is a ratio of network bandwidth usage information of the host to total network bandwidth usage information corresponding to the service object, where the total network bandwidth usage information is a sum of network bandwidth usage information of hosts operated by container groups corresponding to the service object, and determine, according to the first occupation ratio and the second occupation ratio, a load balance among the container groups operated by the host.
In one embodiment, the load balancer 606 is further configured to, when the CPU usage information is an amount of idle CPU resources and the network bandwidth usage information is an amount of idle network bandwidth, take a minimum value for the first occupancy rate and the second occupancy rate, and obtain a load balancing weight of a container group running in the host.
In one embodiment, the load balancer 606 is further configured to divide the minimum value of the first duty ratio and the second duty ratio according to the number of the container groups running in the host machine when a plurality of container groups run in the host machine, and use the divided value as a load balancing weight of each container group running in the host machine.
Fig. 8 is a timing diagram of a load balancing distribution method in one embodiment. The method specifically comprises the following steps:
(1) The host reports the idle CPU resource amount and the idle network bandwidth amount of the host to the controller through the proxy daemon.
(2) The controller informs the load balancer of the reported amount of idle CPU resources and the amount of idle network bandwidth.
(3) For a plurality of container groups corresponding to the same service object, the load balancer can acquire the idle CPU resource amount and the idle network bandwidth amount of the host machine where each container group operates according to the reporting condition.
(4) For each host, the load balancer can obtain a first occupation ratio corresponding to the host according to the ratio of the idle CPU resource amount of the host to the idle CPU total resource amount corresponding to the service object through a weight setting process.
(5) The load balancer can obtain a second occupation ratio corresponding to the host machine according to the ratio of the idle network bandwidth use information of the host machine to the total idle network bandwidth corresponding to the service object through a weight setting process.
(6) When only one container group is operated in the host, the load balancer can take the minimum value for the first occupation ratio and the second occupation ratio to obtain the load balancing weight of the container group.
(7) When a plurality of container groups are operated in the host, the load balancer can divide the minimum value in the first occupation ratio and the second occupation ratio according to the number of the container groups operated in the host, and load balancing weights of the container groups are obtained.
(8) The load balancer may distribute the access request for the service object to the container group corresponding to the service object according to the load balancing weight of each container group.
As shown in fig. 9, in one embodiment, a load balancing distribution apparatus is provided, disposed in a load balancer. The device comprises an acquisition module 902, a weight determination module 904 and a request distribution module 906, wherein:
The obtaining module 902 is configured to obtain, for a plurality of container groups corresponding to the same service object, resource usage information of a host machine on which the reported container groups run, where the resource usage information is collected and reported from the host machine by a first process running in the host machine.
The weight determining module 904 is configured to determine a load balancing weight of a container group running in the host according to the resource usage information of each host, where the resource usage information is related to the load balancing weight.
And a request allocation module 906, configured to allocate, according to the load balancing weight, an access request for the service object to a container group corresponding to the service object.
In one embodiment, the obtaining module 902 is further configured to obtain, for a plurality of container groups corresponding to the same service object, resource usage information of a host machine on which each of the container groups forwarded by the controller operates.
In one embodiment, the weight determining module 904 is further configured to determine, according to the resource usage information of the host, a load balancing weight of a container group running in the host through a second process running in a load balancer, and modify, by the second process, an original load balancing weight of the container group recorded in a load balancing program running in the load balancer to the determined load balancing weight.
In one embodiment, the weight determining module 904 is further configured to determine, for each host, a load balancing weight of a container group running in the host according to the resource usage information of the host and total resource usage information corresponding to the service object, where the total resource usage information is a sum of resource usage information of hosts running in the container groups corresponding to the service object.
In one embodiment, the weight determining module 904 is further configured to determine, when the resource usage information includes CPU usage information and network bandwidth usage information, a first occupation ratio corresponding to the host according to the CPU usage information of the host, where the first occupation ratio is a ratio of the CPU usage information of the host to total CPU usage information corresponding to the service object, the total CPU usage information is a sum of CPU usage information of hosts operated by respective container groups corresponding to the service object, determine, according to the network bandwidth usage information of the host, a second occupation ratio corresponding to the host, where the second occupation ratio is a ratio of the network bandwidth usage information of the host to total network bandwidth usage information corresponding to the service object, where the total network bandwidth usage information is a sum of network bandwidth usage information of hosts operated by respective container groups corresponding to the service object, and determine, according to the first occupation ratio and the second occupation ratio, a load balance among the container groups operated by the host.
In one embodiment, the weight determining module 904 is further configured to, when the CPU usage information is an amount of idle CPU resources and the network bandwidth usage information is an amount of idle network bandwidth, take a minimum value for the first occupancy rate and the second occupancy rate, and obtain a load balancing weight of a container group running in the host.
In one embodiment, the weight determining module 904 is further configured to divide the minimum value of the first occupancy rate and the second occupancy rate according to the number of the container groups running in the host machine when a plurality of container groups run in the host machine, and use the divided value as a load balancing weight of each of the container groups running in the host machine.
As shown in fig. 10, in one embodiment, a load balancing and distributing apparatus is provided, for example, disposed in a host, where the load balancing and distributing apparatus includes an acquisition module 1002, a reporting module 1004, and a request receiving module 1006, where:
and the collection module 1002 is configured to collect, according to the running first process, resource usage information of the host.
And the resource usage information is used for indicating the load balancer to determine the load balancing weight of the container group running on the host according to the resource usage information.
The request receiving module 1006 is configured to receive, through a container group running on a host, an access request, which is allocated by the load balancer according to the load balancing weight and is directed to a service object corresponding to the container group running on the host.
For specific limitations of the load balancing and distributing device, reference may be made to the above limitation of the load balancing and distributing method, and no further description is given here. The modules in the load balancing and distributing device can be realized in whole or in part by software, hardware and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a load balancer or a host, the internal structure of which may be as shown in fig. 11. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing search data. The network interface of the computer device is used for communicating with an external computer device through a network connection. The computer program, when executed by a processor, implements a load balancing distribution method. It will be appreciated that the server implements the background processing steps in the load balancing distribution method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 11 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-described method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (20)

1.一种负载均衡分配方法,其特征在于,由负载均衡器执行,所述方法包括:1. A load balancing distribution method, characterized in that it is performed by a load balancer, and the method comprises: 针对对应于同一服务对象的多个容器组,分别获取上报的所述容器组所运行于的宿主机的资源使用信息;所述资源使用信息,是由运行于所述宿主机中的第一进程,从所述宿主机中采集并上报的;For multiple container groups corresponding to the same service object, respectively obtain reported resource usage information of the host machine on which the container group runs; the resource usage information is collected and reported from the host machine by a first process running in the host machine; 根据每个所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重;Determining a load balancing weight of a container group running in the host machine according to the resource usage information of each of the host machines; 按照所述负载均衡权重,将针对所述服务对象的访问请求向所述服务对象所对应的容器组进行分配;Allocating access requests for the service object to the container group corresponding to the service object according to the load balancing weight; 所述根据每个所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重,包括:The step of determining the load balancing weight of the container group running in the host machine according to the resource usage information of each host machine includes: 针对每个所述宿主机,当所述资源使用信息包括CPU使用信息和网络带宽使用信息时,根据所述宿主机的所述CPU使用信息,确定所述宿主机所对应的第一占比率;For each of the host machines, when the resource usage information includes CPU usage information and network bandwidth usage information, determining a first percentage corresponding to the host machine according to the CPU usage information of the host machine; 根据所述宿主机的所述网络带宽使用信息,确定所述宿主机所对应的第二占比率;Determining a second proportion corresponding to the host machine according to the network bandwidth usage information of the host machine; 根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重。A load balancing weight of the container group running in the host machine is determined according to the first proportion and the second proportion. 2.根据权利要求1所述的方法,其特征在于,所述针对对应于同一服务对象的多个容器组,分别获取上报的所述容器组所运行于的宿主机的资源使用信息包括:2. The method according to claim 1, wherein for multiple container groups corresponding to the same service object, respectively obtaining the reported resource usage information of the host machines on which the container groups are running comprises: 针对对应于同一服务对象的多个容器组,获取控制器转发的所述容器组所运行于的宿主机的资源使用信息。For multiple container groups corresponding to the same service object, resource usage information of the host machine on which the container group runs, forwarded by the controller, is obtained. 3.根据权利要求1所述的方法,其特征在于,所述根据每个所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重包括:3. The method according to claim 1, wherein determining the load balancing weight of the container group running in the host machine according to the resource usage information of each host machine comprises: 通过运行于所述负载均衡器的第二进程,根据所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重;Determining, by a second process running on the load balancer, a load balancing weight of a container group running on the host machine according to the resource usage information of the host machine; 通过所述第二进程,将运行于负载均衡器的负载均衡程序中记录的所述容器组的原始负载均衡权重,修改为所确定的所述负载均衡权重。Through the second process, the original load balancing weight of the container group recorded in the load balancing program running on the load balancer is modified to the determined load balancing weight. 4.根据权利要求1所述的方法,其特征在于,所述第一占比率,是所述宿主机的CPU使用信息与所述服务对象对应的总CPU使用信息的比值;所述总CPU使用信息,是与所述服务对象对应的各容器组所运行于的各宿主机的CPU使用信息的总和;所述第二占比率,是所述宿主机的网络带宽使用信息与所述服务对象对应的总网络带宽使用信息的比值;所述总网络带宽使用信息,是与所述服务对象对应的各容器组所运行于的各宿主机的网络带宽使用信息的总和。4. The method according to claim 1 is characterized in that the first proportion is a ratio of the CPU usage information of the host machine to the total CPU usage information corresponding to the service object; the total CPU usage information is the sum of the CPU usage information of each host machine on which each container group corresponding to the service object runs; the second proportion is a ratio of the network bandwidth usage information of the host machine to the total network bandwidth usage information corresponding to the service object; the total network bandwidth usage information is the sum of the network bandwidth usage information of each host machine on which each container group corresponding to the service object runs. 5.根据权利要求4所述的方法,其特征在于,所述根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重包括:5. The method according to claim 4, wherein determining the load balancing weight of the container group running in the host machine according to the first proportion and the second proportion comprises: 当所述CPU使用信息为空闲的CPU资源量、且所述网络带宽使用信息为空闲的网络带宽量时,对所述第一占比率和所述第二占比率取最小值,得到运行于所述宿主机中的容器组的负载均衡权重。When the CPU usage information is the amount of idle CPU resources, and the network bandwidth usage information is the amount of idle network bandwidth, a minimum value of the first proportion and the second proportion is taken to obtain a load balancing weight of the container group running in the host machine. 6.根据权利要求5所述的方法,其特征在于,所述对所述第一占比率和所述第二占比率取最小值,得到运行于所述宿主机中的容器组的负载均衡权重包括:6. The method according to claim 5, characterized in that the step of taking the minimum value of the first proportion and the second proportion to obtain the load balancing weight of the container group running in the host machine comprises: 当所述宿主机中运行有多个容器组时,则将对所述第一占比率和所述第二占比率取的最小值,按照运行于所述宿主机中的容器组的数量进行划分;When multiple container groups are running in the host machine, the minimum value of the first proportion and the second proportion is divided according to the number of container groups running in the host machine; 将划分后的数值,作为运行于所述宿主机中的各所述容器组的负载均衡权重。The divided value is used as the load balancing weight of each container group running in the host machine. 7.一种负载均衡分配方法,其特征在于,所述方法包括:7. A load balancing distribution method, characterized in that the method comprises: 宿主机根据运行的第一进程,采集所述宿主机的资源使用信息;The host machine collects resource usage information of the host machine according to the running first process; 上报所述资源使用信息至负载均衡器;所述资源使用信息,用于指示所述负载均衡器在所述资源使用信息包括CPU使用信息和网络带宽使用信息时,根据所述宿主机的所述CPU使用信息,确定所述宿主机所对应的第一占比率;根据所述宿主机的所述网络带宽使用信息,确定所述宿主机所对应的第二占比率;根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重;Reporting the resource usage information to the load balancer; the resource usage information is used to instruct the load balancer to determine a first proportion corresponding to the host machine according to the CPU usage information of the host machine when the resource usage information includes CPU usage information and network bandwidth usage information; determine a second proportion corresponding to the host machine according to the network bandwidth usage information of the host machine; determine a load balancing weight of a container group running in the host machine according to the first proportion and the second proportion; 通过运行于所述宿主机的容器组,接收所述负载均衡器按照所述负载均衡权重分配至的、且针对运行于所述宿主机的所述容器组所对应的服务对象的访问请求。An access request for a service object corresponding to the container group running on the host machine and allocated by the load balancer according to the load balancing weight is received through the container group running on the host machine. 8.一种资源均衡分配系统,其特征在于,所述系统包括宿主机、运行于所述宿主机中的容器组和负载均衡器;8. A resource balancing allocation system, characterized in that the system includes a host machine, a container group running in the host machine, and a load balancer; 所述宿主机,用于根据第一进程,采集所述宿主机的资源使用信息,并将所述资源使用信息上报至所述负载均衡器;The host machine is used to collect resource usage information of the host machine according to the first process, and report the resource usage information to the load balancer; 所述负载均衡器,用于针对对应于同一服务对象的多个容器组,当所述资源使用信息包括CPU使用信息和网络带宽使用信息时,根据所述容器组所运行于的宿主机的所述CPU使用信息,确定所述容器组所运行于的宿主机所对应的第一占比率;根据所述容器组所运行于的宿主机的所述网络带宽使用信息,确定所述容器组所运行于的宿主机所对应的第二占比率;根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重;The load balancer is used for, for multiple container groups corresponding to the same service object, when the resource usage information includes CPU usage information and network bandwidth usage information, determining a first share corresponding to the host machine on which the container group is running according to the CPU usage information of the host machine on which the container group is running; determining a second share corresponding to the host machine on which the container group is running according to the network bandwidth usage information of the host machine on which the container group is running; and determining a load balancing weight of the container group running in the host machine according to the first share and the second share; 所述负载均衡器还用于按照所述负载均衡权重,将针对所述服务对象的访问请求向所述服务对象所对应的容器组进行分配。The load balancer is further configured to distribute the access request for the service object to the container group corresponding to the service object according to the load balancing weight. 9.根据权利要求8所述的系统,其特征在于,所述系统还包括控制器;9. The system according to claim 8, characterized in that the system further comprises a controller; 所述宿主机还用于根据第一进程,采集所述宿主机的资源使用信息,并将所述资源使用信息上报至所述控制器;The host machine is further used to collect resource usage information of the host machine according to the first process, and report the resource usage information to the controller; 所述控制器还用于将所述资源使用信息转发至所述负载均衡器。The controller is further configured to forward the resource usage information to the load balancer. 10.根据权利要求9所述的系统,其特征在于,所述负载均衡器中运行有第二进程和负载均衡程序;所述负载均衡程序中记录有容器组的原始负载均衡权重;10. The system according to claim 9, characterized in that a second process and a load balancing program are running in the load balancer; the load balancing program records the original load balancing weight of the container group; 所述负载均衡器还用于通过所述第二进程,针对对应于同一服务对象的多个容器组,根据所述容器组所运行于的宿主机的资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重;通过所述第二进程,将所述负载均衡程序中记录的所述原始负载均衡权重,修改为所确定的所述负载均衡权重。The load balancer is also used to determine, through the second process, for multiple container groups corresponding to the same service object, the load balancing weight of the container group running in the host machine based on resource usage information of the host machine on which the container group runs; and modify, through the second process, the original load balancing weight recorded in the load balancing program to the determined load balancing weight. 11.一种负载均衡分配装置,其特征在于,设置于负载均衡器中,所述装置包括:11. A load balancing distribution device, characterized in that it is arranged in a load balancer, and the device comprises: 获取模块,用于针对对应于同一服务对象的多个容器组,分别获取上报的所述容器组所运行于的宿主机的资源使用信息;所述资源使用信息,是由运行于所述宿主机中的第一进程,从所述宿主机中采集并上报的;an acquisition module, configured to respectively acquire, for a plurality of container groups corresponding to the same service object, resource usage information of a host machine on which the container groups are running, which is reported; the resource usage information is collected and reported from the host machine by a first process running in the host machine; 权重确定模块,用于针对每个所述宿主机,当所述资源使用信息包括CPU使用信息和网络带宽使用信息时,根据所述宿主机的所述CPU使用信息,确定所述宿主机所对应的第一占比率;根据所述宿主机的所述网络带宽使用信息,确定所述宿主机所对应的第二占比率;根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重;A weight determination module, for each of the host machines, when the resource usage information includes CPU usage information and network bandwidth usage information, determining a first proportion corresponding to the host machine according to the CPU usage information of the host machine; determining a second proportion corresponding to the host machine according to the network bandwidth usage information of the host machine; and determining a load balancing weight of a container group running in the host machine according to the first proportion and the second proportion; 请求分配模块,用于按照所述负载均衡权重,将针对所述服务对象的访问请求向所述服务对象所对应的容器组进行分配。The request allocation module is used to allocate the access request for the service object to the container group corresponding to the service object according to the load balancing weight. 12.根据权利要求11所述的装置,其特征在于,所述获取模块还用于针对对应于同一服务对象的多个容器组,获取控制器转发的所述容器组所运行于的宿主机的资源使用信息。12. The device according to claim 11 is characterized in that the acquisition module is also used to obtain, for multiple container groups corresponding to the same service object, resource usage information of the host machine on which the container group runs, forwarded by the controller. 13.根据权利要求11所述的装置,其特征在于,所述权重确定模块还用于通过运行于所述负载均衡器的第二进程,根据所述宿主机的所述资源使用信息,确定运行于所述宿主机中的容器组的负载均衡权重;通过所述第二进程,将运行于负载均衡器的负载均衡程序中记录的所述容器组的原始负载均衡权重,修改为所确定的所述负载均衡权重。13. The device according to claim 11 is characterized in that the weight determination module is also used to determine the load balancing weight of the container group running in the host machine according to the resource usage information of the host machine through a second process running on the load balancer; through the second process, the original load balancing weight of the container group recorded in the load balancing program running on the load balancer is modified to the determined load balancing weight. 14.根据权利要求11所述的装置,其特征在于,所述第一占比率,是所述宿主机的CPU使用信息与所述服务对象对应的总CPU使用信息的比值;所述总CPU使用信息,是与所述服务对象对应的各容器组所运行于的各宿主机的CPU使用信息的总和;所述第二占比率,是所述宿主机的网络带宽使用信息与所述服务对象对应的总网络带宽使用信息的比值;所述总网络带宽使用信息,是与所述服务对象对应的各容器组所运行于的各宿主机的网络带宽使用信息的总和。14. The device according to claim 11 is characterized in that the first proportion is a ratio of the CPU usage information of the host machine to the total CPU usage information corresponding to the service object; the total CPU usage information is the sum of the CPU usage information of the hosts on which the container groups corresponding to the service object run; the second proportion is a ratio of the network bandwidth usage information of the host machine to the total network bandwidth usage information corresponding to the service object; the total network bandwidth usage information is the sum of the network bandwidth usage information of the hosts on which the container groups corresponding to the service object run. 15.根据权利要求14所述的装置,其特征在于,所述权重确定模块还用于当所述CPU使用信息为空闲的CPU资源量、且所述网络带宽使用信息为空闲的网络带宽量时,对所述第一占比率和所述第二占比率取最小值,得到运行于所述宿主机中的容器组的负载均衡权重。15. The device according to claim 14 is characterized in that the weight determination module is also used to take the minimum value of the first proportion and the second proportion when the CPU usage information is the idle CPU resource amount and the network bandwidth usage information is the idle network bandwidth amount to obtain the load balancing weight of the container group running in the host machine. 16.根据权利要求15所述的装置,其特征在于,所述权重确定模块还用于当所述宿主机中运行有多个容器组时,则将对所述第一占比率和所述第二占比率取的最小值,按照运行于所述宿主机中的容器组的数量进行划分;将划分后的数值,作为运行于所述宿主机中的各所述容器组的负载均衡权重。16. The device according to claim 15 is characterized in that the weight determination module is also used to divide the minimum value of the first proportion and the second proportion according to the number of container groups running in the host machine when multiple container groups are running in the host machine; and use the divided value as the load balancing weight of each container group running in the host machine. 17.一种负载均衡分配装置,其特征在于,设置于宿主机中,所述装置包括:17. A load balancing distribution device, characterized in that it is arranged in a host machine, and the device comprises: 采集模块,用于宿主机根据运行的第一进程,采集所述宿主机的资源使用信息;A collection module, configured to collect resource usage information of the host machine according to the first process being run; 上报模块,用于上报所述资源使用信息至负载均衡器;所述资源使用信息,用于指示所述负载均衡器在所述资源使用信息包括CPU使用信息和网络带宽使用信息时,根据所述宿主机的所述CPU使用信息,确定所述宿主机所对应的第一占比率;根据所述宿主机的所述网络带宽使用信息,确定所述宿主机所对应的第二占比率;根据所述第一占比率和所述第二占比率,确定运行于所述宿主机中的容器组的负载均衡权重;A reporting module, configured to report the resource usage information to a load balancer; the resource usage information is configured to instruct the load balancer to determine, when the resource usage information includes CPU usage information and network bandwidth usage information, a first proportion corresponding to the host machine according to the CPU usage information of the host machine; determine a second proportion corresponding to the host machine according to the network bandwidth usage information of the host machine; and determine a load balancing weight of a container group running in the host machine according to the first proportion and the second proportion; 请求接收模块,用于通过运行于所述宿主机的容器组,接收所述负载均衡器按照所述负载均衡权重分配至的、且针对运行于所述宿主机的所述容器组所对应的服务对象的访问请求。The request receiving module is used to receive, through the container group running on the host machine, an access request to the service object corresponding to the container group running on the host machine and allocated by the load balancer according to the load balancing weight. 18.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至7中任一项所述的方法的步骤。18. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program. 19.一种计算机可读存储介质,存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。19. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented. 20.一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法的步骤。20. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
CN202010631600.3A 2020-07-03 2020-07-03 Load balancing distribution method, device, computer equipment and storage medium Active CN111666131B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010631600.3A CN111666131B (en) 2020-07-03 2020-07-03 Load balancing distribution method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010631600.3A CN111666131B (en) 2020-07-03 2020-07-03 Load balancing distribution method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111666131A CN111666131A (en) 2020-09-15
CN111666131B true CN111666131B (en) 2025-02-18

Family

ID=72390959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010631600.3A Active CN111666131B (en) 2020-07-03 2020-07-03 Load balancing distribution method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111666131B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202860B (en) * 2020-09-22 2023-07-14 广州品唯软件有限公司 A container flow adjustment method, device and system
CN112445774A (en) * 2020-11-20 2021-03-05 网宿科技股份有限公司 Distributed shared file system and data processing method thereof
CN113504996B (en) * 2021-07-28 2024-03-08 中国工商银行股份有限公司 Load balancing detection method, device, equipment and storage medium
CN114374696B (en) * 2021-12-15 2025-04-15 深圳前海微众银行股份有限公司 A container load balancing method, device, equipment and storage medium
CN114116774B (en) * 2022-01-28 2022-06-28 北京安帝科技有限公司 Log data query method and device
CN114520809A (en) * 2022-03-04 2022-05-20 浪潮云信息技术股份公司 Method and device for realizing load balancing of back-end request
CN116204286B (en) * 2022-12-21 2023-12-12 山东未来网络研究院(紫金山实验室工业互联网创新应用基地) Kubernetes scheduling method supporting topology awareness
CN118158222B (en) * 2024-05-11 2024-08-09 中移(苏州)软件技术有限公司 Load balancer deployment method, device, electronic equipment, storage medium and product
CN119829296B (en) * 2025-03-14 2025-06-03 深圳市图美电子技术有限公司 Load balancing method and system of integrative super fusion server of deposit and calculation

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790726A (en) * 2017-03-30 2017-05-31 电子科技大学 A kind of priority query's dynamic feedback of load equilibrium resource regulating method based on Docker cloud platforms
CN107888708A (en) * 2017-12-25 2018-04-06 山大地纬软件股份有限公司 A kind of load-balancing algorithm based on Docker container clusters

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10225335B2 (en) * 2011-02-09 2019-03-05 Cisco Technology, Inc. Apparatus, systems and methods for container based service deployment
US9071609B2 (en) * 2012-10-08 2015-06-30 Google Technology Holdings LLC Methods and apparatus for performing dynamic load balancing of processing resources
CN109587220B (en) * 2018-11-09 2021-09-10 金蝶软件(中国)有限公司 Load balancing method and device, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790726A (en) * 2017-03-30 2017-05-31 电子科技大学 A kind of priority query's dynamic feedback of load equilibrium resource regulating method based on Docker cloud platforms
CN107888708A (en) * 2017-12-25 2018-04-06 山大地纬软件股份有限公司 A kind of load-balancing algorithm based on Docker container clusters

Also Published As

Publication number Publication date
CN111666131A (en) 2020-09-15

Similar Documents

Publication Publication Date Title
CN111666131B (en) Load balancing distribution method, device, computer equipment and storage medium
US20220329651A1 (en) Apparatus for container orchestration in geographically distributed multi-cloud environment and method using the same
US11010188B1 (en) Simulated data object storage using on-demand computation of data objects
US10733029B2 (en) Movement of services across clusters
US10466899B2 (en) Selecting controllers based on affinity between access devices and storage segments
Chowdhury et al. Implementation and performance analysis of various VM placement strategies in CloudSim
CN107040479B (en) Method and device for adjusting cloud computing resources
CN111931949A (en) Communication in a federated learning environment
US20160316003A1 (en) Balancing resources in distributed computing environments
TW201818261A (en) Application capacity enlargement method, apparatus and system
CN108900626B (en) Data storage method, device and system in cloud environment
CN117149445B (en) Cross-cluster load balancing method and device, equipment and storage medium
CN111092921B (en) Data acquisition method, device and storage medium
CN103533063A (en) Method and device capable of realizing dynamic expansion of WEB (World Wide Web) application resource
CN109710406B (en) Data distribution and model training method and device thereof, and computing cluster
CN104092650A (en) Service distributing request method and device
El Karadawy et al. An empirical analysis on load balancing and service broker techniques using cloud analyst simulator
CN113377866B (en) Load balancing method and device for virtualized database proxy service
Shalu et al. Artificial neural network-based virtual machine allocation in cloud computing
Zhou et al. Goldilocks: Adaptive resource provisioning in containerized data centers
Mendes et al. Oversubscribing micro-clouds with energy-aware containers scheduling
CN117648053A (en) Data storage method, system, equipment and readable storage medium
CN103220363A (en) Distributed network training resource management system based on cloud computing and scheduling method
CN116149798B (en) Virtual machine control method and device of cloud operating system and storage medium
CN109005071B (en) A decision-making deployment method and scheduling device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40028556

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant