CN113783904B - Load balancing method, route server and load balancing system - Google Patents

Load balancing method, route server and load balancing system Download PDF

Info

Publication number
CN113783904B
CN113783904B CN202010516780.0A CN202010516780A CN113783904B CN 113783904 B CN113783904 B CN 113783904B CN 202010516780 A CN202010516780 A CN 202010516780A CN 113783904 B CN113783904 B CN 113783904B
Authority
CN
China
Prior art keywords
server
application server
candidate application
service
standby
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010516780.0A
Other languages
Chinese (zh)
Other versions
CN113783904A (en
Inventor
张佳
王财贞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BYD Co Ltd
Original Assignee
BYD 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 BYD Co Ltd filed Critical BYD Co Ltd
Priority to CN202010516780.0A priority Critical patent/CN113783904B/en
Publication of CN113783904A publication Critical patent/CN113783904A/en
Application granted granted Critical
Publication of CN113783904B publication Critical patent/CN113783904B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1034Reaction to server failures by a load balancer
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context

Abstract

The invention discloses a load balancing method, a routing server and a load balancing system, wherein the load balancing method comprises the following steps: receiving a service request sent by a client; determining candidate application servers according to the service request; judging whether the candidate application server can provide the corresponding service; if the candidate application server cannot provide the corresponding service, further judging whether the candidate application server has a matched standby server or not; if the candidate application server has the matched standby server, selecting the matched standby server to provide service for the client; if the candidate application server does not have the matched standby server, randomly selecting one standby server in an idle state to provide service for the client. The invention can ensure that the load balancing system can still provide service uninterruptedly under the condition that a certain application server fails, and avoid the high concurrency phenomenon that a large number of service requests access the database simultaneously.

Description

Load balancing method, route server and load balancing system
Technical Field
The present invention relates to the field of server technologies, and in particular, to a load balancing method, a routing server, and a load balancing system.
Background
The load balancing is a system consisting of a plurality of servers, requests can be evenly distributed to the servers in the load balancing system through some algorithms, response time of the requests is shortened, and processing capacity of the system is improved. However, the current load balancing system does not have a detection mode and capability for the network system condition, and once a fault occurs between a certain server or a certain section of load balancing equipment and a server network, the load balancing equipment still directs a part of requests to the server originally providing services, which tends to cause a great deal of request loss, and the uninterrupted availability requirement cannot be met. Even if these requests are split to other servers, the database transient pressure increases due to the new server not having a cache of these requests.
Disclosure of Invention
The invention provides a load balancing method, a routing server and a load balancing system, which are used for solving at least one of the technical problems.
The embodiment of the invention provides a load balancing method, which comprises the following steps: the routing server receives a service request sent by a client; the routing server determines candidate application servers according to the service request; the routing server judges whether the candidate application server can provide corresponding service or not; if the candidate application server cannot provide the corresponding service, the routing server further judges whether the candidate application server has a matched standby server or not; if the candidate application server has a matched standby server, the routing server selects the matched standby server to provide service for the client; and if the candidate application server does not have the matched standby server, the routing server randomly selects one standby server in an idle state to provide service for the client.
Optionally, if the candidate application server can provide the corresponding service, the routing server directly selects the candidate application server to provide the service to the client.
Optionally, the determining, by the routing server, a candidate application server according to the service request includes:
and calculating the ID of the candidate application server based on a hash consistency algorithm to determine the candidate application server.
Optionally, the routing server determines whether the candidate application server can provide the corresponding service, including:
inquiring an application server list to acquire state information of the candidate application servers, wherein the application server list stores the application servers and the corresponding state information thereof;
and judging whether the candidate application server can provide the corresponding service according to the state information of the candidate application server.
Optionally, the routing server further determines whether the candidate application server has a matched standby server, including:
inquiring whether a standby server with a corresponding relation with the candidate application server exists in a standby server list;
and judging whether the candidate application server has the matched standby server or not according to the query result.
Another embodiment of the present invention provides a routing server, including: the receiving module is used for receiving the service request sent by the client;
a determining module, configured to determine a candidate application server according to the service request;
the first judging module is used for judging whether the candidate application server can provide corresponding services or not;
the second judging module is used for further judging whether the candidate application server has a matched standby server or not if the candidate application server cannot provide the corresponding service;
a selecting module, configured to select the matched standby server to provide a service for the client if the candidate application server has the matched standby server; and if the candidate application server does not have the matched standby server, the routing server randomly selects one standby server in an idle state to provide service for the client.
Optionally, the selecting module is further configured to:
and if the candidate application server can provide the corresponding service, directly selecting the candidate application server to provide the service for the client.
Optionally, the determining module is configured to:
and calculating the ID of the candidate application server based on a hash consistency algorithm to determine the candidate application server.
Optionally, the first judging module is configured to:
inquiring an application server list to acquire state information of the candidate application servers, wherein the application server list stores the application servers and the corresponding state information thereof;
and judging whether the candidate application server can provide the corresponding service according to the state information of the candidate application server.
Optionally, the second judging module is configured to:
inquiring whether a standby server with a corresponding relation with the candidate application server exists in a standby server list;
and judging whether the candidate application server has the matched standby server or not according to the query result.
The embodiment of the invention provides a load balancing system, which comprises:
the routing server is used for receiving a service request sent by a client, determining a candidate application server according to the service request, judging whether the candidate application server can provide corresponding service, if the candidate application server cannot provide corresponding service, further judging whether the candidate application server has a matched standby server, if the candidate application server has the matched standby server, selecting the matched standby server to provide service for the client, and if the candidate application server does not have the matched standby server, randomly selecting one standby server in an idle state to provide service for the client;
the application server and the standby server are connected with the routing server and are used for providing service for the client according to the service request;
the monitoring server is respectively connected with the routing server, the application server and the standby server, and is used for monitoring the states of the application server and the standby server, acquiring state change information of the application server or the standby server when the states of the application server or the standby server change, and sending the state change information to the routing server so that the routing server updates an application server list or a standby server list.
The technical scheme provided by the embodiment of the invention can have the following beneficial effects: by receiving a service request sent by a client, determining a candidate application server according to the service request, and judging whether the candidate application server can provide corresponding service, if the candidate application server cannot provide corresponding service, further judging whether the candidate application server has a matched standby server, if the candidate application server has the matched standby server, selecting the matched standby server to provide service for the client, and if the candidate application server does not have the matched standby server, randomly selecting a standby server in an idle state to provide service for the client, so that a load balancing system can still ensure uninterrupted service in the case of failure of a certain application server, and avoid high concurrency of a large number of service requests accessing a database at the same time.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings, in which:
FIG. 1 is a flow chart of a load balancing method according to one embodiment of the invention;
FIG. 2 is a flow chart of a load balancing method according to another embodiment of the invention;
FIG. 3 is a block diagram of a routing server according to one embodiment of the present invention;
fig. 4 is a block diagram of a load balancing system according to one embodiment of the invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
The load balancing method, the routing server and the load balancing system according to the embodiment of the invention are described below with reference to the accompanying drawings.
Load balancing is a cluster technique of servers or network devices. Load balancing may share a particular service to multiple servers, thereby improving service processing capacity. However, the current load balancing system does not have a detection mode and capability for the network system condition, and once a fault occurs between a certain server or a certain section of load balancing equipment and a server network, the load balancing equipment still directs a part of requests to the server originally providing services, which tends to cause a great deal of requests to be lost, and the uninterrupted availability requirement cannot be met. Therefore, the invention provides a load balancing method, a routing server and a load balancing system.
Fig. 1 is a flow chart of a load balancing method according to one embodiment of the invention.
As shown in fig. 1, the load balancing method includes:
s101, the route server receives a service request sent by the client.
In the load balancing system, the routing server is mainly responsible for receiving the service request from the client, and the routing server forwards the service request to the application server or the standby server which can process the service request, and the application server or the standby server processes the service request, so that the purpose of load balancing is achieved.
In one embodiment of the invention, the routing server may first receive a service request sent by a client. Wherein the service request may be various network application traffic.
S102, the route server determines candidate application servers according to the service request.
In one embodiment of the invention, the IDs of the candidate application servers may be calculated based on a hash consistency algorithm to determine the candidate application servers. The hash consistency algorithm is as follows: will [0,2 ] 32 ) All integers are projected on a circle, and then the integer obtained by hash operation of the unique code of the application server (application server ID) is also projected on the circle (e.g. Node-A, node-B). When a service request is received, the whole number obtained by hashing the unique code of the service request (such as the client ID) is projected onto the circle (such as the requestst-1, request-2). Finally, the first corresponding application server is found out, namely the application server corresponding to the service request is allocated to the first corresponding application server by clockwise direction.
S103, the routing server judges whether the candidate application server can provide the corresponding service.
In one embodiment of the present invention, the application server list may be queried to obtain state information of candidate application servers, and then whether the candidate application servers can provide corresponding services is determined according to the state information of the candidate application servers. The application server list stores the application servers and corresponding state information thereof, and the application server list can be stored in the routing server. If the state information corresponding to the application server 1 is a normal service state, the state information corresponding to the application server 2 is in failure.
And S104, if the candidate application server cannot provide the corresponding service, the routing server further judges whether the candidate application server has the matched standby server.
In one embodiment of the present invention, it may be queried whether a standby server having a correspondence with a candidate application server exists in the standby server list, and then it is determined whether the candidate application server has a matched standby server according to the query result. Wherein, the standby server list is also stored in the routing server, and the list stores information of the standby servers, such as failure of the application server 1, and the standby server 1 matched with the application server 1 can provide service.
S105, if the candidate application server has the matched standby server, the routing server selects the matched standby server to provide service for the client.
Because the matched standby server and the candidate application server have a corresponding relation, the service request does not need to be cached, and the high concurrency phenomenon that a large number of service requests access the database simultaneously is avoided.
And S106, if the candidate application server does not have the matched standby server, the routing server randomly selects one standby server in an idle state to provide services for the client.
In addition, as shown in fig. 2, the load balancing method may further include the following steps:
and S107, if the candidate application server can provide the corresponding service, the routing server directly selects the candidate application server to provide the service for the client.
In one embodiment of the present invention, if the determined candidate application server is capable of providing the corresponding service, such as in a normal state and idle, the candidate application server may be directly used as an application server to provide the service for the client.
According to the load balancing method, the candidate application server is determined according to the service request by receiving the service request sent by the client, whether the candidate application server can provide corresponding service is judged, if the candidate application server cannot provide the corresponding service, whether the candidate application server has the matched standby server is further judged, if the candidate application server has the matched standby server, the matched standby server is selected to provide service for the client, if the candidate application server does not have the matched standby server, one standby server in an idle state is randomly selected to provide service for the client, and therefore the load balancing system can still guarantee that the load balancing system can provide service uninterruptedly under the condition that a certain application server fails, and high concurrency of a large number of service requests accessing a database simultaneously is avoided.
In order to implement the above embodiment, the present invention further proposes a routing server.
Fig. 3 is a block diagram of a routing server according to one embodiment of the present invention.
As shown in fig. 3, the routing server includes a receiving module 310, a determining module 320, a first judging module 330, a second judging module 340, and a selecting module 350.
The receiving module 310 is configured to receive a service request sent by a client.
A determining module 320, configured to determine candidate application servers according to the service request.
A first determining module 330 is configured to determine whether the candidate application server can provide the corresponding service.
The second determining module 340 is configured to further determine whether the candidate application server has a matched standby server if the candidate application server cannot provide the corresponding service.
A selecting module 350, configured to select the matched standby server to provide services for the client if the candidate application server has the matched standby server; if the candidate application server does not have a matched standby server, the routing server randomly selects a standby server in an idle state to serve the client.
It should be noted that the foregoing explanation of the load balancing method is also applicable to the routing server in the embodiment of the present invention, and details not disclosed in the embodiment of the present invention are not repeated herein.
The routing server in the embodiment of the invention determines the candidate application server by receiving the service request sent by the client and determining the candidate application server according to the service request, and judges whether the candidate application server can provide the corresponding service, if the candidate application server cannot provide the corresponding service, further judges whether the candidate application server has the matched standby server, if the candidate application server has the matched standby server, selects the matched standby server to provide the service for the client, if the candidate application server does not have the matched standby server, randomly selects one standby server in an idle state to provide the service for the client, so that the load balancing system can still ensure that the load balancing system can provide the service uninterruptedly under the condition that a certain application server fails, and avoids the high concurrency phenomenon that a large number of service requests access the database at the same time.
In order to implement the above embodiment, the present invention further provides a load balancing system.
As shown in fig. 4, the load balancing system includes a routing server 410, an application server 420, a standby server 430, and a monitoring server 440.
The routing server 410 is configured to receive a service request sent by a client, determine a candidate application server 420 according to the service request, and determine whether the candidate application server 420 can provide a corresponding service. If candidate application server 420 fails to provide the corresponding service, a further determination is made as to whether candidate application server 420 has a matched standby server 430. If candidate application server 420 has a matched standby server 430, then matched standby server 430 is selected to serve the client. If candidate application server 420 does not have a matched standby server 430, then a standby server 430 in an idle state is randomly selected to serve the client.
An application server 420 and a standby server 430 are connected to the routing server 410 for providing services to clients according to service requests.
The monitoring server 440 is connected to the routing server 410, the application server 420 and the standby server 430, and is configured to monitor the states of the application server 420 and the standby server 430, obtain the state change information of the application server 420 or the standby server 430 when the state of the application server 420 or the standby server 430 changes, and send the state change information to the routing server 410, so that the routing server 410 updates the application server list or the standby server list.
It should be appreciated that if the backup server 430 is not in a service providing state, the monitoring server 440 does not monitor its state. If the standby server 430 is in a service providing state, the monitoring server 440 monitors it.
The load balancing system is described in detail below with one specific example.
The load balancing system may include a routing server, a monitoring server, a cluster server, and a backup server.
The routing server can obtain the IP address and the port number of the cluster server to which the client needs to be connected by carrying out hash consistency operation on the unique identification ID of the client.
The monitoring server is responsible for monitoring the cluster servers. When a certain cluster server fails or resumes working, the monitoring server sends a notification to the routing server, so that the routing server controls the standby server to acquire the cache information of the failed cluster server at one time, and the standby server is used for providing service for the client.
The cluster server is responsible for processing the service request of the client, and when the client is connected, a corresponding relation between the cluster server and the client is saved to the database. The failed cluster server can load the cache at one time through the corresponding relation after restarting, so that the request pressure of the database is reduced. The number of standby servers may be less than or equal to the number of cluster servers.
Specifically, the client sends a request to the routing server. The routing server calculates a cluster server needing to provide service by using a hash consistency algorithm, and then judges whether the state of the cluster server can normally provide service. If the service is normally provided, selecting the cluster server to provide the service; if the service cannot be normally provided, judging whether the cluster server has an allocated standby server or not. If so, the standby server which is allocated is selected to provide the service. If not, a standby server that is not providing service is randomly selected to provide service. The routing server maintains three lists, namely: A. the cluster server list is used for storing the cluster server list and the corresponding service state; B. the standby server list is used for storing the standby server list and the corresponding service state; C. and the failed cluster server and the selected standby server list.
In a load balancing system, a cluster server and a standby server may dynamically register services with a monitoring server. The cluster service has two states of normal service and failure, and the standby server node has two states of standby and starting. The standby state refers to a state in which the standby server does not provide service, and the active state refers to a state in which the standby server has provided service. The monitoring server regularly carries out health detection on the cluster server and the standby server, and notifies the routing server to change the algorithm when a fault is detected.
The specific execution flow is as follows:
(1) The cluster server dynamically adds a cluster server registration to the monitoring server.
S811, starting the cluster server and sending an adding message of the cluster server to the monitoring server.
And S812, after the monitoring server receives the cluster server adding message, starting to monitor the corresponding cluster server.
S813, the monitoring server sends a server add message to the routing server.
S814, after receiving the server addition message, the routing server adds the cluster server in the cluster server list, and sets the status identifier as normal service.
S815, when the client sends a service request, the routing server calculates a cluster server providing the service through the improved hash consistency algorithm.
And S816, the routing server feeds back the connection address of the cluster server providing the service to the client.
And S817, the client communicates with the cluster server providing the service according to the connection address.
If a cluster server is connected, the cluster server may obtain the cache information of each connected client, and store the client information and the unique client identifier to the database. If a standby server is connected, the correspondence between the cluster server and the connected clients is not persisted.
(2) The standby server dynamically registers with the monitoring server.
And S821, after the standby server is started, sending a standby server adding message to the monitoring server.
The monitoring server does not monitor the standby server.
S822, the monitoring server sends a standby server adding message to the routing server.
S823, the route server receives the standby server adding message, the route server adds the standby server in the standby server list, and meanwhile, the state identifier of the standby server is set to be in standby state.
(3) And deleting the cluster server.
S831, the monitoring server detects the cluster server at regular intervals.
Mainly including detection of network status and applications. The network state may include detection of a ping command, and detection of an application refers to detection of a socket connection state.
S832, if the monitoring server detects that the network state or the application program has a fault, the monitoring server stops monitoring the faulty cluster server, and sends an update server state message to the routing server, and the state identification is changed into the fault.
S833, after receiving the update server status message, the router changes the status identifier of the corresponding cluster server in the cluster server list to be a fault.
S834, randomly selecting a standby server with a state identifier being in standby from the standby server list by using a hash consistency algorithm to start, and updating the state information of the standby server.
S835, the routing server sends an enable standby server message to the monitoring server.
And S836, after receiving the message of starting the standby server, the monitoring server is connected with the standby server and sends the information of the failed cluster server, and the standby server loads the cache information of the failed cluster server from the database at one time to provide service for the client instead of the cache information.
S837, after receiving the update server status message, the router server updates the status in the corresponding standby server list, i.e. modifies the status into active status.
(4) After the cluster server recovers, the cluster server state is dynamically changed.
S841, after the failed cluster server is restarted, a server adding message is sent to the monitoring server.
S842, after receiving the server addition message, the monitoring server starts monitoring the cluster server.
S843, the monitoring server sends a server add message to the routing server.
S844, after receiving the server adding message, the routing server adds the cluster server to the cluster server list if the cluster server is not in the cluster server list. If the cluster server is already in the cluster server list, the state information of the cluster server is changed to be in normal service.
The routing server modifies the state of the standby server replacing the cluster server to be in standby S845.
S846, deleting the corresponding relation between the cluster server and the standby server.
S847, the routing server sends a stop standby server message to the monitoring server.
S848, after receiving the message of stopping the standby server, the monitoring server cancels the monitoring of the standby server.
According to the load balancing system provided by the embodiment of the invention, the monitoring server is used for monitoring the cluster server, so that the load balancing algorithm can be dynamically updated, the load balancing system is ensured to provide uninterrupted service, after the cluster server fails, the flow of the failed server is shunted to a standby server by utilizing a pre-stored relation list instead of simply deleting the failed server, and the standby server acquires the cache data at one time, so that the pressure of a database is greatly reduced.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, and the program may be stored in a computer readable storage medium, where the program when executed includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented as software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like. While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (9)

