CN111556125B - Access request distribution method, load balancing equipment and electronic equipment - Google Patents

Access request distribution method, load balancing equipment and electronic equipment Download PDF

Info

Publication number
CN111556125B
CN111556125B CN202010330614.1A CN202010330614A CN111556125B CN 111556125 B CN111556125 B CN 111556125B CN 202010330614 A CN202010330614 A CN 202010330614A CN 111556125 B CN111556125 B CN 111556125B
Authority
CN
China
Prior art keywords
server
access request
working state
normal working
sending
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
CN202010330614.1A
Other languages
Chinese (zh)
Other versions
CN111556125A (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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN202010330614.1A priority Critical patent/CN111556125B/en
Publication of CN111556125A publication Critical patent/CN111556125A/en
Application granted granted Critical
Publication of CN111556125B publication Critical patent/CN111556125B/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/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/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • 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/1031Controlling of the operation of servers by a load balancer, e.g. adding or removing servers that serve requests

Abstract

The embodiment of the invention provides an access request distribution method, load balancing equipment and electronic equipment, wherein the method comprises the following steps: detecting whether a first server in a server cluster is in a normal working state; if so, sending a first access request to the first server; if not, sending the first access request to a second server in the server cluster; detecting the number of connections of the first server every preset time length under the condition that the first server is not in the normal working state; and when the number of the connections held by the first server is smaller than a preset value, disconnecting all the connections held by the first server, and removing the first server from the server cluster. The access request distribution method, the load balancing equipment and the electronic equipment provided by the embodiment of the invention can solve the problem that in the prior art, when the load balancing equipment distributes the access request to a back-end server, the distribution effect is poor.

Description

Access request distribution method, load balancing equipment and electronic equipment
Technical Field
The invention relates to the technical field of network communication, in particular to an access request distribution method, load balancing equipment and electronic equipment.
Background
In the prior art, a load balancing device is usually used as a data forwarding medium to connect a client and a plurality of servers at a back end, and forwards an access request received from the client to a corresponding server. However, when the load balancing device distributes the access requests to the servers of the backend, it usually determines whether the number of connections currently held by the backend server is saturated, and randomly distributes the received access requests to the servers whose number of connections is not in a saturated state.
Disclosure of Invention
Embodiments of the present invention provide an access request allocation method, a load balancing device, and an electronic device, so as to solve the problem in the prior art that when a load balancing device allocates an access request to a backend server, an allocation effect is poor. The specific technical scheme is as follows:
in a first aspect of the present invention, there is provided an access request allocation method, applied to a load balancing device, including:
detecting whether a first server in a server cluster is in a normal working state;
if so, sending a first access request to the first server;
if not, sending the first access request to a second server in the server cluster, wherein the second server is a server except the first server and in the normal working state;
detecting the number of connections of the first server every preset time length under the condition that the first server is not in the normal working state;
when the number of the connections held by the first server is smaller than a preset value, disconnecting all the connections held by the first server;
removing the first server from the cluster of servers after disconnecting all connections maintained by the first server.
In a second aspect of the present invention, there is also provided a load balancing apparatus, including:
the first detection module is used for detecting whether a first server in the server cluster is in a normal working state or not;
a sending module, configured to send a first access request to the first server when the first server is in the normal working state;
the sending module is further configured to send the first access request to a second server in the server cluster when the first server is not in the normal working state, where the second server is a server that is in the normal working state except the first server;
the second detection module is used for detecting the connection quantity of the first server every preset time length under the condition that the first server is not in the normal working state;
the disconnection module is used for disconnecting all the connections of the first server when the number of the connections of the first server is smaller than a preset value;
a removal module to remove the first server from the cluster of servers after disconnecting all connections maintained by the first server.
In a third aspect of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the access request distribution method when executing the program stored in the memory.
In a fourth aspect of the present invention implementation, there is also provided a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the access request allocating method steps.
In the embodiment of the invention, the servers in the server cluster are detected through the load balancing equipment, to determine whether the servers in the server cluster are in a normal working state, and sending an access request to the servers in the server cluster in the normal working state by the load balancing device, meanwhile, by further monitoring the number of connections held by the server which is not in the normal working state, to determine whether there is an abnormality in a server that is not in the normal operating state, and to remove the server for which the abnormality is determined from the server cluster, such that, the problem of access failure caused by sending an access request to a server which is not in the normal working state can be avoided, therefore, the problem that in the prior art, when the load balancing equipment distributes the access request to the back-end server, the distribution effect is poor is solved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a flowchart of an access request distribution method according to an embodiment of the present invention;
FIG. 2 is a second flowchart of an access request allocation method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a load balancing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device in an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating an access request allocation method according to an embodiment of the present invention, applied to a load balancing device, including:
step 101, detecting whether a first server in a server cluster is in a normal working state;
the load balancing device and the server cluster can belong to the same service platform, the server cluster can comprise a plurality of servers, the load balancing device can be connected with any one server in the server cluster, and data transmission is carried out based on the established connection. A user using the service provided by the service platform generally establishes a connection with a server in the server cluster through the load balancing device, and specifically, the user sends an access request to the load balancing device, and the load balancing device forwards the access request to each server in the server cluster. The load balancing device is used for balancing the load of each server in the server cluster, and the access request sent by the user can be an http request.
The normal working state may be: the server does not have a state of being incapable of processing the access request of the user, wherein the state of being incapable of processing the access request of the user may include: the method comprises the following situations that a server is down, the server is updating the service to be accessed by a user, the server is cleaning the memory of the server, the server is starting, the server is closing and the like.
Therefore, in the embodiment of the present invention, the load balancing device actively detects whether the first server in the server cluster is in the working state, so that the load balancing device can know whether the server in the server cluster is in the working condition that the user request cannot be processed, and further can select to send the received access request to the server in the normal working state, so as to improve the success rate of the user access.
The server cluster may be a cluster formed by all background servers for providing services for users in a certain service platform, wherein a server list corresponding to the server cluster may be stored in the load balancing device, and the server list stores identity information of all servers in the server cluster, so that the load balancing device can manage each server in the server cluster.
In addition, the load balancing device may establish a TCP connection with each server in the server cluster, and when the TCP is interrupted, it may be determined that the server is not in the normal operating state.
And 102, if so, sending a first access request to the first server.
Since it has been determined through the above step 101 that the first server is in a normal operating state, that is, the first server is in a state capable of normally processing an access request of a user, at this time, the load balancing device may send the first access request to the first server, so as to ensure that the first access request can be responded by a server in a server cluster.
Step 103, if not, sending the first access request to a second server in the server cluster, where the second server is a server in the normal working state except the first server.
When it is determined through the step 101 that the first server is not in the normal operating state, the load balancing device may temporarily terminate sending the access request to be sent to the first server, and send the access request to be sent to other second servers in the server cluster in the normal operating state, so that a problem of access failure caused by sending the access request to the servers not in the normal operating state can be avoided, and a problem of poor distribution effect when the load balancing device distributes the access request to a backend server in the prior art is solved.
And 104, detecting the number of the connections of the first server every preset time interval under the condition that the first server is not in the normal working state.
The connection maintained by the first server may refer to: the first server and the client have established a connection and are currently in a live state.
Specifically, because the connections held by the first server are all established with the client through the load balancing device, the load balancing device includes information related to the connections held by any one server in the server cluster, and when the connections held by the first server are disconnected, corresponding log information is correspondingly generated on the load balancing device, so that the load balancing device can detect the number of the connections currently held by the first server in the information stored in the load balancing device.
Since it is determined through the above step 101 that the first server is not in the normal operating state, an abnormal condition such as a downtime of the first server may occur, and at this time, the connection maintained on the first server may be disconnected due to the abnormality of the first server, and therefore, the number of connections maintained by the first server may be further detected by the load balancing device, so as to further know the state of the first server.
And 105, disconnecting all the connections held by the first server when the number of the connections held by the first server is smaller than a preset value.
The preset value may be a relatively small value set manually, and specifically may be a small value relative to the total number of connections that can be established by the first server, for example: 3. 5, 10, 20, etc. By detecting the number of connections held by the first server, when the number of connections held by the first server is detected to be small, it may be inferred that the connections held by the first server may be gradually disconnected, and in order to facilitate the first server to recover from normality as soon as possible, at this time, the load balancing device actively disconnects all the connections held by the first server, so that all the connections held by the first server are released, so that the first server may have more space for handling a failure of itself, for example, after all the connections are disconnected, the first server may be automatically restarted immediately.
Step 106, removing said first server from said cluster of servers after disconnecting all connections held by said first server.
Since all connections on the first server have been disconnected and the first server may have a failure, in order to avoid the load balancing apparatus sending an access request to the first server again, the first server is removed from the server cluster, where removing the first server from the server cluster may refer to deleting the identity information of the first server from the server list of the load balancing apparatus.
In the embodiment of the invention, the servers in the server cluster are detected through the load balancing equipment, to determine whether the servers in the server cluster are in a normal working state, and sending an access request to the servers in the server cluster in the normal working state by the load balancing device, meanwhile, by further monitoring the number of connections held by the server which is not in the normal working state, to determine whether there is an abnormality in a server that is not in the normal operating state, and to remove the server for which the abnormality is determined from the server cluster, such that, the problem of access failure caused by sending an access request to a server which is not in the normal working state can be avoided, therefore, the problem that in the prior art, when the load balancing equipment distributes the access request to the back-end server, the distribution effect is poor is solved.
Optionally, after the removing the first server from the server cluster, the method further comprises:
detecting whether the first server recovers the normal working state every preset time length;
under the condition that the first server is detected to recover the normal working state, sending n times of access requests to the first server, wherein the number of requests in the nth time of access request is greater than or equal to the number of requests in the (n-1) th time of access request, and the nth time of access request is as follows: sending after the first server successfully creates a connection based on each of the (n-1) th sent access requests.
Whether the first server recovers the normal working state is detected every other preset time, so that the first server is started again after the first server recovers the normal working.
Specifically, the load balancing device may send a request for establishing a TCP connection to the first server every preset time, and if the load balancing device may establish a TCP connection with the first server based on the sent TCP request, it may be determined that the first server has recovered to a normal working state.
However, since the first server may just recover from the downtime, if a large number of access requests are directly sent to the first server at this time, the server may be down again, and then a large number of users may fail to access the server. For this purpose, the access request may be sent to the first server step by step to implement warming up of the first server, and when the first server can normally process a certain amount of access requests, the access request is distributed to the first server in a normal access request distribution manner.
Specifically, the number of requests sent to the first server at a time may be determined according to a Fibonacci number sequence (Fibonacci sequence) by sending n times access requests to the first server, where the Fibonacci number sequence is (0,1,1,2,3,5,8,13, …), that is, 1 access request is sent to the first server for the first time, after the server establishes one connection based on the access request sent for the first time; sending 1 access request to the first server again for the second time, and establishing 1 connection again at the server based on the access request sent for the second time, wherein the server keeps 2 connections; sending 1 access request to the first server again for the third time, and establishing 1 connection again at the server based on the access request sent for the third time, wherein the server keeps 3 connections; sending 2 access requests to the first server again for the fourth time, and establishing 2 connections again at the server based on the access requests sent for the third time, wherein the server keeps 5 connections; in this way, the number of connections held by the first server is increased step by step, and practice proves that when the first server is just started, the number of access requests sent to the first server is increased step by using a fibonacci number sequence, so that the first server can enter a normal working state smoothly.
Optionally, after sending the access request to the first server n times, the method further includes:
in the case that at least one request in the access requests sent for the nth time does not successfully create a connection exists, disconnecting all connections currently held by the first server;
re-executing sending the access request to the first server n times.
Specifically, if the first server fails to establish a connection based on the access request in the warm-up phase, the first server may not completely recover the normal state, and at this time, since the TCP connection between the load balancing device and the first server is not yet disconnected, the first server is still in a connectable state, so that the first server may handle a possible failure of itself again by disconnecting all connections held by the first server. And then, re-executing the sending of the access request for n times to the first server again until the first server can successfully establish connection based on the access request for n times, and determining that the first server completely meets the online requirement.
Optionally, after sending the access request to the first server n times, the method further includes:
adding the first server to the server cluster if the n is equal to a preset threshold.
For example, if the maximum value of the number of connections that the first server can hold is 100, the preheating stage may be manually set if the first server can hold 13 connections, that is, the first server meets the online requirement. If the number of access requests sent to the first server each time is determined according to the fibonacci number sequence, then n is 6.
When the first server is determined to meet the online requirement, the first server is added to the server cluster again, that is, the identity information of the first server is added to the server list of the load balancing device again, so that the load balancing device can conveniently distribute the access request to the first server normally.
In order to facilitate understanding of the process of removing the first server from the server cluster to adding the first server to the server cluster again, the following describes the steps of the specific implementation of the process with reference to fig. 2:
referring to fig. 2, after the first server is removed from the server cluster, the load balancing apparatus periodically attempts to establish a TCP connection with the first server, and if the connection is successfully established, the number of requests sent to the first server each time is determined according to a Fibonacci number sequence (Fibonacci sequence), for example, only 6 consecutive values may be extracted from the Fibonacci number sequence as a new Fibonacci number sequence, where the Fibonacci number sequence may be (1,2,3,5,8,13), and it is set that when the first server successfully creates 13 connections, an upper line condition is satisfied. In this case, the load balancing device sends the access request to the first server for 6 times, and after the first server successfully establishes a connection based on the access request sent for the ith time, the total number of the created connections is the element value of the ith element in the Fibonacci number sequence, where i is greater than or equal to 1 and less than or equal to 6. As can be seen from the above discussion, if the number of access requests sent to the first server at the ith time is denoted as F (i), F (1) is 1, F (2) is 1, F (3) is 1, F (4) is 2, F (5) is 3, and F (6) is 5. Thus, through the flow shown in fig. 2, the online condition can be satisfied only after the first server successfully establishes a connection based on the access requests sent 6 times, and when it is determined that the first server satisfies the online condition, the first server is added to the server cluster.
In addition, when the load balancing device detects that the first server is not in a normal operating state, that is, when the TCP connection between the load balancing device and the first server is disconnected, the reason may be caused by the first server itself or may be caused by other reasons besides the first server, and therefore, if the TCP connection between the load balancing device and the first server is disconnected, the first server is repaired as described above, which may result in resource waste.
Therefore, in the embodiment of the present invention, after the detecting the number of connections held by the first server, it is further set to detect whether the first server recovers the normal operating state every preset time period; and sending a second access request to the first server when the number of the connections held by the first server is greater than or equal to the preset value and the first server is detected to recover the normal working state, wherein the second access request is an access request received after the first access request. The second access request may be an access request sent by a user and received by the load balancing device after receiving the first access request.
Specifically, in the embodiment of the present invention, before the first server meets the condition of being removed, the load balancing device continuously sends the TCP connection request to the first server, and if the load balancing device can establish the TCP connection with the first server again based on the TCP connection request, it indicates that it may be misjudged that the first server detected before is not in the normal working state, and at this time, if the first server is further repaired, resource waste will be caused, so that the load balancing device sends the second access request to the first server again as the server in the normal working state, so as to fully utilize the first server.
Referring to fig. 3, an embodiment of the present invention further provides a load balancing apparatus 300, including:
a first detection module 301, configured to detect whether a first server in a server cluster is in a normal working state;
a sending module 302, configured to send a first access request to the first server when the first server is in the normal working state;
the sending module 302 is further configured to send the first access request to a second server in the server cluster under the condition that the first server is not in the normal working state, where the second server is a server that is in the normal working state except the first server.
A second detection module 303, configured to detect, every preset time interval, a connection number held by the first server when it is detected that the first server is not in the normal operating state;
a disconnection module 304, configured to disconnect all connections held by the first server when the number of connections held by the first server is smaller than a preset value;
a removal module 305 for removing the first server from the cluster of servers after disconnecting all connections maintained by the first server.
Optionally, the first detecting module 301 is further configured to detect, every preset time period, whether the first server recovers the normal working state after the first server is removed from the server cluster;
the sending module 302 is further configured to send n times of access requests to the first server when it is detected that the first server recovers the normal working state, where the number of requests in the nth access request is greater than or equal to the number of requests in the (n-1) th access request, and the nth access request is: sending after the first server successfully creates a connection based on each of the (n-1) th sent access requests.
In the embodiment of the present invention, the load balancing device 300 detects the servers in the server cluster, to determine whether the servers in the server cluster are in a normal operating state, and to send an access request to the servers in the server cluster in the normal operating state by the load balancing apparatus 300, meanwhile, by further monitoring the number of connections held by the server which is not in the normal working state, to determine whether there is an abnormality in a server that is not in the normal operating state, and to remove the server for which the abnormality is determined from the server cluster, such that, the problem of access failure caused by sending an access request to a server which is not in the normal working state can be avoided, therefore, the problem that in the prior art, when the load balancing equipment distributes the access request to the back-end server, the distribution effect is poor is solved.
Optionally, the disconnecting module 304 is further configured to disconnect all connections currently held by the first server in a case that there is at least one request that has not successfully created a connection in the access request sent by the first server based on the nth time;
the sending module 302 is further configured to re-execute sending of the access request to the first server n times.
Optionally, the load balancing apparatus 300 further includes:
an adding module, configured to add the first server to the server cluster when n is equal to a preset threshold.
Optionally, the first detecting module 301 is further configured to detect, every preset time period, whether the first server recovers the normal working state after the detecting of the number of connections held by the first server;
the sending module 302 is further configured to send a second access request to the first server when the number of connections maintained by the first server is greater than or equal to the preset value and it is detected that the first server recovers the normal working state, where the second access request is an access request received after the first access request.
An embodiment of the present invention further provides an electronic device, as shown in fig. 4, including a processor 401, a communication interface 402, a memory 403, and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404,
a memory 403 for storing a computer program;
the processor 401, when executing the program stored in the memory 403, implements the following steps:
detecting whether a first server in a server cluster is in a normal working state;
if so, sending a first access request to the first server;
and if not, sending the first access request to a second server in the server cluster, wherein the second server is a server except the first server and in the normal working state.
Optionally, after detecting whether the first server in the server cluster is in a normal working state, the method further includes:
detecting the number of connections of the first server every preset time length under the condition that the first server is not in the normal working state;
when the number of the connections held by the first server is smaller than a preset value, disconnecting all the connections held by the first server;
removing the first server from the cluster of servers after disconnecting all connections maintained by the first server.
Optionally, after the removing the first server from the server cluster, the method further comprises:
detecting whether the first server recovers the normal working state every preset time length;
under the condition that the first server is detected to recover the normal working state, sending n times of access requests to the first server, wherein the number of requests in the nth time of access request is greater than or equal to the number of requests in the (n-1) th time of access request, and the nth time of access request is as follows: sending after the first server successfully creates a connection based on each of the (n-1) th sent access requests.
Optionally, after sending the access request to the first server n times, the method further includes:
in the case that at least one request in the access requests sent for the nth time does not successfully create a connection exists, disconnecting all connections currently held by the first server;
re-executing sending the access request to the first server n times.
Optionally, after sending the access request to the first server n times, the method further includes:
adding the first server to the server cluster if the n is equal to a preset threshold.
Optionally, after the detecting the number of connections held by the first server, the method further includes:
detecting whether the first server recovers the normal working state every preset time length;
and sending a second access request to the first server when the number of the connections held by the first server is greater than or equal to the preset value and the first server is detected to recover the normal working state, wherein the second access request is an access request received after the first access request.
The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the terminal and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
In yet another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the instructions cause the computer to execute the access request allocation method described in any one of the above embodiments.
In yet another embodiment, the present invention further provides a computer program product containing instructions which, when run on a computer, cause the computer to perform the method for allocating access requests as described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (9)

1. An access request distribution method applied to load balancing equipment is characterized by comprising the following steps:
detecting whether a first server in a server cluster is in a normal working state;
if so, sending a first access request to the first server;
if not, sending the first access request to a second server in the server cluster, wherein the second server is a server except the first server and in the normal working state;
detecting the number of connections of the first server every preset time length under the condition that the first server is not in the normal working state;
when the number of the connections held by the first server is smaller than a preset value, disconnecting all the connections held by the first server;
removing the first server from the cluster of servers after disconnecting all connections maintained by the first server;
after the detecting the number of connections maintained by the first server, the method further comprises:
detecting whether the first server recovers the normal working state every other preset time length;
and sending a second access request to the first server when the number of the connections held by the first server is greater than or equal to the preset value and the first server is detected to recover the normal working state, wherein the second access request is an access request received after the first access request.
2. The method of claim 1, wherein after the removing the first server from the cluster of servers, the method further comprises:
detecting whether the first server recovers the normal working state every preset time length;
under the condition that the first server is detected to recover the normal working state, sending n times of access requests to the first server, wherein the number of requests in the nth time of access request is greater than or equal to the number of requests in the (n-1) th time of access request, and the nth time of access request is as follows: after the first server successfully creates a connection based on each of the (n-1) th sent access requests.
3. The method of claim 2, wherein after sending the n access requests to the first server, further comprising:
in the case that at least one request in the access requests sent for the nth time does not successfully create a connection exists, disconnecting all connections currently held by the first server;
re-executing sending the access request to the first server n times.
4. The method of claim 2, wherein after sending the n access requests to the first server, the method further comprises:
adding the first server to the server cluster if the n is equal to a preset threshold.
5. A load balancing device, comprising:
the first detection module is used for detecting whether a first server in the server cluster is in a normal working state or not;
the sending module is used for sending a first access request to the first server under the condition that the first server is in the normal working state;
the sending module is further configured to send the first access request to a second server in the server cluster when the first server is not in the normal working state, where the second server is a server that is in the normal working state except the first server;
the second detection module is used for detecting the connection quantity of the first server every preset time length under the condition that the first server is not in the normal working state;
the disconnection module is used for disconnecting all the connections of the first server when the number of the connections of the first server is smaller than a preset value;
a removal module to remove the first server from the cluster of servers after disconnecting all connections maintained by the first server;
the first detection module is further configured to detect whether the first server recovers the normal working state every preset time after the detection of the number of connections held by the first server;
the sending module is further configured to send a second access request to the first server when the number of connections held by the first server is greater than or equal to the preset value and it is detected that the first server recovers the normal working state, where the second access request is an access request received after the first access request.
6. The apparatus of claim 5, wherein the first detecting module is further configured to detect whether the first server recovers the normal operating state every preset time period after the first server is removed from the server cluster;
the sending module is further configured to send n-time access requests to the first server when it is detected that the first server recovers the normal working state, where a number of requests in the nth access request is greater than or equal to a number of requests in the (n-1) th access request, and the nth access request is: sending after the first server successfully creates a connection based on each of the (n-1) th sent access requests.
7. The device of claim 6, wherein the disconnection module is further configured to disconnect all connections currently held by the first server if there is at least one request that the first server has not successfully created a connection based on the nth-sent access request;
the sending module is further configured to re-execute sending of the access request to the first server for n times.
8. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 4 when executing a program stored in the memory.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-4.
CN202010330614.1A 2020-04-24 2020-04-24 Access request distribution method, load balancing equipment and electronic equipment Active CN111556125B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010330614.1A CN111556125B (en) 2020-04-24 2020-04-24 Access request distribution method, load balancing equipment and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010330614.1A CN111556125B (en) 2020-04-24 2020-04-24 Access request distribution method, load balancing equipment and electronic equipment

Publications (2)

Publication Number Publication Date
CN111556125A CN111556125A (en) 2020-08-18
CN111556125B true CN111556125B (en) 2022-05-17

Family

ID=72003939

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010330614.1A Active CN111556125B (en) 2020-04-24 2020-04-24 Access request distribution method, load balancing equipment and electronic equipment

Country Status (1)

Country Link
CN (1) CN111556125B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114520808A (en) * 2020-11-19 2022-05-20 南京亚信软件有限公司 Request processing method and device, electronic equipment and computer readable storage medium
CN112732465A (en) * 2021-01-20 2021-04-30 北京高码科技有限公司 Method for realizing automatic remote execution based on configuration scheduling
CN114938377A (en) * 2022-04-20 2022-08-23 京东科技信息技术有限公司 Back-end server management method and device, readable medium and electronic equipment

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6038664A (en) * 1996-06-10 2000-03-14 Cubix Corporation Method for selecting communication access method for local area networks
CN102611735A (en) * 2011-12-21 2012-07-25 奇智软件(北京)有限公司 Load balancing method and system of application services
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
CN105915650A (en) * 2016-06-21 2016-08-31 腾讯科技(深圳)有限公司 Load balancing method and device
CN108234191A (en) * 2017-05-31 2018-06-29 深圳市创梦天地科技有限公司 The management method and device of cloud computing platform
CN108667933A (en) * 2018-05-11 2018-10-16 星络科技有限公司 Device and communication system are established in connection method for building up, connection
CN108769257A (en) * 2018-06-28 2018-11-06 新华三信息安全技术有限公司 A kind of server switching method and device
CN109327550A (en) * 2018-11-30 2019-02-12 网宿科技股份有限公司 A kind of distribution method of access request, device, storage medium and computer equipment
CN110515728A (en) * 2019-08-19 2019-11-29 杭州迪普科技股份有限公司 Server scheduling method, apparatus, electronic equipment and machine readable storage medium
CN110764963A (en) * 2018-07-28 2020-02-07 阿里巴巴集团控股有限公司 Service exception handling method, device and equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9667711B2 (en) * 2014-03-26 2017-05-30 International Business Machines Corporation Load balancing of distributed services
CN106599711A (en) * 2015-10-15 2017-04-26 华为技术有限公司 Database access control method and device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6038664A (en) * 1996-06-10 2000-03-14 Cubix Corporation Method for selecting communication access method for local area networks
CN102611735A (en) * 2011-12-21 2012-07-25 奇智软件(北京)有限公司 Load balancing method and system of application services
CN103220354A (en) * 2013-04-18 2013-07-24 广东宜通世纪科技股份有限公司 Method for achieving load balancing of server cluster
CN105915650A (en) * 2016-06-21 2016-08-31 腾讯科技(深圳)有限公司 Load balancing method and device
CN108234191A (en) * 2017-05-31 2018-06-29 深圳市创梦天地科技有限公司 The management method and device of cloud computing platform
CN108667933A (en) * 2018-05-11 2018-10-16 星络科技有限公司 Device and communication system are established in connection method for building up, connection
CN108769257A (en) * 2018-06-28 2018-11-06 新华三信息安全技术有限公司 A kind of server switching method and device
CN110764963A (en) * 2018-07-28 2020-02-07 阿里巴巴集团控股有限公司 Service exception handling method, device and equipment
CN109327550A (en) * 2018-11-30 2019-02-12 网宿科技股份有限公司 A kind of distribution method of access request, device, storage medium and computer equipment
CN110515728A (en) * 2019-08-19 2019-11-29 杭州迪普科技股份有限公司 Server scheduling method, apparatus, electronic equipment and machine readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Load balancing real-time periodic task scheduling algorithm for multiprocessor enviornment";D. Jain and S. C. Jain;《2015 International Conference on Circuits, Power and Computing Technologies》;20150716;全文 *
"改进的基于加权最小连接数的负载均衡算法";高振斌等;《科学技术与工程》;20160228;全文 *

Also Published As

Publication number Publication date
CN111556125A (en) 2020-08-18

Similar Documents

Publication Publication Date Title
CN111556125B (en) Access request distribution method, load balancing equipment and electronic equipment
US10313452B2 (en) Migrating a chat message service provided by a chat server to a new chat server
CN108183950B (en) Method and device for establishing connection of network equipment
CN108897854B (en) Monitoring method and device for overtime task
CN108200218B (en) Method and device for realizing load balance and electronic equipment
CN108833205B (en) Information processing method, information processing device, electronic equipment and storage medium
WO2019034095A1 (en) Software processing method and apparatus, electronic device and computer-readable storage medium
CN110830283A (en) Fault detection method, device, equipment and system
CN108958883B (en) Recovery method and system for virtual machine in cloud computing cluster
CN112398689A (en) Network recovery method and device, storage medium and electronic equipment
CN111010318A (en) Method and system for discovering loss of connection of terminal equipment of Internet of things and equipment shadow server
CN108156024B (en) Method, system and storage medium for detecting availability based on distributed website
CN110896382B (en) Flow control method, apparatus, device and computer readable storage medium
CN113347037A (en) Data center access method and device
CN110311975B (en) Data request processing method and device
CN107172112B (en) Computer file transmission method and device
CN115412609B (en) Service processing method, device, server and storage medium
CN117032987A (en) Distributed task scheduling method, system, equipment and computer readable medium
CN113590180B (en) Detection strategy generation method and device
CN114338794B (en) Service message pushing method and device, electronic equipment and storage medium
CN110113187B (en) Configuration updating method and device, configuration server and configuration system
CN113254245A (en) Fault detection method and system for storage cluster
US8924547B1 (en) Systems and methods for managing network devices based on server capacity
JP2003256390A (en) Distributed object system
CN112214437A (en) Storage device, communication method and device and computer readable storage medium

Legal Events

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