CN109831468A - Load-balancing method, device, electronic equipment and storage medium - Google Patents

Load-balancing method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109831468A
CN109831468A CN201711180468.3A CN201711180468A CN109831468A CN 109831468 A CN109831468 A CN 109831468A CN 201711180468 A CN201711180468 A CN 201711180468A CN 109831468 A CN109831468 A CN 109831468A
Authority
CN
China
Prior art keywords
data packet
package
request data
end server
server
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
CN201711180468.3A
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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud 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 Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201711180468.3A priority Critical patent/CN109831468A/en
Publication of CN109831468A publication Critical patent/CN109831468A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides load-balancing method, device, electronic equipment and storage mediums, the above method is applied to load-balanced server, above-mentioned load-balanced server has the corresponding back-end server of multiple tenant networks under its command, above-mentioned tenant network is VPC network, the above method includes: reception request data package, determines the tenant network of request data package request access;Determine the corresponding back-end server of tenant network;According to preset load balancing rule, target back-end server is chosen in identified back-end server;Request data package is packaged, obtain package request data packet, wherein, package request data packet includes: source address and destination address, the source address of package request data packet is the address of load-balanced server, and the destination address of package request data packet is address of the target back-end server in affiliated tenant network;Package request data packet is sent to target back-end server, it is possible to reduce the deployment cost of each tenant network.

Description