1. A method of load balancing, comprising:
the routing server receives a service request sent by a client;
the routing server determines candidate application servers according to the service request; the ID of the candidate application server is calculated based on a hash consistency algorithm so as to determine the candidate application server;
the routing server judges whether the candidate application server can provide corresponding service or not;
if the candidate application server cannot provide the corresponding service, the routing server further judges whether the candidate application server has a matched standby server or not;
if the candidate application server has a matched standby server, the routing server selects the matched standby server to provide service for the client;
and if the candidate application server does not have the matched standby server, the routing server randomly selects one standby server in an idle state to provide service for the client by using a hash consistency algorithm.
2. The method as recited in claim 1, further comprising:
and if the candidate application server can provide the corresponding service, the routing server directly selects the candidate application server to provide the service for the client.
3. The method of claim 1, wherein the routing server determining whether the candidate application server is capable of providing the corresponding service comprises:
inquiring an application server list to acquire state information of the candidate application servers, wherein the application server list stores the application servers and the corresponding state information thereof;
and judging whether the candidate application server can provide the corresponding service according to the state information of the candidate application server.
4. The method of claim 1, wherein the routing server further determining whether the candidate application server has a matched standby server comprises:
inquiring whether a standby server with a corresponding relation with the candidate application server exists in a standby server list;
and judging whether the candidate application server has the matched standby server or not according to the query result.
5. A routing server, comprising:
the receiving module is used for receiving the service request sent by the client;
a determining module, configured to determine a candidate application server according to the service request; the ID of the candidate application server is calculated based on a hash consistency algorithm so as to determine the candidate application server;
the first judging module is used for judging whether the candidate application server can provide corresponding services or not;
the second judging module is used for further judging whether the candidate application server has a matched standby server or not if the candidate application server cannot provide the corresponding service;
a selecting module, configured to select the matched standby server to provide a service for the client if the candidate application server has the matched standby server; and if the candidate application server does not have the matched standby server, the routing server randomly selects one standby server in an idle state to provide service for the client by using a hash consistency algorithm.
6. The routing server of claim 5, wherein the selection module is further to:
and if the candidate application server can provide the corresponding service, directly selecting the candidate application server to provide the service for the client.
7. The routing server of claim 5, wherein the first determining module is configured to:
inquiring an application server list to acquire state information of the candidate application servers, wherein the application server list stores the application servers and the corresponding state information thereof;
and judging whether the candidate application server can provide the corresponding service according to the state information of the candidate application server.
8. The routing server of claim 5, wherein the second determining module is configured to:
inquiring whether a standby server with a corresponding relation with the candidate application server exists in a standby server list;
and judging whether the candidate application server has the matched standby server or not according to the query result.
9. A load balancing system, comprising:
the routing server is used for receiving a service request sent by a client and determining a candidate application server according to the service request, wherein the ID of the candidate application server is calculated based on a hash consistency algorithm to determine the candidate application server, judging whether the candidate application server can provide corresponding service, if the candidate application server cannot provide corresponding service, further judging whether the candidate application server has a matched standby server, if the candidate application server has the matched standby server, selecting the matched standby server to provide service for the client, and if the candidate application server does not have the matched standby server, randomly selecting one standby server in an idle state to provide service for the client by using the hash consistency algorithm;
the application server and the standby server are connected with the routing server and are used for providing service for the client according to the service request;
the monitoring server is respectively connected with the routing server, the application server and the standby server, and is used for monitoring the states of the application server and the standby server, acquiring state change information of the application server or the standby server when the states of the application server or the standby server change, and sending the state change information to the routing server so that the routing server updates an application server list or a standby server list.
CN202010516780.0A 2020-06-09 2020-06-09 Load balancing method, route server and load balancing system Active CN113783904B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010516780.0A CN113783904B (en) 2020-06-09 2020-06-09 Load balancing method, route server and load balancing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010516780.0A CN113783904B (en) 2020-06-09 2020-06-09 Load balancing method, route server and load balancing system

