SNMP-based health examination agent center and operation method thereof
Through the SNMP-based health check proxy center, the problem of load balancer's performance loss and low efficiency during health checks is solved, and the load balancer only needs to request one time to obtain the optimal server object, simplify the process and improve efficiency, and ensure high availability .
Patent Information
- Application Number
- CN202410863303.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-29
- Publication Date
- 2024-11-01
AI Technical Summary
In a cluster, when the load balancer periodically polls the backend server for health checks, it leads to reduced performance losses and request distribution efficiency, especially when the number of backend servers is large, the performance of the load balancer is affected.
Design a health check proxy center based on SNMP, send a Get request through the SNMP request module to obtain the status parameters of the backend server, calculate the storage module to update the status parameter list and execute the health check algorithm, and the response module returns the optimal backend server object and loads The equalizer only needs to send a request once to obtain the optimal server object, avoiding itself performing complex health check tasks.
It significantly reduces the performance loss of the load balancer, improves the efficiency of request distribution, simplifies the request processing process, and can quickly switch to a healthy backend server during failover, ensuring high service availability.
Smart Images

Figure CN118885366A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a health check agent center based on SNMP and an operation method thereof. Background Art
[0002] As the traffic of Internet applications increases, the load on servers also increases. In a cluster, load balancing technology distributes network traffic evenly to multiple servers by distributing requests reasonably, further achieving high performance and high availability of the system. In the implementation of load balancing technology, LVS and Keepalived are two commonly used technologies. The former implements the load balancing function at the Linux kernel level, while the latter implements the fault detection and automatic switching mechanism to ensure the continuous availability of system services.
[0003] Usually, the server that performs the load balancing function (referred to as the load balancer) will periodically obtain the status parameters of the backend server and perform related health check operations, so as to select the optimal backend server object for request forwarding. The load balancer often uses TCP, HTTP / HTTPS, ICMP and other methods to poll the backend server for health checks. Regardless of the method used, when the number of backend servers is very large, the load balancer periodically polls all backend servers for health checks, which will inevitably cause the performance of the load balancer to be damaged, further reducing the efficiency of request distribution. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions: a health check agent center based on SNMP, comprising:
[0006] SNMP request module, the SNMP request module is used to send SNMP Get request operations to all back-end servers to obtain status parameters of the back-end servers;
[0007] A computing and storage module, which is used to update the status parameter list of the local backend server, execute the health check algorithm, and calculate the backend server object with the current best performance;
[0008] A response module, the response module is used to monitor the request operation of the load balancer, and return the optimal backend server object in response to the request;
[0009] A load balancer, the load balancer includes a request module, which is responsible for performing HTTP request operations and is used to request a backend server object with the current best performance from a health check proxy center;
[0010] The back-end server includes an SNMP agent module, which is used to receive an SNMP Get request from a health check agent center, obtain the status information result of the device and return it.
[0011] As a preferred solution of the SNMP-based health check agent center described in the present invention, the status parameters of the back-end server include service process status, CPU usage and memory usage.
[0012] As a preferred solution of the SNMP-based health check agent center of the present invention, the request module of the load balancer supports HTTP and HTTPS protocols.
[0013] As a preferred solution of the SNMP-based health check proxy center described in the present invention, the load balancer also includes a failover module for automatically switching to other healthy backend servers when a backend server failure is detected.
[0014] As a preferred solution of the SNMP-based health check agent center of the present invention, the SNMP request module supports SNMP v2c and SNMP v3 protocols.
[0015] As a preferred solution of the SNMP-based health check agent center of the present invention, the SNMP request module can periodically send SNMP Get requests at set time intervals.
[0016] As a preferred solution of the SNMP-based health check agent center of the present invention, the calculation method of the health check algorithm includes the following steps:
[0017] S1: In the maintained backend server status parameter list, N backend server status parameters are stored, and these status parameter indicators are scored, and the score is S. The higher the score S is, the higher the performance of the backend server is;
[0018] S2: Let each state parameter value in a single server be n i (1≤i≤N), and match the weight w for each state parameter according to its importance i (0 <w i <1,1≤i≤N);
[0019] S3: If the backend server is down or the service is interrupted, S=0; if the backend server is operating normally, the calculation method of its score S can be:
[0020]
[0021] As a preferred solution of the SNMP-based health check agent center described in the present invention, the health check agent center also includes a log recording module for recording detailed information of all SNMP requests and responses to facilitate subsequent analysis and troubleshooting.
[0022] As a preferred solution of the SNMP-based health check agent center described in the present invention, the calculation and storage module can dynamically adjust the weight parameters to adapt to the traffic characteristics of different time periods.
[0023] The present invention also provides an operation method of a health check agent center based on SNMP, comprising the following steps:
[0024] S1: When the health check agent center starts, it first initializes the list of storage status parameters of each backend server and sets the timer task. The timer task mainly runs the SNMP request module and the calculation storage module;
[0025] S2: Whenever the timer task arrives, the SNMP request module sends an SNMP Get request to all backend servers to obtain the server status parameters. The calculation and storage module receives these parameters and updates and stores them in the backend server status parameter list. The health check algorithm calculates the performance score of each backend server and updates the backend server with the best performance according to the status parameters.
[0026] S3: The response module runs in the main program to monitor the requests of the load balancer. When a request arrives, the response module obtains the backend server object with the best performance from the computing storage module and sends the backend server object with the best performance to the load balancer. At this point, the operation of the entire health check proxy center is completed.
[0027] Beneficial effects of the present invention:
[0028] 1. The load balancer in the present invention only needs to send a request once to obtain the backend server with the current best performance, without having to perform complex health check tasks itself, thus reducing system resource consumption.
[0029] 2. The health check proxy center provided by the present invention uniformly obtains the status information of all back-end servers through SNMP, maintains the status list and calculates the best performance server. The load balancer does not need to perform polling request checks, especially when the number of back-end servers is large, which can significantly reduce the performance loss of the load balancer.
[0030] 3. The present invention adopts a health check proxy center to be responsible for the health check of the back-end servers, integrating the status parameter acquisition, storage and calculation tasks of all back-end servers, making management and operation more convenient.
[0031] 4. The load balancer of the present invention can obtain the optimal server object by sending a request to the health check proxy center once, which simplifies the request processing process, improves the request distribution efficiency, and can quickly switch to a healthy backend server when the load balancer fails over, ensuring high availability of the service. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0033] Figure 1 This is a module composition diagram of a health check agent center based on SNMP in the present invention.
[0034] Figure 2 This is a solution architecture diagram of a health check agent center based on SNMP in the present invention.
[0035] Figure 3 The present invention is a flow chart of an operation method of a health check agent center based on SNMP. DETAILED DESCRIPTION
[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0037] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0038] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0039] Secondly, the present invention is described in detail with reference to the schematic diagram. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0040] Example 1
[0041] Reference Figure 1-2 , which is the first embodiment of the present invention, provides a health check agent center based on SNMP, mainly including:
[0042] SNMP request module, which is used to send SNMP Get request operations to all back-end servers to obtain status parameters such as back-end server service process status, CPU usage, memory usage, etc.;
[0043] A computing and storage module, which is used to update the status parameter list of the local backend server, execute the health check algorithm, and calculate the backend server object with the current best performance. In addition, the computing and storage module can dynamically adjust the weight parameters to adapt to the traffic characteristics of different time periods;
[0044] A response module, the response module is used to monitor the request operation of the load balancer, and return the optimal backend server object in response to the request;
[0045] A load balancer, wherein the load balancer includes a request module, which is responsible for performing HTTP request operations and is used to request the backend server object with the best performance from the health check proxy center. When a request arrives, the backend server object with the best performance is obtained from the computing storage module, and the backend server object with the best performance is sent to the load balancer;
[0046] The back-end server includes an SNMP agent module, which is used to receive the SNMP Get request of the health check agent center, obtain the status information result of the device from the local management information base according to the OID (Object Identifier) in the request, and return it to the health check agent center.
[0047] Specifically, the request module of the load balancer supports HTTP and HTTPS protocols to ensure the security and reliability of data transmission. The load balancer also includes a failover module for automatically switching to other healthy backend servers when a backend server failure is detected.
[0048] Specifically, the SNMP request module supports SNMP v2c and SNMP v3 protocols to enhance the compatibility and security of data transmission.
[0049] Specifically, the SNMP request module can periodically send SNMP Get requests at set time intervals to ensure that the acquired status parameters are the latest.
[0050] Specifically, the calculation method of the health check algorithm includes the following steps:
[0051] S1: In the maintained backend server status parameter list, N backend server status parameters are stored, and these status parameter indicators are scored, and the score is S. The higher the score S is, the higher the performance of the backend server is;
[0052] S2: Let each state parameter value in a single server be n i (1≤i≤N), and match the weight w for each state parameter according to its importance i (0 <w i <1,1≤i≤N);
[0053] S3: If the backend server is down or the service is interrupted, S=0; if the backend server is operating normally, the calculation method of its score S can be:
[0054]
[0055] Specifically, the health check agent center also includes a log recording module for recording detailed information of all SNMP requests and responses to facilitate subsequent analysis and troubleshooting.
[0056] In the specific implementation, a health check proxy center is added to the entire cluster network to provide the backend server health check service for the load balancer. The health check proxy center will act as the network management station in the SNMP protocol, responsible for periodically polling all backend servers to execute SNMP Get requests to obtain status parameters. Each SNMP Get request will obtain the status parameters of the backend server, including but not limited to the service process status, CPU usage, memory usage, etc. In the backend server, each status parameter will have a corresponding OID. When the health check proxy center executes the SNMP Get request to obtain the status parameter, it is necessary to specify the corresponding OID for query. The OID can use the OID of the standard protocol or the extended private OID to obtain the unique status parameter required by the user. The private OID needs to be designed and added in the backend server. Every time the health check proxy center needs to obtain the status parameters of a backend server, it is necessary to provide an SNMP service request interface. This interface mainly initializes the session connection information of the target backend server, including the SNMP protocol version number, community name, authentication password, encryption password, etc., and sends SNMP UDP request information through the SNMP Get related function interface to obtain the status parameters of the backend server. The health check proxy center maintains a status parameter list that stores the status of all backend servers. Whenever the health check proxy center obtains the required status parameters of all backend servers through SNMP Get requests, it updates and saves these status parameter values into the status parameter list.
[0057] After the health check proxy center updates the status parameter list each time, the corresponding health check algorithm is executed to calculate the backend server object in the current optimal state as the current optimal request distribution object. According to the health check algorithm in the technical solution, it is assumed that the backend server status parameter list maintained by the health check proxy center mainly stores the four status parameters of service process status, CPU idle rate, memory idle rate, and number of available connections (only for example, it does not necessarily mean that only these four parameters are needed, and it needs to be set according to specific needs). Set a score S, and select the backend server in the current optimal state through a scoring system. The higher the score S of the backend server, the higher the performance of the backend server. If the service process status of a backend server in the currently updated status parameter list is abnormal, or the SNMP Get request cannot be executed, then S=0; otherwise, if the four status parameter values of a current backend server are n1, n2, n3, and n4, and the weight values corresponding to the four status parameters are w1, w2, w3, and w4 (0 <w i <1,1≤i≤4), then the score of the backend server is S:
[0058] S=w1n1+w2n2+w3n3+w4n4
[0059] At the same time, w1, w2, w3, w4 must also satisfy 1. After all backend servers in the state parameter list are scored, the backend server with the largest score is selected as the current optimal request distribution object.
[0060] The health check proxy center also needs to provide the load balancer with a service interface for obtaining the current optimal request distribution object. Here, the service interface can be implemented using an application layer protocol based on the TCP protocol, such as the HTTP protocol. The health check proxy center runs the HTTP service and provides a request URL for obtaining the current optimal request distribution object, listening to requests from the load balancer. When a load balancer distributes requests, it needs to make an HTTP request to the health check proxy center. The health check proxy center will generate a JSON-formatted result of the latest optimal request distribution object and feed it back to the load balancer, obtain the JSON-formatted request result, obtain the target of the current optimal distribution object, and update the optimal forwarding object. The load balancer then distributes the request to the corresponding backend server object.
[0061] The health check proxy center based on SNMP obtains the status information of all backend servers uniformly through SNMP, maintains the status list and calculates the best performance server. The load balancer does not need to perform polling request checks, especially when the number of backend servers is large, the performance loss of the load balancer can be significantly reduced. In addition, the load balancer of the present invention can obtain the optimal server object by sending a request to the health check proxy center once, which simplifies the request processing flow, improves the request distribution efficiency, and can quickly switch to a healthy backend server when the load balancer fails over, ensuring the high availability of the service. And the load balancer in the present invention only needs to send a request once to obtain the backend server with the current best performance, without having to perform complex health check tasks by itself, reducing system resource consumption. In addition, the load balancer can obtain the optimal server object by sending a request to the health check proxy center once, which simplifies the request processing flow, improves the request distribution efficiency, and can quickly switch to a healthy backend server when the load balancer fails over, ensuring the high availability of the service. In addition, the present invention adopts a health check proxy center to be responsible for the health check of the backend servers, integrates the state parameter acquisition, storage and calculation tasks of all backend servers, and makes management and operation more convenient.
[0062] Example 2
[0063] Reference Figure 3 The present invention also provides an operation method of a health check agent center based on SNMP, comprising the following steps:
[0064] S1: When the health check agent center starts, it first initializes the list of storage status parameters of each backend server and sets the timer task. The timer task mainly runs the SNMP request module and the calculation storage module;
[0065] S2: Whenever the timer task arrives, the SNMP request module sends an SNMP Get request to all backend servers to obtain the server status parameters. The calculation and storage module receives these parameters and updates and stores them in the backend server status parameter list. The health check algorithm calculates the performance score of each backend server and updates the backend server with the best performance according to the status parameters.
[0066] S3: The response module runs in the main program to monitor the requests of the load balancer. When a request arrives, the response module obtains the backend server object with the best performance from the computing storage module and sends the backend server object with the best performance to the load balancer. At this point, the operation of the entire health check proxy center is completed.
[0067] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A health check agent center based on SNMP, characterized in that: include: SNMP request module, the SNMP request module is used to send SNMP Get request operations to all back-end servers to obtain status parameters of the back-end servers; A computing and storage module, which is used to update the status parameter list of the local backend server, execute the health check algorithm, and calculate the backend server object with the current best performance; A response module, the response module is used to monitor the request operation of the load balancer, and return the optimal backend server object in response to the request; A load balancer, the load balancer includes a request module, which is responsible for performing HTTP request operations and is used to request a backend server object with the current best performance from a health check proxy center; The back-end server includes an SNMP agent module, which is used to receive an SNMPGet request from a health check agent center, obtain the status information result of the device and return it.
2. The SNMP-based health check agent center according to claim 1, characterized in that: The status parameters of the backend server include service process status, CPU usage and memory usage.
3. The SNMP-based health check agent center according to claim 1, characterized in that: The request module of the load balancer supports HTTP and HTTPS protocols.
4. The SNMP-based health check agent center according to claim 1, characterized in that: The load balancer also includes a failover module for automatically switching to other healthy backend servers when a backend server failure is detected.
5. The SNMP-based health check agent center according to claim 1, characterized in that: The SNMP request module supports SNMP v2c and SNMP v3 protocols.
6. The SNMP-based health check agent center according to claim 1, characterized in that: The SNMP request module can periodically send SNMP Get requests at set time intervals.
7. The SNMP-based health check agent center according to claim 1, characterized in that: The calculation method of the health check algorithm comprises the following steps: S1: In the maintained backend server status parameter list, N backend server status parameters are stored, and these status parameter indicators are scored, and the score is S. The higher the score S is, the higher the performance of the backend server is; S2: Let each state parameter value in a single server be n i (1≤i≤N), and match the weight w for each state parameter according to its importance i (0 <w i <1,1≤i≤N); S3: If the backend server is down or the service is interrupted, S=0; if the backend server is operating normally, the calculation method of its score S can be:
8. The SNMP-based health check agent center according to claim 1, characterized in that: The health check agent center also includes a log recording module for recording detailed information of all SNMP requests and responses to facilitate subsequent analysis and troubleshooting.
9. The SNMP-based health check agent center according to claim 1, characterized in that: The computing and storage module can dynamically adjust the weight parameters to adapt to the traffic characteristics of different time periods.
10. The method for operating a health check agent center based on SNMP according to any one of claims 1 to 9, characterized in that: The following steps are involved: S1: When the health check agent center starts, it first initializes the list of storage status parameters of each backend server and sets the timer task. The timer task mainly runs the SNMP request module and the calculation storage module; S2: Whenever the timer task arrives, the SNMP request module sends an SNMP Get request to all backend servers to obtain the server status parameters. The calculation and storage module receives these parameters and updates and stores them in the backend server status parameter list. The health check algorithm calculates the performance score of each backend server and updates the backend server with the best performance according to the status parameters. S3: The response module runs in the main program to monitor the requests of the load balancer. When a request arrives, the response module obtains the backend server object with the best performance from the computing storage module and sends the backend server object with the best performance to the load balancer. At this point, the operation of the entire health check proxy center is completed.
