CN116781626A - Load balancing method and device and electronic equipment - Google Patents

Load balancing method and device and electronic equipment Download PDF

Info

Publication number
CN116781626A
CN116781626A CN202211133326.2A CN202211133326A CN116781626A CN 116781626 A CN116781626 A CN 116781626A CN 202211133326 A CN202211133326 A CN 202211133326A CN 116781626 A CN116781626 A CN 116781626A
Authority
CN
China
Prior art keywords
message
header field
header
load balancing
vxlan
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211133326.2A
Other languages
Chinese (zh)
Inventor
周志洪
袁昌斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202211133326.2A priority Critical patent/CN116781626A/en
Publication of CN116781626A publication Critical patent/CN116781626A/en
Pending legal-status Critical Current

Links

Abstract

The application discloses a load balancing method, which comprises the following steps: receiving a first message; performing VXLAN encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body; and forwarding the second message to the back-end virtual server. The application also discloses a load balancing device and electronic equipment. The load balancing method provided by the application realizes operations such as forwarding flow, issuing configuration of each tenant and the like by using a unified interface, and is convenient to manage; and the message can be forwarded to a back-end virtual server in the VPC network, so that the compatibility problem is solved.

Description

Load balancing method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a load balancing method, a load balancing device, and an electronic device.
Background
Currently, a high-performance 4-layer load equalizer (DPVS) developed based on a data plane development suite (Data Plane Development Kit, DPDK) is modified on the basis of a Linux virtual server (Linux Virtual Server, LVS), and the DPVS can be matched with user habits, so that learning cost is reduced, and is favored by various cloud manufacturers. Meanwhile, public cloud service providers typically provide virtual private cloud (Virtual Private Cloud, VPC) network services to their tenants.
However, the existing open-source DPVS scheme can only operate in a classical underlying (underlay) network, cannot support a VPC network, has a compatibility problem, and cannot realize load balancing of a back-end Virtual Machine (VM).
Disclosure of Invention
The application provides a load balancing method, a load balancing device and electronic equipment, which can realize operations such as forwarding flow and issuing configuration of each tenant by using a unified interface; and compatibility of DPVS with VPC networks is achieved.
The technical scheme of the application is realized as follows:
a method of load balancing, the method comprising:
receiving a first message;
performing virtual extension local area network (Virtual Extensible Local Area Network, VXLAN) encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and forwarding the second message to a back-end virtual server.
A load balancing apparatus, the control apparatus comprising:
the receiving module is used for receiving the first message;
the processing module is used for carrying out VXLAN encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and the sending module is used for forwarding the second message to the back-end virtual server.
An electronic device, the electronic device comprising: a processor and a storage medium storing instructions executable by the processor; the storage medium is operable to rely on the processor to perform operations through the communication bus and when executed by the processor, perform the load balancing method described above.
The application provides a load balancing method, which comprises the following steps: receiving a first message; performing VXLAN encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body; and forwarding the second message to the back-end virtual server. In this way, operations such as forwarding traffic and issuing configuration of each tenant are realized by using a unified interface, so that management is convenient; when the back-end server of the service is a cloud host, the message can be forwarded to the back-end virtual server in the VPC network by performing VXLAN encapsulation on the original message and establishing a VXLAN tunnel with the physical machine where the back-end virtual server is located, so that the compatibility problem is solved.
Drawings
Fig. 1 is a schematic flow chart of an alternative load balancing method according to an embodiment of the present application;
fig. 2 is a schematic diagram of an alternative VXLAN encapsulation message format provided by an embodiment of the present application;
fig. 3 is an exemplary diagram of an alternative VXLAN package provided by an embodiment of the present application;
fig. 4 is an exemplary diagram two of an alternative VXLAN package provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of an alternative load balancing agent according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an alternative load balancing device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The present application will be further described in detail with reference to the accompanying drawings, for the purpose of making the objects, technical solutions and advantages of the present application more apparent, and the described embodiments should not be construed as limiting the present application, and all other embodiments obtained by those skilled in the art without making any inventive effort are within the scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
In the following description, the terms "first", "second", "third" and the like are merely used to distinguish similar objects and do not represent a specific ordering of the objects, it being understood that the "first", "second", "third" may be interchanged with a specific order or sequence, as permitted, to enable embodiments of the application described herein to be practiced otherwise than as illustrated or described herein.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the application only and is not intended to be limiting of the application.
The embodiment of the application provides a load balancing method which is applied to a load balancing agent in a load balancing cluster, and is shown by referring to fig. 1, and the method comprises the following steps:
step 101, receiving a first message.
The first message may be understood as an original message before encapsulation.
In some embodiments, step 101 may be understood as receiving a first message sent by the northbound interface. The northbound interface may include an application program interface (Application Programming Interface, API) of the design style and development style (Representational State Transfer, restul) of the web application. The RESTFUL API is used for adding, changing and deleting the called resources; restul refers to a format definition that may be based on hypertext transfer protocol (Hyper Text Transfer Protocol, HTTP), extensible markup language (Extensible Markup Language, XML) or JS object profile (JavaScript Object Notation, JSON) that may be used.
In this way, after the load balancing agent, an upper local area network (World Wide Web) establishes HTTP connection with each load balancing host, and then uniformly issues configuration and service data to each host in the whole load balancing cluster through an interface.
And 102, performing virtual extension local area network (VXLAN) encapsulation on the first message to obtain a second message.
The second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body.
In some embodiments, the outer layer header field includes: an outer media access control (Media Access Control, MAC) header, an outer internet protocol (Internet Protocol, IP) header, and an outer user datagram protocol (User Datagram Protocol, UDP); the inner layer message header field includes an inner layer MAC header and an inner layer IP header. Fig. 2 is a schematic diagram of an alternative VXLAN encapsulation message format according to an embodiment of the present application, and referring to fig. 2, a second message includes: an outer MAC header, an outer IP header, an outer UDP header, a VXLAN header, an inner MAC header, an inner IP header, and a message body.
The VXLAN header may include a 24-bit VXLAN network identifier (VXLAN Network Identifier, VNI) field, which is used to define different tenants in the VXLAN network. It may be appreciated that a VNI is a user identifier similar to a VLAN ID, where a VNI represents a tenant, and two layers of communication cannot be directly performed between virtual machines belonging to different VNIs. When the VXLAN message is packaged, 24-bit length space is allocated to the VNI, so that the VXLAN message can support isolation of mass tenants. In the outer layer UDP header, the destination port number (udp_s_p) is fixed to 4789, and the source port number (udp_d_p) is a value calculated by the hash algorithm of the original ethernet frame.
In some embodiments, step 102 may be followed by: and calling a management tool in the load balancing cluster, and forwarding the second message to the virtual IP address. Wherein the management tool may comprise: LVS contains the ipvssadm management tool.
In this way, the configuration is directly issued to the load balancing memory through the ipvssadm module in the load balancing cluster, the configuration is effective in real time aiming at the back-end virtual server, the configuration is not required to be modified, and the keepaled process is not required to be restarted after the configuration is required to be modified manually, so that management of the whole load balancing cluster by management staff is facilitated.
And step 103, forwarding the second message to the back-end virtual server.
It can be appreciated that VXLAN is a technology that encapsulates a two-layer network packet with a three-layer network protocol, where the two-layer network is built on top of a traditional three-layer network, implementing an extension of the two-layer network over the three-layer network, referred to as a second-layer network coverage scheme on a third-layer network, a typical VXLAN network VM, VXLAN tunnel endpoint (VXLAN Tunnel Endpoints, VTEP), and software defined network (Software Defined Networking, SDN) controller.
It should be noted that, the two-layer ethernet frame is encapsulated in UDP by using VTEPs, one VTEP may be shared by all VMs on one physical machine, and one VTEP corresponds to one physical machine. From the perspective of the switch, only the UDP data is transferred between different VTEPs, and only MAC address table entries corresponding to the number of physical machines are required to be recorded. Wherein, the VTEP can be an independent network device or a virtual switch in a server; the original data frame sent by the source server is encapsulated into a message in the VXLAN format on the VTEP, and is transmitted to another VTEP in the IP network, the original data frame is restored through decapsulation and conversion, and finally the message is forwarded to the destination server.
The message is encapsulated by the load balancing agent and enters the physical machine where the VM is located, the VTEP in the physical machine removes the outer layer UDP header after receiving the VXLAN message, and sends the original message to the destination server according to the VNI contained in the VXLAN header, so that the service data or the service flow can enter the VM.
In an achievable load balancing scenario, the DPVS includes multiple load balancers, where each load balancer is correspondingly provided with a load balancing agent, and is configured to receive a first packet sent by a front-end user interface, and distribute the first packet to a corresponding back-end virtual server, so as to achieve an optimal resource utilization, improve throughput to the greatest extent, shorten response time, and avoid overload of a computer system.
The embodiment of the application provides a load balancing method, which comprises the following steps: receiving a first message; performing virtual extension local area network (VXLAN) encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body; and forwarding the second message to the back-end virtual server. In this way, operations such as forwarding traffic and issuing configuration of each tenant are realized by using a unified interface, so that management is convenient; when the back-end server of the service is a cloud host, the message can be forwarded to the server in the VPC network at the back end by performing VXLAN encapsulation on the original message, so that the compatibility problem is solved.
In some embodiments, step 102 encapsulates the first message by VXLAN to obtain a second message, including:
step A1, stripping an MAC header field and an IP header field of a first message to obtain information contained in the MAC header field and the IP header field and a message body of the first message;
a2, changing information contained in the IP header field to obtain a virtual IP address corresponding to the first message;
step A3, combining the MAC header field and the modified IP header field of the first message to obtain an inner layer message header field;
and A4, sequentially packaging an outer layer message header field, a VXLAN header field and an inner layer message header field for the message body of the first message to obtain a second message.
In an alternative embodiment, the information contained in the IP header field in step A2 may include: a destination IP address.
Illustratively, the destination IP address in the IP header field in the first message is 172.52.10.1:80 is changed to: the virtual IP address is 192.168.10.1.
Thus, after the destination IP address of the first message is changed, the MAC header field of the first message is combined to obtain the inner layer message header field, and the VXLAN encapsulation is completed according to the sequence of the outer layer message header field, the VXLAN header field and the inner layer message header field, so that the VXLAN tunnel is established with the physical machine where the back-end virtual server is located, the compatibility problem is solved, and meanwhile, the loss of information in the message is reduced.
In some embodiments, step A4 is that the message body of the first message encapsulates the outer layer header field, the VXLAN header field, and the inner layer header field in sequence, and before obtaining the second message, the method further includes:
obtaining an outer layer MAC header according to the MAC address of the load balancing agent and the MAC address of the physical machine to which the back-end virtual server belongs;
obtaining an outer layer IP head according to the IP address of the physical machine to which the back-end virtual server belongs;
and obtaining an outer layer UDP header according to the fixed end number and the destination IP address in the first message.
For example, the SIP address of the physical machine to which the back-end virtual server belongs is 10.10.10.1, and the dip address is 192.168.10.1; the destination port number (udp_s_p) is fixed to 4789, and the source port number (udp_d_p) is a value calculated by the hash algorithm of the original ethernet frame.
Thus, the outer layer message header needed by the VXLAN encapsulation is obtained, and the subsequent corresponding encapsulation is convenient.
In some embodiments, step A4 is a step of sequentially encapsulating, for a message body of the first message, an outer layer header field, a VXLAN header field, and an inner layer header field to obtain a second message, including:
and sequentially packaging the message bodies of the first message according to the sequence of the outer MAC header, the outer IP header, the outer UDP header, the VXLAN header field, the inner MAC header and the inner IP header to obtain a second message.
For example, referring to fig. 2, the encapsulation is performed sequentially in the order of fig. 2, and the second packet is in the format: an outer MAC header, an outer IP header, an outer UDP header, a VXLAN header field, an inner MAC header, an inner IP header, and a message body.
Therefore, when the back-end server of the service is a cloud host, the VXLAN tunnel is established with the physical machine where the back-end virtual server is located by carrying out VXLAN encapsulation on the original message, so that the message can be forwarded to the back-end virtual server in the VPC network, and the compatibility problem is solved.
In some embodiments, after forwarding the second packet to the backend virtual server in step 103, the method further includes:
receiving and storing a configuration result sent by a back-end virtual server;
and sending the configuration result to the north interface module.
Therefore, the configuration result of the back-end virtual server is stored in the memory of the load balancing agent for backup and is sent to the user side through the load balancing agent, so that the last configuration result is not lost when the equipment is restarted.
In some embodiments, the load balancing agent further comprises a monitoring tool; the method further comprises the following steps:
monitoring the message forwarding process to generate monitoring data;
periodically checking configuration files of the load balancing clusters;
and comparing the configuration result with the configuration file, and if the difference exists, sending the monitoring data to the northbound interface module.
In an embodiment of the application, the monitoring tool may include a health check script.
The health check script monitors the running condition of load balancing, compares the difference between the monitoring data and the configuration file with 10 seconds as one period, and sends the monitoring data to the user and the operation and maintenance personnel, so that the operation and maintenance personnel can analyze abnormal data and logs.
Therefore, when the load balancing process is abnormal, the process can be stopped, and the step of forwarding the message is switched to other load balancers which normally operate in the cluster.
Fig. 3 and 4 are exemplary diagrams of an alternative VXLAN package provided by an embodiment of the present application; referring to fig. 3 and 4, an exemplary DPVS-based original architecture, user 10.10.10.1 accesses the service with vip: vport of 172.52.10.1:80, encapsulates the message as follows VXLAN:
first, the destination IP address (172.52.10.1:80) is changed to the virtual IP address (192.168.10.1) of the back-end VM, and when configuring the load balancing back-end server, the load balancing agent needs to add information such as VNI (5643), localip (10.184.10.5), remoteip (10.184.20.5) and the like, so that the load balancer and the physical machine where the VM is located establish a VXLAN tunnel. The internal source MAC is set to a specific MAC address, the destination port number (udp_s_p) of UDP is fixed to 4789, and the source port number (udp_d_p) is hash-filled according to the internal SIP. The external sip address and dip address of VXLAN message are written by the load balancing agent after unified planning, 10.184.10.5 and 10.184.20.5 respectively. The external mac addresses are the mac address of the load balancer network card and the mac address of the physical machine network card where the VM is located, respectively.
Fig. 5 is a schematic structural diagram of an optional load balancing agent according to an embodiment of the present application, and the architecture of the load balancing agent according to the embodiment of the present application is further described with reference to fig. 5, where the load balancing agent includes:
the northbound interface module 501 is configured to send an unpackaged original message to the proxy module 502;
the proxy module 502 is configured to perform VXLAN encapsulation on the original message, so as to obtain an encapsulated message;
a management module 503, configured to send the encapsulated packet to a back-end virtual server;
a configuration file storage module 504, configured to store the received configuration result;
the monitoring module 505 is configured to monitor a packet forwarding process.
In the load balancing agent provided by the embodiment of the present application, the agent module 502 is a core module implemented by control logic, and may also be understood as a core processor of the load balancing agent, and may be capable of executing steps such as message encapsulation, calling other modules, and the like. The management module 503 may include an ipvssadm module, so that the load balancing method provided by the embodiment of the present application may not pass through the keepalive module any more, but the proxy module 502 directly invokes the ipvssadm module to issue configuration to the memory of the DPVS, so that the DPVS distributes the service according to the configuration. The proxy module 502 stores the configuration result in the local configuration file storage module 504 generated by itself while forwarding the message, so that when the configuration rollback or the load balancing restart occurs, the configuration can be quickly restored. The monitoring module 505 may further include a health check script, where the agent module 502 invokes the health check script to compare the configuration data of the DPVS memory with the configuration file stored in the local configuration file storage module 504 at regular time, so as to ensure consistency of the configuration data. The agent module 502 can also call the monitoring module 505 to monitor the running condition of the load equalizer in real time, analyze abnormal data and logs, and send alarms to users and operation and maintenance personnel in time; thus, when the load balancer fails, traffic can be seamlessly switched to other normal load balancers in the load balancing cluster.
An embodiment of the present application provides a load balancing device, where the control device may be applied to a load balancing method provided in the corresponding embodiment of fig. 1, and referring to fig. 6, the load balancing device 6 includes:
a receiving module 601, configured to receive a first packet;
a processing module 602, configured to perform VXLAN encapsulation on the first packet to obtain a second packet; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and the sending module 603 is configured to forward the second message to the back-end virtual server.
In other embodiments of the present application, the outer layer header field includes: an outer Media Access Control (MAC) header, an outer Internet Protocol (IP) header, and an outer User Datagram Protocol (UDP) header; the inner layer message header field includes an inner layer MAC header and an inner layer IP header.
In other embodiments of the application, the processing module 602 is further configured to:
obtaining an outer layer MAC header according to the MAC address of the load balancing agent and the MAC address of the physical machine to which the back-end virtual server belongs;
obtaining an outer layer IP head according to the IP address of the physical machine to which the back-end virtual server belongs;
and obtaining an outer layer UDP header according to the fixed end number and the destination IP address in the first message.
In other embodiments of the application, the processing module 602 is further configured to:
when the IP header of the first message is stripped, a destination IP address in the IP header of the first message is obtained;
when the inner layer IP header of the second message is encapsulated, the target IP address is replaced by a virtual IP address, and the virtual IP address is correspondingly written into the inner layer IP header;
when the original Ethernet frame of the first message is stripped, acquiring a source port number of the first message;
and when the inner layer MAC header of the second message is packaged, the source port number is correspondingly written into the inner layer MAC header.
In other embodiments of the present application, the sending module 603 is further configured to invoke a management tool in the load balancing cluster to forward the second packet to the virtual IP address.
In other embodiments of the present application, the sending module 601 is further configured to receive and store a configuration result sent by the back-end virtual server;
the sending module 603 is further configured to send the configuration result to the northbound interface module.
In other embodiments of the application, the processing module 602 is further configured to:
monitoring the message forwarding process to generate monitoring data;
periodically checking configuration files of the load balancing clusters;
and comparing the configuration result with the configuration file, and if the difference exists, sending the monitoring data to the northbound interface module.
An embodiment of the present application provides an electronic device, which may be applied to the method provided in the embodiment corresponding to fig. 1, referring to fig. 7, the electronic device 7 (the electronic device 7 in fig. 7 corresponds to the load balancing apparatus 6 in fig. 6) includes: a processor 701, a memory 702, and a communication bus 703, wherein:
a communication bus 703 is used to enable a communication connection between the processor 701 and a memory 702.
The processor 701 is configured to execute a load balancing program stored in the memory 702 to implement the following steps:
receiving a first message;
performing virtual extension local area network (VXLAN) encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and forwarding the second message to a back-end virtual server.
In other embodiments of the present application, the outer layer header field includes: an outer Media Access Control (MAC) header, an outer Internet Protocol (IP) header, and an outer User Datagram Protocol (UDP) header; the inner layer message header field comprises an inner layer MAC header and an inner layer IP header.
In other embodiments of the present application, the processor 701 is configured to execute an information processing program stored in the memory 702 to implement the following steps:
obtaining the outer layer MAC header according to the MAC address of the load balancing agent and the MAC address of the physical machine to which the back-end virtual server belongs;
obtaining the outer layer IP head according to the IP address of the physical machine to which the back-end virtual server belongs;
and obtaining the outer layer UDP header according to the fixed end number and the destination IP address in the first message.
In other embodiments of the present application, the processor 701 is configured to execute an information processing program stored in the memory 702 to implement the following steps:
when the IP header of the first message is stripped, a destination IP address in the IP header of the first message is obtained;
when the inner layer IP head of the second message is encapsulated, the target IP address is replaced by a virtual IP address, and the virtual IP address is correspondingly written into the inner layer IP head;
when the original Ethernet frame of the first message is stripped, acquiring a source port number of the first message;
and when the inner layer MAC header of the second message is packaged, the source port number is correspondingly written into the inner layer MAC header.
In other embodiments of the present application, the processor 701 is configured to execute an information processing program stored in the memory 702 to implement the following steps:
and calling a management tool in the load balancing cluster, and forwarding the second message to the virtual IP address.
In other embodiments of the present application, the processor 701 is configured to execute an information processing program stored in the memory 702 to implement the following steps:
receiving and storing a configuration result sent by the back-end virtual server;
and sending the configuration result to the north interface module.
In other embodiments of the present application, the processor 701 is configured to execute an information processing program stored in the memory 702 to implement the following steps:
monitoring the message forwarding process to generate monitoring data;
periodically checking configuration files of the load balancing clusters;
and comparing the configuration result with the configuration file, and if the difference exists, sending the monitoring data to the northbound interface module.
By way of example, the processor may be an integrated circuit chip having signal processing capabilities such as a general purpose processor, such as a microprocessor or any conventional processor, a digital signal processor (Digital Signal Processor, DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like.
It should be noted that, in the specific implementation process of the steps executed by the processor in this embodiment, reference may be made to the implementation process in the method provided in the corresponding embodiment of fig. 1, which is not repeated herein.
The electronic equipment provided by the embodiment of the application can receive the first message through the method; performing virtual extension local area network (VXLAN) encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body; and forwarding the second message to the back-end virtual server. In this way, operations such as forwarding traffic and issuing configuration of each tenant are realized by using a unified interface, so that management is convenient; when the back-end server of the service is a cloud host, the message can be forwarded to the server in the VPC network at the back end by performing VXLAN encapsulation on the original message, so that the compatibility problem is solved.
Embodiments of the present application provide a computer readable storage medium storing one or more programs executable by one or more processors to implement the implementation procedure in the load balancing method provided in the corresponding embodiment of fig. 1, which is not described herein.
It should be noted here that: the description of the storage medium and apparatus embodiments above is similar to that of the method embodiments described above, with similar benefits as the method embodiments. For technical details not disclosed in the embodiments of the storage medium and the apparatus of the present application, please refer to the description of the method embodiments of the present application.
The computer storage medium/Memory may be a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable programmable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable programmable Read Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic random access Memory (Ferromagnetic Random Access Memory, FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical disk, or a Read Only optical disk (Compact Disc Read-Only Memory, CD-ROM); but may also be various terminals such as mobile phones, computers, tablet devices, personal digital assistants, etc., that include one or any combination of the above-mentioned memories.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment of the present application" or "the foregoing embodiments" or "some implementations" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" or "an embodiment of the application" or "the foregoing embodiment" or "some embodiments" or "some implementations" in various places throughout this specification are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the sequence numbers of the foregoing processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic thereof, and should not constitute any limitation on the implementation process of the embodiments of the present application. The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of units is only one logical function division, and there may be other divisions in actual implementation, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
The methods disclosed in the method embodiments provided by the application can be arbitrarily combined under the condition of no conflict to obtain a new method embodiment.
The features disclosed in the several product embodiments provided by the application can be combined arbitrarily under the condition of no conflict to obtain new product embodiments.
The features disclosed in the embodiments of the method or the apparatus provided by the application can be arbitrarily combined without conflict to obtain new embodiments of the method or the apparatus.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read Only Memory (ROM), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the above-described integrated units of the present application may be stored in a computer-readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or part of what contributes to the related art may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
It should be noted that the drawings in the embodiments of the present application are only for illustrating schematic positions of respective devices on the terminal device, and do not represent actual positions in the terminal device, the actual positions of respective devices or respective areas may be changed or shifted according to actual situations (for example, structures of the terminal device), and proportions of different portions in the terminal device in the drawings do not represent actual proportions.
The foregoing is merely an embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A load balancing method, wherein the method is applied to a load balancing agent in a load balancing cluster; the method comprises the following steps:
receiving a first message;
performing virtual extension local area network (VXLAN) encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and forwarding the second message to a back-end virtual server.
2. The method of claim 1, wherein the outer layer header field comprises: an outer Media Access Control (MAC) header, an outer Internet Protocol (IP) header, and an outer User Datagram Protocol (UDP) header; the inner layer message header field comprises an inner layer MAC header and an inner layer IP header.
3. The method of claim 2, wherein VXLAN encapsulating the first message to obtain a second message comprises:
stripping the MAC header field and the IP header field of the first message to obtain information contained in the MAC header field and the IP header field and a message body of the first message;
changing the information contained in the IP header field to obtain a virtual IP address corresponding to the first message;
combining the MAC header field and the modified IP header field of the first message to obtain the inner layer message header field;
and sequentially packaging the outer layer message header field, the VXLAN header field and the inner layer message header field for the message body of the first message to obtain the second message.
4. The method of claim 3, wherein the message body for the first message encapsulates the outer layer header field, the VXLAN header field, and the inner layer header field in order, and further comprising, before obtaining the second message:
obtaining the outer layer MAC header according to the MAC address of the load balancing agent and the MAC address of the physical machine to which the back-end virtual server belongs;
obtaining the outer layer IP head according to the IP address of the physical machine to which the back-end virtual server belongs;
and obtaining the outer layer UDP header according to the fixed end number and the destination IP address in the first message.
5. The method according to claim 3 or 4, wherein the encapsulating the outer layer header field, the VXLAN header field, and the inner layer header field in order for the message body of the first message, to obtain the second message, includes:
and sequentially packaging the message bodies of the first message according to the sequence of the outer MAC header, the outer IP header, the outer UDP header, the VXLAN header field, the inner MAC header and the inner IP header to obtain the second message.
6. The method of claim 3, wherein forwarding the second message to a back-end virtual server comprises:
and calling a management tool in the load balancing cluster, and forwarding the second message to the virtual IP address.
7. The method of claim 1, wherein after forwarding the second message to the back-end virtual server, further comprising:
receiving and storing a configuration result sent by the back-end virtual server;
and sending the configuration result to the north interface module.
8. The method of claim 7, wherein the method further comprises:
monitoring the message forwarding process to generate monitoring data;
periodically checking configuration files of the load balancing clusters;
and comparing the configuration result with the configuration file, and if the difference exists, sending the monitoring data to the northbound interface module.
9. A load balancing device, wherein the device is applied to a load balancing agent in a load balancing cluster; the device comprises:
the receiving module is used for receiving the first message;
the processing module is used for carrying out VXLAN encapsulation on the first message to obtain a second message; the second message comprises an outer layer message header field, a VXLAN header field, an inner layer message header field and a message body;
and the sending module is used for forwarding the second message to the back-end virtual server.
10. An electronic device, comprising: a processor and a storage medium storing instructions executable by the processor; the storage medium being dependent on the processor for performing operations via the communication bus, when the instructions are executed by the processor, performing the load balancing method of any one of the preceding claims 1 to 8.
CN202211133326.2A 2022-09-16 2022-09-16 Load balancing method and device and electronic equipment Pending CN116781626A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211133326.2A CN116781626A (en) 2022-09-16 2022-09-16 Load balancing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211133326.2A CN116781626A (en) 2022-09-16 2022-09-16 Load balancing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116781626A true CN116781626A (en) 2023-09-19

Family

ID=88006926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211133326.2A Pending CN116781626A (en) 2022-09-16 2022-09-16 Load balancing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116781626A (en)

Similar Documents

Publication Publication Date Title
CN108449282B (en) Load balancing method and device
US9313302B2 (en) Stateless packet segmentation and processing
US20220206908A1 (en) Techniques for replicating state information for high availability
US9749145B2 (en) Interoperability for distributed overlay virtual environment
CN110113441B (en) Computer equipment, system and method for realizing load balance
US11258667B2 (en) Network management method and related device
US8155146B1 (en) Stateless packet segmentation and processing
US9385912B1 (en) Framework for stateless packet tunneling
US8725898B1 (en) Scalable port address translations
KR101840904B1 (en) Virtualization gateway between virtualized and non-virtualized networks
WO2022206229A1 (en) Data processing method and apparatus, device, and storage medium
CN112104754B (en) Network proxy method, system, device, equipment and storage medium
US20120117563A1 (en) Overload control in a cloud computing environment
JP2018011331A (en) Framework and interface for offload device-based packet processing
US20180375762A1 (en) System and method for limiting access to cloud-based resources including transmission between l3 and l7 layers using ipv6 packet with embedded ipv4 addresses and metadata
JP2015534320A (en) System and method for providing policy-based data center network automation
CN112583618B (en) Method, device and computing equipment for providing network service for business
US20220263793A1 (en) Cloud infrastructure resources for connecting a service provider private network to a customer private network
CN112350918A (en) Service traffic scheduling method, device, equipment and storage medium
CN113765801B (en) Message processing method and device applied to data center, electronic equipment and medium
CN116781626A (en) Load balancing method and device and electronic equipment
CN115484232A (en) DHCP server deployment method, device, equipment and storage medium
CN115185637A (en) Communication method and device for PaaS component management end and virtual machine agent
US20170126430A1 (en) Multiple gateway operation on single operating system
US20230308354A1 (en) Intelligent controller for smart nics and hardware accelerators

Legal Events

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