Load-balancing method, device, electronic equipment and storage medium
Technical field
The present invention relates to technical field of information transmission, more particularly to load-balancing method, device, electronic equipment and storage Medium.
Background technique
VPC (Virtual Private Cloud, virtual private cloud) is the dynamic configuration of a public cloud computing resources Pond, VPC is based on using cryptographic protocol, tunnel protocol and other security procedures, in one or more back-end server, realizes each Isolation between tenant network ensure that the safety of each tenant data.
Network address is not isolated in traditional network, and load-balanced server can reach each back-end server.It is different The network of each tenant in traditional network, VPC network is isolation.Load-balanced server outside tenant network can not It is communicated with the back-end server in tenant network.Therefore existing VPC network is when carrying out load balancing, for each rent Family network respectively configures a load-balanced server in each tenant network respectively, but adopts this method, and increases each The deployment cost of tenant network.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of load-balancing method, device, electronic equipment and storage medium, with Realize the deployment cost for reducing each tenant network.Specific technical solution is as follows:
In a first aspect, being applied to load-balanced server, above-mentioned load the embodiment of the invention provides load-balancing method Equalization server has the corresponding back-end server of multiple tenant networks under its command, and above-mentioned tenant network is virtual private cloud VPC network, on The method of stating includes:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
Optionally, after the above-mentioned above-mentioned package request data packet to the transmission of above-mentioned target back-end server, the above method Can also include:
Receive encapsulation feedback data packet, wherein above-mentioned encapsulation feedback data packet be by above-mentioned target back-end server according to Above-mentioned request data package generates feedback data packet, and obtained after being packaged to above-mentioned feedback data packet, above-mentioned encapsulation feedback The source address of data packet is the address of above-mentioned target back-end server, and the destination address of above-mentioned encapsulation feedback data packet is above-mentioned negative Carry the address of equalization server;
It decapsulates above-mentioned encapsulation feedback data packet and obtains above-mentioned feedback data packet, send above-mentioned feedback data packet.
Optionally, before determining the corresponding back-end server of above-mentioned tenant, the above method can also include:
According to default addition rule, chooses at least one back-end server and be added in tenant's server list, and upper It states in tenant's server list and at least one selected back-end server is associated with above-mentioned tenant network;
Correspondingly, the corresponding back-end server of the above-mentioned above-mentioned tenant network of determination includes:
Above-mentioned tenant's server list is inquired, by the associated back-end server of above-mentioned tenant network, as above-mentioned tenant's net The corresponding back-end server of network.
Optionally, in the load-balancing method of the embodiment of the present invention, increase in the kernel of above-mentioned load-balanced server Corresponding system is added to call, above-mentioned corresponding system is called for calling pre-set programs, when calling above-mentioned pre-set programs, is realized Any of the above-described load-balancing method method applied to load-balanced server.
Second aspect, the embodiment of the invention provides a kind of load-balancing methods, are applied to back-end server, above-mentioned rear end Server is the back-end server in the corresponding tenant network in virtual private cloud VPC network, and multiple tenant networks share one Load-balanced server, the above method include:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
Optionally, in the above-mentioned package request data packet of above-mentioned decapsulation, after obtaining above-mentioned request data package, the above method Can also include:
The service requested in above-mentioned request data package is executed by the virtual machine in above-mentioned back-end server.
Optionally, the clothes requested in above-mentioned request data package are being executed above by the virtual machine in above-mentioned back-end server After business, the above method can also include:
Obtain feedback data packet, wherein above-mentioned feedback data packet is asked in the above-mentioned request data package of above-mentioned virtual machine execution The data packet generated after the service asked;
Above-mentioned feedback data packet is encapsulated, obtains encapsulation feedback data packet, wherein the source address of above-mentioned encapsulation feedback data packet For address of the above-mentioned back-end server in affiliated tenant network, the destination address of above-mentioned encapsulation feedback data packet is above-mentioned negative Carry the address of equalization server;
Above-mentioned encapsulation feedback data packet is sent to above-mentioned load-balanced server.
Optionally, the above-mentioned load-balancing method applied to back-end server can also include:
Record the source address of above-mentioned package request data packet;
Correspondingly, executing the clothes requested in above-mentioned request data package above by the virtual machine in above-mentioned back-end server After business, the above method further include:
Obtain feedback data packet, wherein above-mentioned feedback data packet is asked in the above-mentioned request data package of above-mentioned virtual machine execution The data packet generated after the service asked;
It inquires in above-mentioned back-end server and whether preserves the source of the corresponding package request data packet of above-mentioned feedback data packet Address;
The source address of the corresponding package request data packet of above-mentioned feedback data packet is not saved in above-mentioned back-end server When, abandon above-mentioned feedback data packet.
The third aspect, the embodiment of the invention provides a kind of load balancing apparatus, are applied to load-balanced server, above-mentioned Load-balanced server has the corresponding back-end server of multiple tenant networks under its command, and above-mentioned tenant network is virtual private cloud VPC net Network, above-mentioned apparatus include:
Tenant's determining module determines the tenant network of above-mentioned request data package request access for receiving request data package;
Back-end server determining module, for determining the corresponding back-end server of above-mentioned tenant network;
Destination server determining module, for regular according to preset load balancing, in identified back-end server Choose target back-end server;
Request data package package module obtains package request data packet for above-mentioned request data package to be packaged, In, above-mentioned package request data packet includes: source address and destination address, and the source address of above-mentioned package request data packet is above-mentioned negative The address of equalization server is carried, the destination address of above-mentioned package request data packet is above-mentioned target back-end server in affiliated rent Address in the network of family;
Package request packet sending module, for sending above-mentioned package request data to above-mentioned target back-end server Packet.
Optionally, the above-mentioned load balancing apparatus applied to load-balanced server can also include:
Feedback data packet receiving module is encapsulated, for receiving encapsulation feedback data packet, wherein above-mentioned encapsulation feedback data packet It is feedback data packet to be generated according to above-mentioned request data package by above-mentioned target back-end server, and carry out to above-mentioned feedback data packet It is obtained after encapsulation, the source address of above-mentioned encapsulation feedback data packet is the address of above-mentioned target back-end server, and above-mentioned encapsulation is anti- The destination address for presenting data packet is the address of above-mentioned load-balanced server;
Feedback data packet decapsulation module is encapsulated, obtains above-mentioned feedback data for decapsulating above-mentioned encapsulation feedback data packet Packet, sends above-mentioned feedback data packet.
Optionally, the above-mentioned load balancing apparatus applied to load-balanced server can also include:
Server adding module, for choosing at least one back-end server and being added to tenant according to default addition rule In server list, and to selected at least one back-end server and above-mentioned tenant's net in above-mentioned tenant's server list Network is associated;
Correspondingly, above-mentioned back-end server determining module is specifically used for:
Above-mentioned tenant's server list is inquired, by the associated back-end server of above-mentioned tenant network, as above-mentioned tenant's net The corresponding back-end server of network.
Optionally, increase corresponding system in the kernel of above-mentioned load-balanced server to call, above-mentioned corresponding system It calls for calling any of the above-described load balancing apparatus applied to load-balanced server.
Fourth aspect, the embodiment of the invention provides a kind of load balancing apparatus, are applied to back-end server, above-mentioned rear end Server is the back-end server in the corresponding tenant network in virtual private cloud VPC network, and multiple tenant networks share one Load-balanced server, above-mentioned apparatus include:
Package request packet-receiving module, for receiving package request data packet, wherein above-mentioned package request data packet It is to obtain and send after being packaged by load-balanced server to request data package;Above-mentioned package request data packet includes source Address and destination address, the source address of above-mentioned package request data packet are the address of above-mentioned load-balanced server, above-mentioned encapsulation The destination address of request data package is above-mentioned back-end server address in affiliated tenant network;
Package request data packet decapsulation module obtains above-mentioned number of request for decapsulating above-mentioned package request data packet According to packet.
Optionally, the above-mentioned load balancing apparatus applied to back-end server can also include:
Service execution module is requested for being executed in above-mentioned request data package by the virtual machine in above-mentioned back-end server Service.
Optionally, the above-mentioned load balancing apparatus applied to back-end server can also include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein above-mentioned feedback data packet is above-mentioned virtual machine Execute the data packet generated after the service requested in above-mentioned request data package;
Feedback data packet package module obtains encapsulation feedback data packet for encapsulating above-mentioned feedback data packet, wherein on The source address for stating encapsulation feedback data packet is address of the above-mentioned back-end server in affiliated tenant network, above-mentioned encapsulation feedback The destination address of data packet is the address of above-mentioned load-balanced server;
Feedback data packet sending module is encapsulated, for sending above-mentioned encapsulation feedback data to above-mentioned load-balanced server Packet.
Optionally, the above-mentioned load balancing apparatus applied to back-end server can also include:
Path logging modle, for recording the source address of above-mentioned package request data packet;
Correspondingly, above-mentioned apparatus further include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein above-mentioned feedback data packet is above-mentioned virtual machine Execute the data packet generated after the service requested in above-mentioned request data package;
Whether path query module preserves the corresponding envelope of above-mentioned feedback data packet for inquiring in above-mentioned back-end server Fill the source address of request data package;
Data packet discarding module saves the corresponding encapsulation of above-mentioned feedback data packet for no in above-mentioned back-end server When the source address of request data package, above-mentioned feedback data packet is abandoned.
5th aspect, the embodiment of the invention provides a kind of electronic equipment, including processor and machine readable storage medium, Above-mentioned machine readable storage medium is stored with the machine-executable instruction that can be executed by above-mentioned processor, and above-mentioned processor is above-mentioned Machine-executable instruction promotes: realizing any load-balancing method of above-mentioned first aspect.
6th aspect, the embodiment of the invention provides a kind of electronic equipment, including processor and machine readable storage medium, Above-mentioned machine readable storage medium is stored with the machine-executable instruction that can be executed by above-mentioned processor, and above-mentioned processor is above-mentioned Machine-executable instruction promotes: realizing any load-balancing method of above-mentioned second aspect.
7th aspect, the embodiment of the invention provides a kind of computer readable storage medium, above-mentioned computer-readable storage Dielectric memory contains computer program, and above-mentioned computer program realizes that any load of above-mentioned first aspect is equal when being executed by processor Weighing apparatus method.
Eighth aspect, the embodiment of the invention provides a kind of computer readable storage medium, above-mentioned computer-readable storage Dielectric memory contains computer program, and above-mentioned computer program realizes that any load of above-mentioned second aspect is equal when being executed by processor Weighing apparatus method.
9th aspect, the embodiment of the invention provides a kind of computer program products comprising instruction, when it is in computer When upper operation, so that computer executes the above-mentioned any load-balancing method of first aspect.
Tenth aspect, the embodiment of the invention provides a kind of computer program products comprising instruction, when it is in computer When upper operation, so that computer executes the above-mentioned any load-balancing method of second aspect.
Tenth on the one hand, and the embodiment of the invention provides a kind of computer programs, when run on a computer, so that Computer executes the above-mentioned any load-balancing method of first aspect.
12nd aspect, the embodiment of the invention provides a kind of computer programs, when run on a computer, so that Computer executes the above-mentioned any load-balancing method of second aspect.
Load-balancing method, device, electronic equipment and storage medium provided in an embodiment of the present invention, the above method are applied to Load-balanced server, above-mentioned load-balanced server have the corresponding back-end server of multiple tenant networks under its command;Above-mentioned tenant's net Network is virtual private cloud VPC network, and the above method includes: reception request data package, determines above-mentioned request data package request access Tenant network;Determine the corresponding back-end server of above-mentioned tenant network;According to preset load balancing rule, identified Target back-end server is chosen in back-end server;Above-mentioned request data package is packaged, package request data packet is obtained, In, above-mentioned package request data packet includes: source address and destination address, and the source address of above-mentioned package request data packet is above-mentioned negative The address of equalization server is carried, the destination address of above-mentioned package request data packet is above-mentioned target back-end server in affiliated rent Address in the network of family;Above-mentioned package request data packet is sent to above-mentioned target back-end server.It determines that request data package is corresponding to rent Family network is chosen the back-end server of the tenant network as target back-end server, request data package is packaged, by mesh Address destination address as package request data packet of the back-end server in virtual private networks VPC is marked, to realize rent The communication between the back-end server in load-balanced server and tenant network outside the network of family.Pass through a load balancing service Device realizes the load balancing of multiple tenant networks, it is possible to reduce the deployment cost of each tenant network.Certainly, implement of the invention appoint One product or method must be not necessarily required to reach all the above advantage simultaneously.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is the schematic diagram of the VPC network structure of load balancing in the prior art;
Fig. 2 is a kind of process signal of the load-balancing method applied to load-balanced server of the embodiment of the present invention Figure;
Fig. 3 is the schematic diagram of the VPC network structure of the load balancing of the embodiment of the present invention;
Fig. 4 is the flow diagram of the load-balancing method applied to back-end server of the embodiment of the present invention;
Fig. 5 is another flow diagram of the load-balancing method of the embodiment of the present invention;
Fig. 6 is the schematic diagram of the load balancing apparatus applied to load-balanced server of the embodiment of the present invention;
Fig. 7 is the schematic diagram of the load balancing apparatus applied to back-end server of the embodiment of the present invention;
Fig. 8 is the schematic diagram of the load-balanced server of the embodiment of the present invention;
Fig. 9 is the schematic diagram of the back-end server of the embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Load balancing service is an important service, and multiple servers can be made to carry out a service jointly.It is existing negative The VPC network structure of equalization methods is carried as shown in Figure 1, disposing a load-balanced server in each tenant network, each Load-balanced server in tenant network is responsible for the load balancing of each back-end server in the tenant network, but uses existing Method in technology increases the cost of load balancing, and the performance of load balancing is poor, the resource utilization of overall network It is low, poor user experience.
Therefore, referring to fig. 2, the embodiment of the invention provides a kind of load-balancing methods, are applied to load-balanced server, The load-balanced server has the corresponding back-end server of multiple tenant networks under its command, and above-mentioned tenant network is virtual private cloud VPC Network, this method comprises:
S201 receives request data package, determines the tenant network of above-mentioned request data package request access.
The VPC network structure of the load-balancing method of the embodiment of the present invention is as shown in figure 3, load-balanced server is located at respectively The outside of tenant network, a load-balanced server have multiple tenant networks under its command.When request data package arrives, load balancing System receives the request data package, and according to the mark of tenant network in request data package (the corresponding client of such as tenant network Mark, the account number of tenant network, the ID etc. of tenant network), determine the corresponding tenant of the request data package.
SiteServer LBS is the system that arbitrarily can be realized the load-balancing method of the embodiment of the present invention.Such as:
SiteServer LBS can be a kind of load-balanced server, comprising: processor, memory, communication interface and total Line;Processor, memory and communication interface are connected by bus and complete mutual communication;Memory stores executable program Code;Processor runs journey corresponding with executable program code by reading the executable program code stored in memory Sequence, for executing load-balancing method.
SiteServer LBS can also be a kind of application program, for executing load-balancing method at runtime.
SiteServer LBS can also be a kind of storage medium, and for storing executable code, executable code is for holding Row load-balancing method.
S202 determines the corresponding back-end server of above-mentioned tenant network.
In order to determine that the corresponding relationship of tenant network and back-end server, SiteServer LBS can safeguard tenant's clothes It is engaged in device list, the incidence relation of each tenant network Yu each back-end server is had recorded in tenant's server list, certainly the rent It can also include address of each back-end server in VPC network in the server list of family.SiteServer LBS can be by looking into Tenant's server list is ask, determines the corresponding each back-end server of above-mentioned tenant network.
S203 chooses target back-end server according to preset load balancing rule in identified back-end server.
For example, SiteServer LBS is according to weighted round-robin scheduling algorithm, weighted least-connection scheduling algorithm or polling dispatching Algorithm etc. chooses target back-end server in the corresponding back-end server of above-mentioned tenant.
Above-mentioned request data package is packaged by S204, obtains package request data packet, wherein above-mentioned package request number It include: source address and destination address according to packet, the source address of above-mentioned package request data packet is the ground of above-mentioned load-balanced server Location, the destination address of above-mentioned package request data packet are above-mentioned target back-end server address in affiliated tenant network.
Request data package is packaged by SiteServer LBS, such as carries out VXLAN (Virtual to request data package Extensible LAN, virtual extended local area network) encapsulation, using address of the target back-end server in VPC as package request The destination address of data packet, the source address of certain package request data packet are the address of load-balanced server.
S205, Xiang Shangshu target back-end server send above-mentioned package request data packet.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, above-mentioned load-balanced server is disposed by way of cluster.
Load-balanced server is disposed by trunking mode, facilitates the dilatation of service load balancing server, and is loaded equal In weighing apparatus server when separate unit host delay machine, the overall performance of load-balanced server is not influenced.
Optionally, after sending above-mentioned package request data packet to above-mentioned target back-end server, the above method is also wrapped It includes:
S206 receives encapsulation feedback data packet, wherein above-mentioned encapsulation feedback data packet is by above-mentioned target back-end server Feedback data packet is generated according to above-mentioned request data package, and obtained after being packaged to above-mentioned feedback data packet, above-mentioned encapsulation The source address of feedback data packet is the address of above-mentioned target back-end server, and the destination address of above-mentioned encapsulation feedback data packet is upper State the address of load-balanced server.
S207 decapsulates above-mentioned encapsulation feedback data packet and obtains above-mentioned feedback data packet, sends above-mentioned feedback data packet.
SiteServer LBS receives the encapsulation feedback data packet sent by back-end server, decapsulates the encapsulation feedback data Packet, obtains and sends feedback data packet.Feedback data packet is finally returned to visitor by the forwarding of other network equipments such as router Family end.
In embodiments of the present invention, it receives and decapsulates feedback data packet, it is ensured that obtained feedback data packet can be in VPC Normal transmission in external network ensure that client can normally receive feedback data packet.
Optionally, before determining the corresponding back-end server of above-mentioned tenant network, the above method further include:
S2010 chooses at least one back-end server and is added in tenant's server list according to default addition rule, And at least one selected back-end server is associated with above-mentioned tenant network in above-mentioned tenant's server list.
Correspondingly, the corresponding back-end server of the above-mentioned above-mentioned tenant network of determination includes:
Above-mentioned tenant's server list is inquired, by the associated back-end server of above-mentioned tenant network, as above-mentioned tenant's net The corresponding back-end server of network.
The pass of each tenant network Yu each back-end server is had recorded in tenant's server list of SiteServer LBS maintenance Connection relationship records and which back-end server is respectively contained in each tenant network.SiteServer LBS passes through inquiry tenant's clothes Business device list, can quickly determine the corresponding each back-end server of above-mentioned tenant network.Optionally, in tenant's server list also It may include address of each back-end server in VPC network, for example, as shown in table 1.
Table 1
After SiteServer LBS receives request data package, judge that the corresponding tenant network of the data packet meets default add When adding rule, chooses one or more back-end servers and be added in the tenant network.Default addition rule is arbitrarily in tenant The rule that back-end server is added in network, for example, identifying the information of the corresponding tenant network of dilatation in request data package;Or phase The specified numerical value for answering each back-end server in tenant network is more than preset upper limit, for example, each rear end clothes in corresponding tenant network The present load of business device is overloaded;Or the number of request distributed and not yet returned in each back-end server in corresponding tenant network Quantity according to packet is more than default value etc..
For example, for the tenant network B in table 1, the request data that corresponding back-end server RS4 and RS5 is not returned The quantity of packet is more than default value (for example, 10,50,100 or bigger).SiteServer LBS chooses an idle rear end Server RS8 is added in the network of tenant network B, as shown in table 2:
Table 2
In embodiments of the present invention, addition back-end server is realized into the corresponding network of tenant to entire VPC network Load balancing, the effect of load balancing is more preferable, and entire VPC resources in network utilization rate is high, and user experience is good.
Optionally, the default addition rule of above-mentioned basis chooses at least one back-end server and is added to tenant's server column In table, comprising:
S2011 obtains the present load of the corresponding each back-end server of above-mentioned tenant network.
SiteServer LBS obtains the present load of each back-end server, can be SiteServer LBS to above-mentioned tenant's net The corresponding each back-end server of network sends load query instruction, so that each back-end server returns respectively according to load query instruction Present load.Each back-end server periodically can also report respective present load, load balancing to SiteServer LBS The present load that system reports each back-end server records, and keeps the present load for updating each back-end server, needs It is directly read when use.
S2012 chooses the back-end server that present load meets default loading rule, as target back-end server.
Default loading rule is any rule that back-end server is chosen according to load.For example, can be current negative to choose Carry the smallest back-end server;Or choose any present load be less than default load threshold (default load threshold is any number, For example, 90%, 80%, 70%, 60% or smaller) back-end server etc..
In embodiments of the present invention, according to the present load of the corresponding each back-end server of tenant, target rear end clothes are chosen The load distribution of business device, each back-end server is more reasonable, and resource utilization is higher.
Optionally, increase corresponding system in the kernel of above-mentioned load-balanced server to call, above-mentioned corresponding system It calls for calling pre-set programs, is realized when calling above-mentioned pre-set programs any of the above-described applied to the negative of load-balanced server Carry equalization methods.
Increase system corresponding with pre-set programs in the kernel of load-balanced server to call, system is called for calling Corresponding pre-set programs (being referred to as kernel function) in kernel, pre-set programs can be realized any of the above-described answer at runtime Load-balancing method for load-balanced server.
HAProxy can be used during carrying out load balancing, and (a kind of open-source software, provides load balancing Application Agent) etc. application programs, if but sending data to different VPC tenant network using such application program When, it is necessary to switch namespace (NameSpace), the very performance of depletion load equalization server.And implement in the present invention In example, increase system corresponding with pre-set programs in the kernel of load-balanced server and call, sends number to each tenant network According to when, do not have to switching namespace, saved the performance of load-balanced server.
In embodiments of the present invention, it is called, can be saved negative by adding corresponding system in load-balanced server The performance for carrying equalization server, improves the efficiency of load balancing, is suitble to use in actual application environment.
Referring to fig. 4, the embodiment of the invention provides a kind of load-balancing methods, are applied to back-end server, above-mentioned rear end Server is the back-end server in the corresponding tenant network in virtual private cloud VPC network, and multiple tenant networks share one Load-balanced server, this method comprises:
S401 receives package request data packet, wherein above-mentioned package request data packet is by load-balanced server to asking It obtains after asking data packet to be packaged and sends;Above-mentioned package request data packet includes source address and destination address, above-mentioned envelope The source address for filling request data package is the address of above-mentioned load-balanced server, and the destination address of above-mentioned package request data packet is Above-mentioned back-end server address in affiliated tenant network.
S402 decapsulates above-mentioned package request data packet, obtains above-mentioned request data package.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, above-mentioned package request data packet is being decapsulated, after obtaining above-mentioned request data package, the above method is also wrapped It includes:
S403 executes the service requested in above-mentioned request data package by the virtual machine in above-mentioned back-end server.
Virtual machine in back-end server can be established in advance, or be established according to request data package, benefit Request data package is handled with virtual machine, and the processing result of request data package is generated into feedback data packet, thus to rent Family provides corresponding service.In embodiments of the present invention, request data package, data are handled by the virtual machine in back-end server What is handled is high-efficient.
Optionally, by the virtual machine in above-mentioned back-end server execute the service requested in above-mentioned request data package it Afterwards, the above method further include:
S404 obtains feedback data packet, wherein above-mentioned feedback data packet is that above-mentioned virtual machine executes above-mentioned request data package The data packet generated after the service of middle request.
The destination address of feedback data packet can be to send the client of request data package corresponding with the feedback data packet Address, to ensure that feedback data packet can return to the client.
S405 encapsulates above-mentioned feedback data packet, obtains encapsulation feedback data packet, wherein above-mentioned encapsulation feedback data packet Source address is address of the above-mentioned back-end server in VPC, and the destination address of above-mentioned encapsulation feedback data packet is that above-mentioned load is equal The address of weighing apparatus server.
Feedback data packet is packaged, using the address of load-balanced server as the destination of encapsulation feedback data packet Location, to ensure to encapsulate the transmission target of feedback data packet.
S406, Xiang Shangshu load-balanced server send above-mentioned encapsulation feedback data packet.
In embodiments of the present invention, feedback data packet is packaged, using the address of load-balanced server as encapsulation The destination address of feedback data packet can guarantee for package request data packet to be sent in load-balanced server.
Optionally, the side of the above-mentioned load balancing applied to back-end server further include:
S4011 records the source address of above-mentioned package request data packet.
The source address for recording package request data packet facilitates subsequent to load-balanced server transmission package request data Packet.Optionally, the source interface and purpose of the source address and destination address and request data package that can also record request data package connect Mouthful, to facilitate the transmission path of subsequent determining feedback data packet.
Correspondingly, by the virtual machine in above-mentioned back-end server execute the service requested in above-mentioned request data package it Afterwards, the above method further include:
S404 obtains feedback data packet, wherein above-mentioned feedback data packet is that above-mentioned virtual machine executes above-mentioned request data package The data packet generated after the service of middle request.
S4041 is inquired in above-mentioned back-end server and whether is preserved the corresponding package request data of above-mentioned feedback data packet The source address of packet.
S4042 does not save the corresponding package request data packet of above-mentioned feedback data packet in above-mentioned back-end server When source address, above-mentioned feedback data packet is abandoned.
In embodiments of the present invention, the feedback data packet without storing return path information is abandoned, with preventing generation error The feedback data packet of location, guarantees the accuracy of data transmission, and user experience is good.
Referring to Fig. 5, Fig. 5 is another flow diagram of the load-balancing method of the embodiment of the present invention, comprising:
S501, load-balanced server receive request data package, the corresponding tenant network of the request data package are determined, at this Target back-end server is chosen in tenant network, using the address of target back-end server as the mesh of the request data package after encapsulation Address, and send encapsulation after request data package.
When request data package arrives, load-balanced server receives the request data package, and according in the request data package Correlated identities determine the corresponding tenant network of the request data package;Load-balanced server is advised according to preset load balancing Then, a back-end server is chosen in the corresponding each back-end server of above-mentioned tenant network, as target back-end server;It is negative It carries equalization server and sends data packet to the target back-end server, which can be trapped before sending, then carry out The encapsulation of VXLAN obtains package request data packet, and the destination address of the package request data packet is that target back-end server exists Actual physical address in VPC network, the source address of the package request data packet are the address of load-balanced server.Load is equal The server that weighs sends above-mentioned package request data packet, and such data packet advances in the back-end server of different tenants.
S502, target back-end server receives the request data package after encapsulation, and is decapsulated, by the number after decapsulation According to the virtual machine being transferred in the target back-end server, and record routing information relevant to request data package.
Target back-end server really receives the number of request of the VXLAN encapsulation sended over by load-balanced server According to packet.Target back-end server will record routing information relevant to request data package, for example, the request data package after encapsulation Source address can also record the TCP (Transmission Control Protocol, transmission control protocol) in VXLAN encapsulation Information, the source address and destination address of request data package, the source interface and purpose interface of request data package.Target back-end server The head encapsulated VXLAN is peeled off, virtual machine initial data being sent in itself.
S503, target back-end server handle request data package, and processing result is generated feedback data packet, and search with it is upper State the relevant routing information of request data package;When not including routing information relevant to above-mentioned request data package, then it is anti-to abandon this Present data packet;When finding routing information relevant to above-mentioned request data package, according to the routing information to feedback data packet It is packaged, and sends the feedback data packet after encapsulation.
Target back-end server handles the data in request data package by the virtual machine in itself, and by request data package Processing result generate feedback data packet.Each routing information that target back-end server records before searching records before judgement Each routing information in, if include the relevant routing information of request data package corresponding to the feedback data packet.
If not including the relevant routing information of request data package corresponding to the feedback data packet, the feedback data is abandoned Packet.
If comprising the relevant routing information of request data package corresponding to the feedback data packet, according to the path found Information carries out VXLAN encapsulation to feedback data packet, and such feedback data packet can pass through the boundary of the VPC network of the tenant And reach load-balanced server.The source address of feedback data packet after encapsulation is the address of target back-end server;After encapsulation Feedback data packet destination address be the request data package after being encapsulated in the routing information that finds source address, i.e. load is equal The address of weighing apparatus server.
S504, load-balanced server receive the feedback data packet after encapsulation, are decapsulated, obtain and send feedback coefficient According to packet.
Load-balanced server decapsulates the VXLAN received the data packet encapsulated, to obtain original anti- Packet information is presented, feedback data packet is normally handled later, feedback data packet is sent to tenant.
In embodiments of the present invention, the rear end clothes in the load-balanced server and tenant network outside tenant network are realized Communication between business device, by a load-balanced server, the tenant to be distributed in different VPC networks provides load balancing clothes Business, it is possible to reduce the deployment cost of each tenant network.The effect of load balancing is more preferable, and entire VPC resources in network utilization rate is high, User experience is good.
Referring to Fig. 6, the embodiment of the invention provides a kind of load balancing apparatus, are applied to load-balanced server, above-mentioned Load-balanced server has the corresponding back-end server of multiple tenant networks under its command, and above-mentioned apparatus includes:
Tenant's determining module 601 determines tenant's net of above-mentioned request data package request access for receiving request data package Network;
Back-end server determining module 602, for determining the corresponding back-end server of above-mentioned tenant network;
Destination server determining module 603, for regular according to preset load balancing, in identified back-end server Middle selection target back-end server;
Request data package package module 604 obtains package request data for above-mentioned request data package to be packaged Packet, wherein above-mentioned package request data packet includes: source address and destination address, and the source address of above-mentioned package request data packet is The address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet are above-mentioned target back-end server in institute Address in the tenant network of category;
Package request packet sending module 605, for sending above-mentioned package request number to above-mentioned target back-end server According to packet.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, the above-mentioned middle load balancing apparatus applied to load-balanced server further include:
Feedback data packet receiving module is encapsulated, for receiving encapsulation feedback data packet, wherein above-mentioned encapsulation feedback data packet It is feedback data packet to be generated according to above-mentioned request data package by above-mentioned target back-end server, and carry out to above-mentioned feedback data packet It is obtained after encapsulation, the source address of above-mentioned encapsulation feedback data packet is the address of above-mentioned target back-end server, and above-mentioned encapsulation is anti- The destination address for presenting data packet is the address of above-mentioned load-balanced server;
Feedback data packet decapsulation module is encapsulated, obtains above-mentioned feedback data for decapsulating above-mentioned encapsulation feedback data packet Packet, sends above-mentioned feedback data packet.
In embodiments of the present invention, it receives and decapsulates feedback data packet, it is ensured that obtained feedback data packet can be in VPC Normal transmission in external network ensure that client can normally receive feedback data packet.
Optionally, the above-mentioned load balancing apparatus applied to load-balanced server further include:
Server adding module, for choosing at least one back-end server and being added to tenant according to default addition rule In server list, and to selected at least one back-end server and above-mentioned tenant's net in above-mentioned tenant's server list Network is associated;
Correspondingly, above-mentioned back-end server determining module is specifically used for:
Above-mentioned tenant's server list is inquired, by the associated back-end server of above-mentioned tenant network, as above-mentioned tenant's net The corresponding back-end server of network.
In embodiments of the present invention, addition back-end server is realized into the corresponding network of tenant to entire VPC network Load balancing, the effect of load balancing is more preferable, and entire VPC resources in network utilization rate is high, and user experience is good.
Optionally, increase corresponding system in the kernel of above-mentioned load-balanced server to call, above-mentioned corresponding system It calls for calling any of the above-described load balancing apparatus applied to load-balanced server.
Increase related system in the embodiment of the present invention in the kernel of load-balanced server to call, be called by system real Load-balancing method in existing above-mentioned VPC network, can save system performance, improve the efficiency of load balancing.
Referring to Fig. 7, the embodiment of the invention provides a kind of load balancing apparatus, are applied to back-end server, above-mentioned rear end Server is the back-end server in the corresponding tenant network in virtual private cloud VPC network, and multiple tenant networks share one Load-balanced server, above-mentioned apparatus include:
Package request packet-receiving module 701, for receiving package request data packet, wherein above-mentioned package request number It according to packet is obtained and sends after being packaged by load-balanced server to request data package;Above-mentioned package request data packet packet Source address and destination address are included, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned back-end server address in affiliated tenant network;
Package request data packet decapsulation module 702 obtains above-mentioned request for decapsulating above-mentioned package request data packet Data packet.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, the above-mentioned load balancing apparatus applied to back-end server further include:
Service execution module is requested for being executed in above-mentioned request data package by the virtual machine in above-mentioned back-end server Service.
In embodiments of the present invention, request data package, the effect of data processing are handled by the virtual machine in back-end server Rate is high.
Optionally, the above-mentioned load balancing apparatus applied to back-end server further include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein above-mentioned feedback data packet is above-mentioned virtual machine Execute the data packet generated after the service requested in above-mentioned request data package;
Feedback data packet package module obtains encapsulation feedback data packet for encapsulating above-mentioned feedback data packet, wherein on The source address for stating encapsulation feedback data packet is address of the above-mentioned back-end server in VPC, the mesh of above-mentioned encapsulation feedback data packet Address be above-mentioned load-balanced server address;
Feedback data packet sending module is encapsulated, for sending above-mentioned encapsulation feedback data to above-mentioned load-balanced server Packet.
In embodiments of the present invention, feedback data packet is packaged, using the address of load-balanced server as encapsulation The destination address of feedback data packet can guarantee for package request data packet to be sent in load-balanced server.
Optionally, the above-mentioned load balancing apparatus applied to back-end server further include:
Path logging modle, for recording the source address of above-mentioned package request data packet;
Correspondingly, above-mentioned apparatus further include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein above-mentioned feedback data packet is above-mentioned virtual machine Execute the data packet generated after the service requested in above-mentioned request data package;
Whether path query module preserves the corresponding envelope of above-mentioned feedback data packet for inquiring in above-mentioned back-end server Fill the source address of request data package;
Data packet discarding module saves the corresponding encapsulation of above-mentioned feedback data packet for no in above-mentioned back-end server When the source address of request data package, above-mentioned feedback data packet is abandoned.
In embodiments of the present invention, the feedback data packet without storing return path information is abandoned, with preventing generation error The feedback data packet of location, guarantees the accuracy of data transmission, and user experience is good.
The embodiment of the invention also provides a kind of electronic equipment, including processor and machine readable storage medium, above-mentioned machines Device readable storage medium storing program for executing is stored with the machine-executable instruction that can be executed by above-mentioned processor, and above-mentioned processor can by above-mentioned machine It executes instruction and promotes to realize following steps:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, it can also be realized when above-mentioned processor is promoted by above-mentioned machine-executable instruction above-mentioned equal applied to load The arbitrary steps of the middle load-balancing method of weighing apparatus server.
Optionally, the electronic equipment of the embodiment of the present invention is load-balanced server, and above-mentioned load-balanced server has under its command The corresponding back-end server of multiple tenant networks, above-mentioned tenant network are virtual private cloud VPC network, specific as shown in figure 8, packet Include processor 801, communication interface 802, memory 803 and communication bus 804, wherein processor 801, communication interface 802 are deposited Reservoir 803 completes mutual communication by communication bus 804;
Memory 803, for storing computer program;
Processor 801 when for executing the program stored on memory 803, realizes following steps:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, it when processor 801 executes the program stored on memory 803, can also realize above-mentioned applied to negative Carry the arbitrary steps of the load-balancing method of equalization server.
The embodiment of the invention also provides a kind of electronic equipment, including processor and machine readable storage medium, above-mentioned machines Device readable storage medium storing program for executing is stored with the machine-executable instruction that can be executed by above-mentioned processor, and above-mentioned processor can by above-mentioned machine It executes instruction and promotes to realize following steps:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;Above-mentioned load-balanced server has the corresponding rear end of multiple tenant networks under its command Server;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, it can also realize that the above-mentioned rear end that is applied to takes when above-mentioned processor is promoted by above-mentioned machine-executable instruction The arbitrary steps of the load-balancing method of business device.
Optionally, the electronic equipment of the embodiment of the present invention is back-end server, and above-mentioned back-end server is virtual private cloud The back-end server in corresponding tenant network in VPC network, multiple tenant networks share a load-balanced server, specifically As shown in figure 9, including processor 901, communication interface 902, memory 903 and communication bus 904, wherein processor 901 leads to Believe that interface 902, memory 903 complete mutual communication by communication bus 904,
Memory 903, for storing computer program;
Processor 901 when for executing the program stored on memory 903, realizes following steps:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;Above-mentioned load-balanced server has the corresponding rear end of multiple tenant networks under its command Server;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, it when processor executes the program stored on memory, can also realize above-mentioned applied to load balancing The arbitrary steps of the load-balancing method of server.
The communication bus that above-mentioned load-balanced server/back-end server is mentioned can be Peripheral Component Interconnect standard (Peripheral Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard Architecture, EISA) bus etc..It is total that the communication bus can be divided into address bus, data Line, control bus etc..Only to be indicated with a thick line in figure, it is not intended that an only bus or a type convenient for indicating The bus of type.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete Door or transistor logic, discrete hardware components.
The embodiment of the invention provides a kind of computer readable storage medium, storage in above-mentioned computer readable storage medium There is computer program, above-mentioned computer program realizes following steps when being executed by processor:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, it when above-mentioned computer program is executed by processor, can also realize above-mentioned applied to load balancing service The arbitrary steps of the load-balancing method of device.
The embodiment of the invention provides a kind of computer readable storage medium, storage in above-mentioned computer readable storage medium There is computer program, above-mentioned computer program realizes following steps when being executed by processor:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;Above-mentioned load-balanced server has the corresponding rear end of multiple tenant networks under its command Server;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, it when above-mentioned computer program is executed by processor, can also realize above-mentioned applied to back-end server The arbitrary steps of load-balancing method.
The embodiment of the invention provides a kind of computer program products comprising instruction, when run on a computer, So that computer executes following steps:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, when above-mentioned computer program product is run on computers, it is also possible that computer executes above-mentioned answer The arbitrary steps of load-balancing method for load-balanced server.
The embodiment of the invention provides a kind of computer program products comprising instruction, when run on a computer, So that computer executes following steps:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;Above-mentioned load-balanced server has the corresponding rear end of multiple tenant networks under its command Server;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, when above-mentioned computer program product is run on computers, it is also possible that computer executes above-mentioned answer The arbitrary steps of load-balancing method for back-end server.
The embodiment of the invention provides a kind of computer programs, when run on a computer, so that computer executes Following steps:
Request data package is received, determines the tenant network of above-mentioned request data package request access;
Determine the corresponding back-end server of above-mentioned tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
Above-mentioned request data package is packaged, package request data packet is obtained, wherein above-mentioned package request data packet packet Include: source address and destination address, the source address of above-mentioned package request data packet is the address of above-mentioned load-balanced server, above-mentioned The destination address of package request data packet is above-mentioned target back-end server address in affiliated tenant network;
Above-mentioned package request data packet is sent to above-mentioned target back-end server.
In embodiments of the present invention, it determines the corresponding tenant of request data package, chooses the back-end server conduct of the tenant Target back-end server can be realized a load-balanced server while serve multiple tenant networks;By request data package It is packaged, using address of the target back-end server in VPC network as the destination address of package request data packet, thus real The communication between the back-end server in load-balanced server and tenant network outside existing tenant network.Pass through a load balancing Server, the tenant to be distributed in different VPC networks provide load balancing service, realize a load-balanced server to more The load balancing of a tenant network, it is possible to reduce the deployment cost of each tenant network.
Optionally, when above-mentioned computer program is run on computers, it is also possible that computer executes above-mentioned be applied to The arbitrary steps of the load-balancing method of load-balanced server.
The embodiment of the invention provides a kind of computer programs, when run on a computer, so that computer executes Following steps:
Receive package request data packet, wherein above-mentioned package request data packet is by load-balanced server to number of request It obtains and sends after being packaged according to packet;Above-mentioned package request data packet includes source address and destination address, and above-mentioned encapsulation is asked Ask the source address of data packet for the address of above-mentioned load-balanced server, the destination address of above-mentioned package request data packet is above-mentioned Back-end server address in affiliated tenant network;Above-mentioned load-balanced server has the corresponding rear end of multiple tenant networks under its command Server;
Above-mentioned package request data packet is decapsulated, above-mentioned request data package is obtained.
In embodiments of the present invention, package request data packet is decapsulated, to obtain request data package, is taken for rear end Business device processing request data package provides premise.
Optionally, when above-mentioned computer program is run on computers, it is also possible that computer executes above-mentioned be applied to The arbitrary steps of the load-balancing method of back-end server.
For load-balanced server/back-end server/computer readable storage medium/computer program product/calculating For the embodiment of machine program, since it is substantially similar to method, so being described relatively simple, related place is referring to method reality Apply the part explanation of example.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (20)

