A server online control method and device
By analyzing the health check and abnormal causes of the server, it was decided whether to carry out warmth and solve the problem of adding the new server in the server cluster due to excessive traffic, ensuring the stable operation of the business.
Patent Information
- Application Number
- CN202111619197.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-12-27
AI Technical Summary
In the server cluster, as the server service time increases, the performance of the back-end server is insufficient, resulting in the new server being easily downtime when processing a large amount of access traffic, causing business to stagnate.
By conducting a health check in the server, judging its health and historical health state, determine whether the abnormal cause is a traffic overload, and check whether the storage has a session to keep records, and decide whether to warmly go online.
When the server is launched, choose the appropriate launch strategy according to the actual situation to avoid business hanging and ensure the stable operation of the server cluster.
Smart Images

Figure CN114296919B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of load balancing, and in particular to a server online control method and device. Background Art
[0002] At present, server load balancing has been widely used in major server clusters, so that managers can distribute access traffic to various backend servers through built-in scheduling algorithms. However, in practice, it is found that as the service time of the server increases, the backend server will often have insufficient performance, so that new servers with the same business have to be added to the server cluster. However, since the working performance of the newly added server is difficult to achieve stability in a short period of time, if the newly added server is required to handle a large and relatively fixed amount of access traffic per unit time from the beginning, it is very likely that the newly added server will crash due to excessive access traffic, resulting in business suspension. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a server online control method and device, which can perform online control according to the situation of the server, so that the server can stably join the server cluster to perform corresponding work, thereby avoiding business freezing when the server is online.
[0004] A first aspect of an embodiment of the present application provides a server online control method, including:
[0005] Perform a health check on the server to obtain the current health status;
[0006] Determining whether the current health status is normal;
[0007] When the current health status is the normal status, determining whether the historical health status last recorded by the server is an abnormal status;
[0008] When the historical health status is the abnormal status, determining whether the abnormal cause of the server is traffic overload;
[0009] When the abnormal reason is the traffic overload, determining whether the server stores a session retention record;
[0010] When the server does not store the session retention record, the server is controlled to go online warmly.
[0011] In the above implementation process, the method can detect the change of the health status of the server to be put online, wherein, when the health status changes from abnormal state to normal state, the method can further determine whether the cause of the previous abnormality is traffic overload, and if so, determine whether there is a past session record in the server, and only when there is no past session record in the server, the method controls the server to go online warmly; on the other hand, the method can also control the server to go online warmly when the abnormal cause is not traffic overload. It can be seen that by implementing this implementation method, it is possible to determine whether a warm online is required according to the change of the health status of the server, so that the server can select a suitable online strategy according to the actual situation when going online, thereby avoiding the occurrence of business hangs while ensuring the normal use of the business; on the other hand, the method can also be used in the dynamic load balancing process of the server cluster, so that when an abnormal server appears in the server cluster or when the abnormal server is restored, the server can be stably controlled to go online, thereby ensuring the normal operation of the server cluster and avoiding the occurrence of business hangs.
[0012] Furthermore, the step of performing a health check on the server to obtain the current health status includes:
[0013] Perform an http health check on the server to get the current health status.
[0014] Furthermore, the method further comprises:
[0015] When the current health status is not the normal status, determining whether the historical health status last recorded by the server is the normal status;
[0016] When the historical health status is the normal status, the abnormal reason of the server is obtained and recorded.
[0017] Furthermore, the method further comprises:
[0018] When the abnormal reason is not traffic overload, the server is controlled to be online warmly.
[0019] Furthermore, the method further comprises:
[0020] When the server stores the session retention record, the server is controlled to go online directly.
[0021] A second aspect of an embodiment of the present application provides a server online control device, the server online control device comprising:
[0022] Health check unit, used to perform health check on the server and obtain the current health status;
[0023] A first judging unit, used to judge whether the current health status is a normal state;
[0024] A second judgment unit is used to judge whether the historical health state recorded last by the server is an abnormal state when the current health state is the normal state;
[0025] A third judgment unit is used to judge whether the abnormal cause of the server is traffic overload when the historical health status is the abnormal state;
[0026] a fourth determination unit, configured to determine whether the server stores a session retention record when the abnormal cause is the traffic overload;
[0027] An online control unit is used to control the server to go online warmly when the server does not store the session retention record.
[0028] In the above implementation process, the device can perform multi-level detection on changes in health status, possible causes of server abnormalities, and session retention records that may be stored in the server, and obtain corresponding detection results; when the detection results are obtained, the device can control the server online according to the detection results, so that the server can choose whether to go online warmly or directly according to actual conditions, thereby allowing the server to go online stably and avoid business hangs.
[0029] Furthermore, the health check unit is specifically used to perform an http health check on the server to obtain a current health status.
[0030] Furthermore, the server online control device also includes:
[0031] The second judging unit is further configured to judge whether the historical health status last recorded by the server is a normal state when the current health state is not the normal state;
[0032] The abnormality recording unit is used to obtain and record the abnormality cause of the server when the historical health status is the normal status.
[0033] A third aspect of an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the server online control method described in any one of the first aspect of the embodiment of the present application.
[0034] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the server online control method described in any one of the first aspect of the embodiment of the present application is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A schematic diagram of a flow chart of a server online control method provided in an embodiment of the present application;
[0037] Figure 2 A schematic diagram of the structure of a server online control device provided in an embodiment of the present application;
[0038] Figure 3 A schematic diagram of the network topology on which a server online control method provided in an embodiment of the present application relies when executing. DETAILED DESCRIPTION
[0039] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0040] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0041] Example 1
[0042] Please see Figure 1 , Figure 1 A flow chart of a server online control method is provided for an embodiment of the present application. The server online control method includes:
[0043] S101. Perform an http health check on the server to obtain the current health status.
[0044] In this embodiment, http health check refers to a method of using http(s) protocol to monitor the target IP address to monitor indicators such as network reachability, service availability, and first packet delay of the web server of the IP address.
[0045] In this embodiment, the method requires performing an http health check on the server.
[0046] In this embodiment, the method can perform an http health check on the server, and when the check is completed, the current health status (ie, the health check result) obtained is stored in the corresponding memory for preservation in preparation for call.
[0047] S102, determine whether the current health status is normal, if so, execute step S103; if not, end this process.
[0048] As an optional implementation, the method further includes:
[0049] When the current health status is not normal, determine whether the historical health status last recorded by the server is normal;
[0050] When the historical health status is normal, obtain and record the abnormal reason of the server.
[0051] In this embodiment, when the method detects that the current health status of the server is abnormal, it can check whether the abnormal cause of the current server is traffic overload. If so, the abnormal cause is recorded as traffic overload; otherwise, the abnormal cause is recorded as other reasons.
[0052] S103, determine whether the historical health status recorded by the server last time is an abnormal state, if so, execute step S104; if not, end this process.
[0053] In this embodiment, when the historical health status is abnormal and the current health status is normal, it is considered that the server status has changed from abnormal to normal, and the abnormal reason that makes the server abnormal is checked. Specifically, the method checks whether the abnormal reason of the server is traffic overload.
[0054] S104, determine whether the abnormal reason of the server is traffic overload, if so, execute step S105; if not, execute step S106.
[0055] In this embodiment, if the abnormal reason is traffic overload, the method can continue to check whether the user device has had a session with the server and leave a session record. If yes, the server goes online directly to provide services without warm online.
[0056] In this embodiment, if the abnormal reason is not traffic overload, the server is still put online warmly, and the speed of the service processing traffic is gradually improved, so that it can finally provide services to users at full capacity.
[0057] S105: Determine whether the server stores session retention records. If yes, execute step S107; if not, execute step S106.
[0058] In this embodiment, if the abnormal reason is traffic overload, but there is no session record, the server still needs to be warm-up online to gradually increase the speed at which the server processes traffic, and ultimately enable it to provide services to users at full capacity.
[0059] S106. Control the server to go online warmly.
[0060] In this embodiment, warm launch is used to indicate opening the functions of the server part by part to avoid loading a large amount of traffic data at one time, thereby avoiding downtime or business suspension.
[0061] S107. The control server goes online directly.
[0062] In this embodiment, controlling the server to go online directly can allow the user equipment to continue to use the commonly used server, thereby improving the user experience.
[0063] In this embodiment, the method can determine whether the server needs to be warm-connected by determining the reason for the abnormal health status of the server and whether the server stores the session retention record of the device; wherein, if the server is abnormal due to traffic overload and there is a session retention record on the device, the server does not perform a warm-connection, but goes online directly to provide services to users to ensure that users have a good Internet experience.
[0064] For example, this embodiment takes the server traffic overload as an example to introduce the online control process when the server changes from an unavailable state to an available state. Figure 3 The network topology diagram that this method relies on for execution is used to represent a load balancing environment, in which three servers server1, server2, and server3 are arranged, and the scheduling algorithm is polling; at the same time, each server is configured with http health check method, warm online and other functions.
[0065] Specifically, when performing an http health check on server server3 and determining that the current health status is abnormal, check whether the server traffic is overloaded. If so, mark the server3 abnormality as traffic overload; if not, mark the server3 abnormality as other reasons. At this time, the old session traffic can still be forwarded to server3 for processing, while the new session traffic is only allowed to be forwarded to server1 and server2 for processing.
[0066] On the other hand, when server3 is re-detected as normal and the cause of the abnormality is server traffic overload, the method can detect whether there is session retention data related to the device in server3. If there is session retention data on server3, there is no need to perform warm online, and the forwarded traffic can be processed directly online. In addition, if the cause of the abnormality is not traffic overload or there is no session retention record, warm online is performed directly so that server3 can provide corresponding services according to the warm online rules.
[0067] By implementing this implementation method, the abnormal reasons for the server's traffic overload and the session retention records can be added to the process of determining whether a warm online operation is possible, so that the service quality of the server and the business on the load device can be organically combined, and the server that has returned to normal can provide services in a timely manner, so that users have a good Internet experience, and the server's work efficiency can be improved, which helps to reduce the work pressure of other servers.
[0068] In this embodiment, the execution subject of the method may be a computing device such as a computer or a server, and no limitation is made in this embodiment.
[0069] In this embodiment, the execution subject of the method may also be a smart device such as a smart phone, a tablet computer, etc., which is not limited in this embodiment.
[0070] It can be seen that the implementation of the server online control method described in this embodiment can detect the health status change of the server to be online, wherein, when the health status changes from abnormal state to normal state, the method can further determine whether the cause of the previous abnormality is traffic overload, if so, then determine whether there is a past session record in the server, and when there is no past session record in the server, the method controls the server to go online warmly; on the other hand, the method can also control the server to go online warmly when the abnormal cause is not traffic overload. It can be seen that the implementation of this implementation method can determine whether a warm online is required according to the change of the health status of the server, so that the server can select a suitable online strategy according to the actual situation when it goes online, thereby ensuring the normal use of the business while avoiding the occurrence of business hangs; on the other hand, the method can also be used in the dynamic load balancing process of the server cluster, so that when an abnormal server appears in the server cluster or when the abnormal server recovers, the server can be stably controlled to go online, thereby ensuring the normal operation of the server cluster and avoiding the occurrence of business hangs.
[0071] Example 2
[0072] Please see Figure 2 , Figure 2This is a schematic diagram of the structure of a server online control device provided in an embodiment of the present application. Figure 2 As shown, the server online control device includes:
[0073] A health check unit 210 is used to perform a health check on the server to obtain a current health status;
[0074] The first judging unit 220 is used to judge whether the current health status is normal;
[0075] The second judgment unit 230 is used to judge whether the historical health status last recorded by the server is an abnormal state when the current health status is a normal state;
[0076] The third judgment unit 240 is used to judge whether the abnormal cause of the server is traffic overload when the historical health status is an abnormal state;
[0077] The fourth determination unit 250 is used to determine whether the server stores a session retention record when the abnormal cause is traffic overload;
[0078] The online control unit 260 is used to control the server to go online warmly when the server does not store any session retention records.
[0079] As an optional implementation, the health check unit 210 is specifically used to perform an http health check on the server to obtain the current health status.
[0080] As an optional implementation manner, the server online control device also includes:
[0081] The second judgment unit 230 is further used to judge whether the historical health status last recorded by the server is normal when the current health status is not normal;
[0082] The abnormality recording unit 270 is used to obtain and record the abnormality reason of the server when the historical health status is normal.
[0083] As an optional implementation, the online control unit 260 is also used to control the server to go online warmly when the abnormal reason is not traffic overload.
[0084] As an optional implementation, the online control unit 260 is further used to control the server to go online directly when the server stores a session retention record.
[0085] In this embodiment, the server online control device may be a load balancing device, or may be a part of the load balancing device, which is not limited in this embodiment.
[0086] In the embodiment of the present application, the explanation of the server online control device can refer to the description in Example 1, and will not be further elaborated in this embodiment.
[0087] It can be seen that the server online control device described in the present embodiment can determine whether a warm online process is required according to changes in the health status of the server, so that the server can select a suitable online strategy according to actual conditions when going online, thereby ensuring normal use of the business while avoiding business hangs; on the other hand, the method can also be used in the dynamic load balancing process of the server cluster, so that when an abnormal server appears in the server cluster or when the abnormal server is restored, the server can be stably controlled to go online, thereby ensuring the normal operation of the server cluster and avoiding business hangs.
[0088] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the server online control method in Embodiment 1 of the present application.
[0089] An embodiment of the present application provides a computer-readable storage medium storing computer program instructions. When the computer program instructions are read and executed by a processor, the server online control method in Embodiment 1 of the present application is executed.
[0090] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0091] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0092] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0093] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0094] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0095] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
Claims
1. A server online control method, characterized in that: include: Perform a health check on the server to obtain the current health status; Determining whether the current health status is normal; When the current health status is the normal status, determining whether the historical health status last recorded by the server is an abnormal status; When the historical health status is the abnormal status, determining whether the abnormal cause of the server is traffic overload; When the abnormal reason is the traffic overload, determining whether the server stores a session retention record; When the server does not store the session retention record, controlling the server to go online warmly; When the server stores the session retention record, the server is controlled to go online directly.
2. The server online control method according to claim 1, characterized in that: The step of performing a health check on the server to obtain the current health status includes: Perform an http health check on the server to get the current health status.
3. The server online control method according to claim 1, characterized in that: The method further comprises: When the current health status is not the normal status, determining whether the historical health status last recorded by the server is the normal status; When the historical health status is the normal status, the abnormal reason of the server is obtained and recorded.
4. The server online control method according to claim 1, characterized in that: The method further comprises: When the abnormal reason is not traffic overload, the server is controlled to be warm online.
5. A server online control device, characterized in that: The server online control device comprises: Health check unit, used to perform health check on the server and obtain the current health status; A first judging unit, used to judge whether the current health status is a normal state; A second judgment unit, configured to judge whether the historical health state recorded last by the server is an abnormal state when the current health state is the normal state; A third judgment unit is used to judge whether the abnormal cause of the server is traffic overload when the historical health status is the abnormal state; a fourth determination unit, configured to determine whether the server stores a session retention record when the abnormal cause is the traffic overload; An online control unit, used for controlling the server to go online warmly when the server does not store the session retention record; The online control unit is further used to control the server to go online directly when the server stores the session retention record.
6. The server online control device according to claim 5, characterized in that: The health check unit is specifically used to perform an http health check on the server to obtain the current health status.
7. The server online control device according to claim 5, characterized in that: The server online control device also includes: The second judgment unit is further configured to judge whether the historical health status last recorded by the server is a normal state when the current health state is not the normal state; The abnormality recording unit is used to obtain and record the abnormality cause of the server when the historical health status is the normal status.
8. An electronic device, characterized in that: The electronic device comprises a memory and a processor, the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the server online control method according to any one of claims 1 to 4.
9. A readable storage medium, characterized in that: The readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the server online control method according to any one of claims 1 to 4 is executed.
Citation Information
Patent Citations
Method and device for access flow control
CN106254542A
Service processing method, device and system
CN107682406A