Publications (2)

Publication Number Publication Date
CN113783904A CN113783904A (en) 2021-12-10
CN113783904B true CN113783904B (en) 2023-05-09

Family

ID=78834331

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010516780.0A Active CN113783904B (en) 2020-06-09 2020-06-09 Load balancing method, route server and load balancing system

Country Status (1)

Country Link
CN (1) CN113783904B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580988A (en) * 2012-07-31 2014-02-12 阿里巴巴集团控股有限公司 Method for message receiving, pushing and transmitting, device, server group and system
WO2015101260A1 (en) * 2013-12-30 2015-07-09 广州华多网络科技有限公司 Method and system for processing instant communication service
CN104852934A (en) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 Method for realizing flow distribution based on front-end scheduling, device and system thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5544523B2 (en) * 2011-07-19 2014-07-09 日本電信電話株式会社 Distributed processing system, distributed processing method, load distribution apparatus, load distribution method, and load distribution program
US10069903B2 (en) * 2013-04-16 2018-09-04 Amazon Technologies, Inc. Distributed load balancer
CN107819605A (en) * 2016-09-14 2018-03-20 北京百度网讯科技有限公司 Method and apparatus for the switching server in server cluster
US10320683B2 (en) * 2017-01-30 2019-06-11 Cisco Technology, Inc. Reliable load-balancer using segment routing and real-time application monitoring
CN106982259A (en) * 2017-04-19 2017-07-25 聚好看科技股份有限公司 The failure solution of server cluster
CN111131451A (en) * 2019-12-23 2020-05-08 武汉联影医疗科技有限公司 Service processing system and service processing method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103580988A (en) * 2012-07-31 2014-02-12 阿里巴巴集团控股有限公司 Method for message receiving, pushing and transmitting, device, server group and system
WO2015101260A1 (en) * 2013-12-30 2015-07-09 广州华多网络科技有限公司 Method and system for processing instant communication service
CN104852934A (en) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 Method for realizing flow distribution based on front-end scheduling, device and system thereof