1. a kind of load-balancing method, which is characterized in that be applied to load-balanced server, the load-balanced server has under its command The corresponding back-end server of multiple tenant networks, the tenant network are virtual private cloud VPC network, which comprises
Request data package is received, determines the tenant network of the request data package request access;
Determine the corresponding back-end server of the tenant network;
According to preset load balancing rule, target back-end server is chosen in identified back-end server;
The request data package is packaged, package request data packet is obtained, wherein the package request data packet includes: Source address and destination address, the source address of the package request data packet are the address of the load-balanced server, the envelope The destination address for filling request data package is address of the target back-end server in affiliated tenant network;
The package request data packet is sent to the target back-end server.
2. the method according to claim 1, wherein sending the envelope to the target back-end server described After filling request data package, the method also includes:
Receive encapsulation feedback data packet, wherein the encapsulation feedback data packet be as the target back-end server according to Request data package generates feedback data packet, and obtained after being packaged to the feedback data packet, the encapsulation feedback data The source address of packet is the address of the target back-end server, and the destination address of the encapsulation feedback data packet is that the load is equal The address of weighing apparatus server;
It decapsulates the encapsulation feedback data packet and obtains the feedback data packet, send the feedback data packet.
3. the method according to claim 1, wherein determine the corresponding back-end server of the tenant network it Before, the method also includes:
According to default addition rule, chooses at least one back-end server and be added in tenant's server list, and in the rent At least one selected back-end server is associated with the tenant network in the server list of family;
Correspondingly, the corresponding back-end server of the determination tenant network includes:
Tenant's server list is inquired, by the associated back-end server of the tenant network, as the tenant network pair The back-end server answered.
4. method according to claim 1-3, which is characterized in that in the kernel of the load-balanced server Increase corresponding system to call, corresponding system is called for calling pre-set programs, real when calling the pre-set programs Any one of existing described claim 1-3.
5. a kind of load-balancing method, which is characterized in that be applied to back-end server, the back-end server is virtual private cloud The back-end server in corresponding tenant network in VPC network, multiple tenant networks share a load-balanced server, described Method includes:
Receive package request data packet, wherein the package request data packet is by load-balanced server to request data package It obtains after being packaged and sends;The package request data packet includes source address and destination address, the package request number Source address according to packet is the address of the load-balanced server, and the destination address of the package request data packet is the rear end Address of the server in affiliated tenant network;
The package request data packet is decapsulated, the request data package is obtained.
6. according to the method described in claim 5, it is characterized in that, being obtained in the decapsulation package request data packet After the request data package, the method also includes:
The service requested in the request data package is executed by the virtual machine in the back-end server.
7. according to the method described in claim 6, it is characterized in that, being held in the virtual machine by the back-end server After the service requested in the row request data package, the method also includes:
Obtain feedback data packet, wherein the feedback data packet is that the virtual machine is executed and requested in the request data package The data packet generated after service;
The feedback data packet is encapsulated, encapsulation feedback data packet is obtained, wherein the source address of the encapsulation feedback data packet is institute Address of the back-end server in affiliated tenant network is stated, the destination address of the encapsulation feedback data packet is that the load is equal The address of weighing apparatus server;
The encapsulation feedback data packet is sent to the load-balanced server.
8. according to the method described in claim 6, it is characterized in that, the method also includes:
Record the source address of the package request data packet;
Correspondingly, the virtual machine by the back-end server execute the service requested in the request data package it Afterwards, the method also includes:
Obtain feedback data packet, wherein the feedback data packet is that the virtual machine is executed and requested in the request data package The data packet generated after service;
It inquires in the back-end server and whether preserves the source address of the corresponding package request data packet of the feedback data packet;
When not saving the source address of the corresponding package request data packet of the feedback data packet in the back-end server, lose Abandon the feedback data packet.
9. a kind of load balancing apparatus, which is characterized in that be applied to load-balanced server, the load-balanced server has under its command The corresponding back-end server of multiple tenant networks, the tenant network are virtual private cloud VPC network, and described device includes:
Tenant's determining module determines the tenant network of the request data package request access for receiving request data package;
Back-end server determining module, for determining the corresponding back-end server of the tenant network;
Destination server determining module, for being chosen in identified back-end server according to preset load balancing rule Target back-end server;
Request data package package module obtains package request data packet for the request data package to be packaged, wherein The package request data packet includes: source address and destination address, and the source address of the package request data packet is the load The address of equalization server, the destination address of the package request data packet are the target back-end server in affiliated tenant Address in network;
Package request packet sending module, for sending the package request data packet to the target back-end server.
10. device according to claim 9, which is characterized in that described device further include:
Encapsulate feedback data packet receiving module, for receive encapsulation feedback data packet, wherein the encapsulation feedback data packet be by The target back-end server generates feedback data packet according to the request data package, and is packaged to the feedback data packet It obtains afterwards, the source address of the encapsulation feedback data packet is the address of the target back-end server, the encapsulation feedback coefficient Destination address according to packet is the address of the load-balanced server;
Feedback data packet decapsulation module is encapsulated, obtains the feedback data packet for decapsulating the encapsulation feedback data packet, Send the feedback data packet.
11. device according to claim 9, which is characterized in that described device further include:
Server adding module, for choosing at least one back-end server and being added to tenant's service according to default addition rule In device list, and in tenant's server list to selected at least one back-end server and the tenant network into Row association;
Correspondingly, the back-end server determining module is specifically used for:
Tenant's server list is inquired, by the associated back-end server of the tenant network, as the tenant network pair The back-end server answered.
12. according to the described in any item devices of claim 9-11, which is characterized in that in the kernel of the load-balanced server Middle to increase corresponding system calling, corresponding system is called for calling any dress in the claim 9-11 It sets.
13. a kind of load balancing apparatus, which is characterized in that be applied to back-end server, the back-end server is virtual privately owned The back-end server in corresponding tenant network in cloud VPC network, multiple tenant networks share a load-balanced server, institute Stating device includes:
Package request packet-receiving module, for receiving package request data packet, wherein the package request data packet be by What load-balanced server was obtained and was sent after being packaged to request data package;The package request data packet includes source address And destination address, the source address of the package request data packet are the address of the load-balanced server, the package request The destination address of data packet is back-end server address in affiliated tenant network;
Package request data packet decapsulation module obtains the request data package for decapsulating the package request data packet.
14. device according to claim 13, which is characterized in that described device further include:
Service execution module, for executing the clothes requested in the request data package by the virtual machine in the back-end server Business.
15. device according to claim 14, which is characterized in that described device further include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein the feedback data packet is that the virtual machine executes The data packet generated after the service requested in the request data package;
Feedback data packet package module obtains encapsulation feedback data packet, wherein the envelope for encapsulating the feedback data packet The source address for filling feedback data packet is address of the back-end server in affiliated tenant network, the encapsulation feedback data The destination address of packet is the address of the load-balanced server;
Feedback data packet sending module is encapsulated, for sending the encapsulation feedback data packet to the load-balanced server.
16. according to the method for claim 14, which is characterized in that described device further include:
Path logging modle, for recording the source address of the package request data packet;
Correspondingly, described device further include:
Feedback data packet obtains module, for obtaining feedback data packet, wherein the feedback data packet is that the virtual machine executes The data packet generated after the service requested in the request data package;
Whether path query module is preserved the corresponding encapsulation of the feedback data packet and is asked for inquiring in the back-end server Seek the source address of data packet;
Data packet discarding module saves the corresponding package request of the feedback data packet for no in the back-end server When the source address of data packet, the feedback data packet is abandoned.
17. a kind of electronic equipment, which is characterized in that including processor and machine readable storage medium, the machine readable storage Media storage has the machine-executable instruction that can be executed by the processor, and the processor is promoted by the machine-executable instruction Make: realizing any method and step of claim 1-4.
18. a kind of electronic equipment, which is characterized in that including processor and machine readable storage medium, the machine readable storage Media storage has the machine-executable instruction that can be executed by the processor, and the processor is promoted by the machine-executable instruction Make: realizing any method and step of claim 5-8.
19. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program realizes claim 1-4 any method and step when the computer program is executed by processor.
20. a kind of computer readable storage medium, which is characterized in that be stored with computer in the computer readable storage medium Program realizes claim 5-8 any method and step when the computer program is executed by processor.
CN201711180468.3A 2017-11-23 2017-11-23 Load-balancing method, device, electronic equipment and storage medium Pending CN109831468A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711180468.3A CN109831468A (en) 2017-11-23 2017-11-23 Load-balancing method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711180468.3A CN109831468A (en) 2017-11-23 2017-11-23 Load-balancing method, device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109831468A true CN109831468A (en) 2019-05-31