Also Published As

Publication number Publication date
CN113783904A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
US8856581B2 (en) Method for resource information backup operation based on peer to peer network and peer to peer network thereof
CN111615066B (en) Distributed micro-service registration and calling method based on broadcast
US20090150718A1 (en) Large-scale cluster monitoring system, and method of automatically building/restoring the same
EP2091180A1 (en) Method, system and device for realizing switching between main and spare
CN107153660B (en) Fault detection processing method and system for distributed database system
US20210014106A1 (en) High availability on a distributed networking platform
WO2010115373A1 (en) Peer-to-peer-network-based resource information backup operation method and peer-to-peer network
US9390156B2 (en) Distributed directory environment using clustered LDAP servers
CN113347037B (en) Data center access method and device
CN113076212A (en) Cluster management method, device and equipment and computer readable storage medium
CN112181593A (en) Virtual machine scheduling method, device, equipment and storage medium
CN112367182A (en) Configuration method and device of disaster recovery main and standby equipment
CN113783904B (en) Load balancing method, route server and load balancing system
CN109189854B (en) Method and node equipment for providing continuous service
CN111917870A (en) Request processing method, system, device, electronic equipment and storage medium
CN111614701B (en) Distributed cluster and container state switching method and device
CN115686368A (en) Method, system, apparatus and medium for storage capacity expansion of nodes of block chain network
US8438261B2 (en) Failover scheme with service-based segregation
CN110650059B (en) Fault cluster detection method, device, computer equipment and storage medium
CN112612652A (en) Distributed storage system abnormal node restarting method and system
CN113596195A (en) Public IP address management method, device, main node and storage medium
CN115514797A (en) Backup SMF discovery method, device, electronic equipment and medium
CN115373733B (en) Model version adjusting method and device of model service and electronic equipment
JP2003248669A (en) Distributed data storage server system and data transmission method for distributed data storage server
US9019964B2 (en) Methods and systems for routing application traffic

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
GR01 Patent grant
GR01 Patent grant