Family

ID=66859297

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711180468.3A Pending CN109831468A (en) 2017-11-23 2017-11-23 Load-balancing method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109831468A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110417921A (en) * 2019-09-06 2019-11-05 广州华多网络科技有限公司 A kind of method and load balancing service device of load balancing
CN110691139A (en) * 2019-10-11 2020-01-14 北京字节跳动网络技术有限公司 Data transmission method, device, equipment and storage medium
CN110727499A (en) * 2019-09-18 2020-01-24 平安科技(深圳)有限公司 Resource data acquisition method and device, computer equipment and storage medium
CN111314461A (en) * 2020-02-14 2020-06-19 北京百度网讯科技有限公司 IP mounting and data processing method and device
CN111371685A (en) * 2020-02-28 2020-07-03 北京百度网讯科技有限公司 Data processing and IPv6 mounting method and device
CN112788072A (en) * 2019-11-01 2021-05-11 阿里巴巴集团控股有限公司 Data processing method, data processing system, computer device, and storage medium
CN112995247A (en) * 2019-12-12 2021-06-18 阿里巴巴集团控股有限公司 Method, device and system for transmitting or processing data
CN113098728A (en) * 2019-12-23 2021-07-09 华为技术有限公司 Health check method of load balancing system and related equipment
CN114125025A (en) * 2021-11-23 2022-03-01 北京奥星贝斯科技有限公司 Data transmission method and device under multi-target network
CN114257505A (en) * 2021-12-20 2022-03-29 建信金融科技有限责任公司 Server node configuration method, device, equipment and storage medium
CN117714452A (en) * 2023-12-14 2024-03-15 摩尔线程智能科技(北京)有限责任公司 Traffic load balancing method, system and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130336164A1 (en) * 2012-06-15 2013-12-19 Cisco Technology, Inc. System and method for virtual portchannel load balancing in a trill network
CN104780115A (en) * 2014-01-14 2015-07-15 上海盛大网络发展有限公司 Load balancing method and load balancing system in cloud computing environment
CN106686085A (en) * 2016-12-29 2017-05-17 华为技术有限公司 Load balancing method, apparatus and system
CN106998284A (en) * 2016-01-25 2017-08-01 阿里巴巴集团控股有限公司 The network system and method for private network are connected by virtual private networks
CN107086966A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of load balancing of network, control and network interaction method and device
CN107317792A (en) * 2016-03-30 2017-11-03 阿里巴巴集团控股有限公司 A kind of method and apparatus for realizing access control in virtual proprietary network

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130336164A1 (en) * 2012-06-15 2013-12-19 Cisco Technology, Inc. System and method for virtual portchannel load balancing in a trill network
CN104780115A (en) * 2014-01-14 2015-07-15 上海盛大网络发展有限公司 Load balancing method and load balancing system in cloud computing environment
CN106998284A (en) * 2016-01-25 2017-08-01 阿里巴巴集团控股有限公司 The network system and method for private network are connected by virtual private networks
CN107086966A (en) * 2016-02-16 2017-08-22 阿里巴巴集团控股有限公司 A kind of load balancing of network, control and network interaction method and device
CN107317792A (en) * 2016-03-30 2017-11-03 阿里巴巴集团控股有限公司 A kind of method and apparatus for realizing access control in virtual proprietary network
CN106686085A (en) * 2016-12-29 2017-05-17 华为技术有限公司 Load balancing method, apparatus and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
蔡云龙: "《基于Docker的家庭私有云系统的设计》", 《万方在线期刊》 *

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110417921B (en) * 2019-09-06 2020-11-06 广州华多网络科技有限公司 Load balancing method and load balancing service device
CN110417921A (en) * 2019-09-06 2019-11-05 广州华多网络科技有限公司 A kind of method and load balancing service device of load balancing
CN110727499A (en) * 2019-09-18 2020-01-24 平安科技(深圳)有限公司 Resource data acquisition method and device, computer equipment and storage medium
CN110727499B (en) * 2019-09-18 2024-05-28 平安科技(深圳)有限公司 Method, device, computer equipment and storage medium for acquiring resource data
WO2021051880A1 (en) * 2019-09-18 2021-03-25 平安科技(深圳)有限公司 Resource data acquisition method and apparatus, computer device and storage medium
CN110691139A (en) * 2019-10-11 2020-01-14 北京字节跳动网络技术有限公司 Data transmission method, device, equipment and storage medium
CN110691139B (en) * 2019-10-11 2022-07-15 北京字节跳动网络技术有限公司 Data transmission method, device, equipment and storage medium
CN112788072A (en) * 2019-11-01 2021-05-11 阿里巴巴集团控股有限公司 Data processing method, data processing system, computer device, and storage medium
CN112995247A (en) * 2019-12-12 2021-06-18 阿里巴巴集团控股有限公司 Method, device and system for transmitting or processing data
CN112995247B (en) * 2019-12-12 2024-05-31 阿里巴巴集团控股有限公司 Method, device and system for transmitting or processing data
CN113098728B (en) * 2019-12-23 2023-12-19 华为云计算技术有限公司 Health check method of load balancing system and related equipment
CN113098728A (en) * 2019-12-23 2021-07-09 华为技术有限公司 Health check method of load balancing system and related equipment
CN111314461B (en) * 2020-02-14 2022-05-17 北京百度网讯科技有限公司 IP mounting and data processing method and device
CN111314461A (en) * 2020-02-14 2020-06-19 北京百度网讯科技有限公司 IP mounting and data processing method and device
CN111371685B (en) * 2020-02-28 2022-06-17 北京百度网讯科技有限公司 Data processing and IPv6 mounting method and device
CN111371685A (en) * 2020-02-28 2020-07-03 北京百度网讯科技有限公司 Data processing and IPv6 mounting method and device
CN114125025A (en) * 2021-11-23 2022-03-01 北京奥星贝斯科技有限公司 Data transmission method and device under multi-target network
CN114125025B (en) * 2021-11-23 2024-02-13 北京奥星贝斯科技有限公司 Data transmission method and device under multi-target network
CN114257505B (en) * 2021-12-20 2023-06-30 建信金融科技有限责任公司 Server node configuration method, device, equipment and storage medium
CN114257505A (en) * 2021-12-20 2022-03-29 建信金融科技有限责任公司 Server node configuration method, device, equipment and storage medium
CN117714452A (en) * 2023-12-14 2024-03-15 摩尔线程智能科技(北京)有限责任公司 Traffic load balancing method, system and device

Similar Documents

Publication Publication Date Title
CN109831468A (en) Load-balancing method, device, electronic equipment and storage medium
WO2020052605A1 (en) Network slice selection method and device
US20220210035A1 (en) Systems and methods for performing end-to-end link-layer and ip-layer health checks between a host machine and a network virtualization device
US11240155B2 (en) Technologies for network device load balancers for accelerated functions as a service
CN105531970B (en) Method and system for the load that maps out the work in a network
CN113326228B (en) Message forwarding method, device and equipment based on remote direct data storage
CN105610632B (en) Virtual network equipment and related method
CN107317887B (en) A kind of load-balancing method, device and system
US20180285294A1 (en) Quality of service based handling of input/output requests method and apparatus
CN105554065A (en) Method, conversion unit and application unit for message processing
CN109040243B (en) Message processing method and device
CN109510878B (en) Long connection session keeping method and device
US10693785B2 (en) Method and system for forwarding data, virtual load balancer, and readable storage medium
US11057459B2 (en) Datapath-driven fully distributed east-west application load balancer
CN108933829A (en) A kind of load-balancing method and device
CN106201769B (en) Server system, non-provisional computer-readable recording mediums and the method to enhance the memory fault-tolerant rate in server system
CN106453023B (en) It is a kind of for physical equipment and the communication means of virtual network, equipment and system
EP3130133B1 (en) Multi tenancy in software defined networking
US9847937B2 (en) Hardware acceleration for routing programs
CN109525684A (en) Message forwarding method and device
CN110858821A (en) Container communication method and device
CN113273154B (en) Method, apparatus, and computer-readable storage medium for network control
Lee et al. The impact of container virtualization on network performance of IoT devices
CN110351208A (en) A kind of message forwarding method, device, equipment and computer readable storage medium
CN111294285B (en) Network data distribution method and load balancer

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190531

RJ01 Rejection of invention patent application after publication