CN111555931B - Upstream server monitoring processing method, monitor and electronic equipment - Google Patents

Upstream server monitoring processing method, monitor and electronic equipment Download PDF

Info

Publication number
CN111555931B
CN111555931B CN202010325509.9A CN202010325509A CN111555931B CN 111555931 B CN111555931 B CN 111555931B CN 202010325509 A CN202010325509 A CN 202010325509A CN 111555931 B CN111555931 B CN 111555931B
Authority
CN
China
Prior art keywords
server
upstream
upstream server
service
target
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
CN202010325509.9A
Other languages
Chinese (zh)
Other versions
CN111555931A (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 CN202010325509.9A priority Critical patent/CN111555931B/en
Publication of CN111555931A publication Critical patent/CN111555931A/en
Application granted granted Critical
Publication of CN111555931B publication Critical patent/CN111555931B/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
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • 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
    • 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/1014Server selection for load balancing based on the content of a request
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Debugging And Monitoring (AREA)
  • Computer And Data Communications (AREA)
  • Hardware Redundancy (AREA)

Abstract

The embodiment of the invention provides an upstream server monitoring processing method, a monitor and electronic equipment, wherein the monitor is deployed on each downstream server, and the monitor is used for monitoring the service state of at least one upstream server associated with the downstream server; and based on the service state, deleting the target upstream server from the upstream server list corresponding to the downstream server when determining that the service abnormity exists in the target upstream server in the at least one upstream server. Therefore, when the target upstream server is abnormal in service, the monitor can timely know and take the target upstream server off-line. The downstream server will not distribute the received user request to the target upstream server, but directly distribute the user request to the upstream server where other service processes normally operate, so that the response time of the service system is shortened, and the normal access of the user request can be ensured.

Description

Upstream server monitoring processing method, monitor and electronic equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method for processing upstream server monitoring, a monitor, and an electronic device.
Background
In a production environment, an anomaly of an upstream server depends on a detection mechanism of a downstream server. For example: after one Tomcat server is down, when a downstream Nginx server forwards a request to the Tomcat server, the request is forwarded to other Tomcat servers until a default timeout time is reached and no response is made, so that passive detection is realized. The passive detection time is generally about 10 seconds to 1 minute, the down Tomcat server is unavailable in the period, the service system has slow response and reduced availability, and the loss is large especially in killing second or high-peak activity periods.
It can be seen that the prior art has the problem of long response time of the service system.
Disclosure of Invention
An embodiment of the present invention provides a method, a monitor and an electronic device for monitoring and processing an upstream server, so as to shorten a response time of a service system. The specific technical scheme is as follows:
in a first aspect of the implementation of the present invention, there is first provided an upstream server monitoring processing method, which is applied to a monitor, where the monitor is disposed on a downstream server, and the method includes:
monitoring a service status of at least one upstream server associated with the downstream server; the service state comprises at least one of a connection state of each upstream server and a target object and an operation state of a service process corresponding to each upstream server, and the target object comprises the monitor or the registration server;
determining whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
under the condition that the target upstream server in the at least one upstream server is determined to have service abnormity, deleting the target upstream server from an upstream server list corresponding to the downstream server; the upstream server list is used for the downstream server to distribute the received user request.
In a second aspect of the present invention, there is also provided a monitor, the monitor being provided on a downstream server, the monitor including:
a monitoring module for monitoring a service status of at least one upstream server associated with the downstream server; the service state comprises at least one of a connection state of each upstream server and a target object and an operation state of a service process corresponding to each upstream server, and the target object comprises the monitor or a registration server;
a determining module, configured to determine whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
the offline module is used for deleting a target upstream server from an upstream server list corresponding to the downstream server under the condition that the target upstream server in the at least one upstream server is determined to have service abnormality; the upstream server list is used for the downstream server to distribute the received user request.
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;
the processor is configured to implement the method steps described in the first aspect of the embodiment of the present invention when executing the program stored in the memory.
In yet another aspect of the present invention, there is also provided a computer-readable storage medium having stored therein instructions, which when executed on a computer, cause the computer to execute any one of the above-described upstream server monitoring processing methods.
In yet another aspect of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the above-described upstream server monitoring processing methods.
In the monitoring processing method, the monitor and the electronic device of the upstream server provided by the embodiment of the invention, the monitor is deployed on each downstream server, and the monitor monitors the service state of at least one upstream server associated with the downstream server; and based on the service state, deleting the target upstream server from the upstream server list corresponding to the downstream server when determining that the service abnormity exists in the target upstream server in the at least one upstream server. In this way, when the target upstream server has a service abnormality, the monitor can timely know and delete the target upstream server from the upstream server list of the downstream server distribution request. The downstream server will not distribute the received user request to the target upstream server, but directly distribute the user request to the upstream server where other service processes normally operate, thereby shortening the response time of the service system and ensuring the normal access of the user request.
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 embodiments or the prior art descriptions will be briefly described below.
Fig. 1 is a flowchart of a monitoring processing method of an upstream server according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a service instance in a monitoring processing method of an upstream server according to an embodiment of the present invention;
FIG. 3 is a second flowchart of a monitoring processing method of an upstream server according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an upstream server monitoring system according to an embodiment of the present invention;
FIG. 5 is a second schematic diagram of an upstream server monitor processing system according to a second embodiment of the present invention;
fig. 6 is a third flowchart of a monitoring processing method of an upstream server according to an embodiment of the present invention;
FIG. 7 is a third schematic diagram of an upstream server monitor processing system according to an embodiment of the present invention;
FIG. 8 is a block diagram of a monitor in an embodiment of the present invention;
fig. 9 is a block 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.
Example one
Referring to fig. 1, fig. 1 is a flowchart of a monitoring processing method for an upstream server according to an embodiment of the present invention, where the method may be applied to a monitor, where the monitor is disposed on a downstream server, and the downstream server is a reverse proxy server and may distribute a user request to an upstream server associated with the downstream server based on a load balancing principle.
As shown in fig. 1, the method comprises the steps of:
step 101, monitoring the service state of at least one upstream server associated with the downstream server; the service state comprises at least one of a service process running state corresponding to the upstream server and a connection state of the upstream server and a target object, and the target object comprises the monitor or a registration server;
102, determining whether a target upstream server in the at least one upstream server has service abnormity or not based on the service state;
103, under the condition that the target upstream server in the at least one upstream server is determined to have service abnormality, deleting the target upstream server from an upstream server list corresponding to the downstream server; the upstream server list is used for the downstream server to distribute the received user request.
In the prior art, the anomaly of an upstream server depends on the detection mechanism of a downstream server, and the detection mechanism comprises active detection and passive detection. The active detection means that a downstream server sends a detection message to an upstream server at a certain time interval to detect the service state of the upstream server. Passive detection means that, when a downstream server distributes a received user request to a certain upstream server, if the upstream server goes down, the request is forwarded to another upstream server only when the upstream server waits for a default timeout period and does not respond. Therefore, whether the detection is active detection or passive detection, a certain delay exists, and the upstream server which is down in the period is unavailable, so that the service system is influenced.
In the embodiment of the invention, a monitor is deployed on each downstream server, and the monitor can monitor the service state of at least one upstream server associated with the downstream server; and based on the service state, deleting the target upstream server from the upstream server list corresponding to the downstream server when determining that the service abnormity exists in the target upstream server in the at least one upstream server.
The monitor may be deployed on the downstream server in the form of monitoring software, or may be an independent device that is connected to the downstream server and can control an upstream server list associated with the downstream server, which is not limited herein.
The downstream server is a reverse proxy server, which can distribute the received user request to at least one upstream server associated with the downstream server based on the principle of load balancing, as shown in fig. 2. It can be understood that: the downstream server can store at least one upstream server associated with the downstream server as an upstream server list, and when the downstream server receives the user request, the user request can be distributed to the target upstream server based on the upstream server list and according to a preset load balancing principle.
It should be noted that the embodiment of the present invention may be applicable to service instances of Nginx and Tomcat, where a Nginx server is a downstream server and a Tomcat server is an upstream server; other service instances may also be suitable, and are not limited herein.
In an embodiment of the present invention, the service state includes at least one of a connection state between the at least one upstream server and a target object, and an operating state of a service process corresponding to the at least one upstream server, and the target object includes the monitor or the registration server. It is understood that the service status that the monitor can monitor is not limited thereto, and is not limited thereto.
The service process corresponding to the upstream server may be understood as: each upstream server has its corresponding service product, and each service product can correspondingly execute a specific service process to provide service resources for the user request. When a service process on an upstream server runs abnormally, the upstream server cannot normally process a user request. Based on the above, by monitoring the running state of the service process corresponding to at least one upstream server associated with the downstream server, whether each upstream server has a service abnormality or not can be determined, and whether the user request can be processed continuously or not can be determined.
In addition, long connection is respectively established between at least one upstream server associated with the downstream server and the target object, and a keep-alive mechanism is arranged to monitor the connection state of each upstream server so as to determine whether each upstream server is still online or not and whether the upstream server is disconnected due to failure or downtime. Based on the above, it can also be determined whether the upstream servers have service abnormality and can continue to process the user request. The long connection may be implemented based on a Transmission Control Protocol (TCP).
The target object may be a monitor or may be an independent registration server, and at least one upstream server associated with a downstream server may register on the registration server and establish long connections respectively. It is understood that the target object may be other devices, and is not limited herein.
In a case that it is determined that a service abnormality exists in a target upstream server of the at least one upstream server, deleting the target upstream server from an upstream server list corresponding to the downstream server, which may be understood as follows: and in the case that the target upstream server in the at least one upstream server is determined to have the service abnormity, taking the target upstream server off the line. Therefore, the downstream server does not distribute the received user request to the target upstream server but directly distributes the received user request to the upstream servers with other service processes running normally, and the service system can normally respond to the user request and complete the access of the corresponding service resources.
In the method for monitoring and processing the upstream server provided by the embodiment of the invention, a monitor is deployed on each downstream server, and the monitor monitors the service state of at least one upstream server associated with the downstream server; and based on the service state, deleting the target upstream server from the upstream server list corresponding to the downstream server when determining that the service abnormity exists in the target upstream server in the at least one upstream server. In this way, when the target upstream server has a service abnormality, the monitor can timely know and delete the target upstream server from the upstream server list of the downstream server distribution request. The downstream server will not distribute the received user request to the target upstream server, but directly distribute the user request to the upstream server where other service processes normally operate, thereby shortening the response time of the service system and ensuring the normal access of the user request.
Example two
Referring to fig. 3, fig. 3 is a flowchart of another upstream server monitoring processing method according to an embodiment of the present invention, where the method may be applied to a monitor, where the monitor is disposed on a downstream server, and the downstream server is a reverse proxy server, and is capable of distributing a user request to an upstream server associated with the downstream server based on a load balancing principle.
As shown in fig. 3, the method comprises the steps of:
step 301, monitoring a service status of at least one upstream server associated with the downstream server, including: monitoring a connection status between at least one upstream server associated with the downstream server;
step 302, based on the connection status, determining that the target upstream server in the at least one upstream server has a service anomaly when the connection between the target upstream servers in the at least one upstream server is disconnected;
step 303, deleting a target upstream server from an upstream server list corresponding to the downstream server when determining that the target upstream server in the at least one upstream server has a service abnormality; the upstream server list is used for the downstream server to distribute the received user request.
In this embodiment, monitoring the service status of at least one upstream server associated with the downstream server includes: monitoring a connection status between at least one upstream server associated with the downstream server.
Specifically, the monitor may directly establish a long connection with at least one upstream server associated with the downstream server, and confirm whether the upstream server is online by receiving heartbeat packets sent by each upstream server at preset time intervals. In the process of establishing long connection with the upstream server, the monitor can timely acquire the connection state between the upstream servers.
When a target upstream server is disconnected from the monitor due to a fault or a downtime, it may be determined that the target upstream server has a service abnormality and thus cannot respond to the user request distributed thereto. At this time, the monitor may delete the target upstream server from the upstream server list corresponding to the downstream server, i.e., take the target upstream server offline. The downstream server does not distribute the received user request to the target upstream server, but distributes the received user request to the upstream servers with other service processes running normally, so that normal access of the user request is ensured.
It should be noted that, when the service state of the target upstream server with the service abnormality returns to normal, the long connection is established again between the target upstream server and the monitor after restarting, and the monitor learns that the connection of the target upstream server is normal by receiving the heartbeat packet, and then the target upstream server can be added to the upstream server list associated with the downstream server again, that is, the target upstream server is on line again. Thereafter, the downstream server may still distribute the received user request to the target upstream server.
In the upstream server monitoring processing method provided by this embodiment, the monitor may monitor the connection status of at least one upstream server associated with the downstream server, and timely learn whether each upstream server has a disconnection condition. When a certain target upstream server is monitored to be disconnected, the target upstream server is immediately offline, and the downstream server does not distribute the received user request to the target upstream server but directly distributes the received user request to other upstream servers with normal running service processes, so that the response time of a service system is shortened, and meanwhile, the normal access of the user request can be ensured.
Optionally, monitoring a service status of at least one upstream server associated with the downstream server includes: monitoring whether a process quitting instruction sent by a process listener on at least one upstream server is received or not under the condition that the at least one upstream server associated with the downstream server is kept connected, wherein the process quitting instruction is used for indicating that a corresponding service process on the at least one upstream server is already quitted;
further, when the connection with the target upstream server in the at least one upstream server is maintained and the process exit indication sent by the process listener on the target upstream server in the at least one upstream server is received, it is determined that the service exception exists in the target upstream server in the at least one upstream server.
In this embodiment, the monitor may further monitor, when at least one upstream server associated with the downstream server is kept connected, whether a process exit instruction sent by a process listener on the at least one upstream server is received, so as to monitor an operating state of a service process corresponding to each upstream server. Wherein the process exit indication is used to indicate that a corresponding service process on the at least one upstream server has exited.
Each upstream server has its corresponding service product, and each service product can correspondingly execute a specific service process to provide service resources for the user request. When a service process on an upstream server exits abnormally, the upstream server cannot process the user request normally. Based on the above, the process monitor feeds back the running state of the service process corresponding to at least one upstream server associated with the downstream server, so that whether the target upstream server with abnormal service exists can be determined.
The process listener may be deployed on each upstream server in the form of monitoring software, or may be an independent device that is connected to the upstream server and can acquire the running state of the service process corresponding to the upstream server, which is not limited herein.
As shown in fig. 4, taking the service instances of nginnx and Tomcat as an example, the nginnx server is a downstream server, and the Tomcat server is an upstream server. Each Tomcat server is deployed with a process monitor for monitoring the running state of the Tomcat process corresponding to the Tomcat server. The process monitor can maintain communication with the monitor and feed back the running state of the Tomcat service process corresponding to each Tomcat server to the monitor. When the monitor monitors that the Tomcat process of the target Tomcat server exits abnormally, the monitor may delete the target Tomcat server from the list of Tomcat servers associated with the corresponding Nginx server by using the corresponding Nginx server.
In some embodiments, the process listener may obtain the running state of the process of its upstream server through the proc file system. The proc file system establishes a proc directory for each process on the upstream server, takes a process number (PID number) corresponding to each process as a directory name, a service process corresponding to the upstream server also has a uniquely identified process number, and the proc directory is an interface for reading process information. The process listener can correspondingly acquire the running state of the service process through/proc/pid/instruction. In other embodiments, the process listener may also obtain the running state of the service process by other means, which is not limited herein.
In this embodiment, whether the service process corresponding to the target upstream server exits abnormally is determined by determining whether the target upstream server has a service abnormality. The monitor may monitor whether a process exit indication sent by the process monitor is received, where the process exit indication is used to indicate that the service process corresponding to the current target upstream server has exited.
Under the condition that the process monitor acquires the running state of the service process through the proc file system, when the service process exits, the corresponding proc directory of the service process is automatically deleted. When the process monitor monitors that the proc directory of the service process corresponding to the upstream server is deleted, a process exit indication can be immediately sent to the monitor,
and after the monitor receives the process quitting instruction, the monitor can determine that the service process corresponding to the target upstream server has service abnormality, and delete the target upstream server from an upstream server list corresponding to the downstream server under the condition that the monitor can determine that the process operation of the target upstream server has abnormality.
It should be noted that the process quitting may be a process active quitting or a process abnormal quitting. When the process exits abnormally, the process monitor monitors that the proc directory of the service process corresponding to the target upstream server is deleted, and then the proc directory can be directly fed back to the monitor. When the process needs to be normally exited, the process listener can actively send a process exit instruction to the monitor through user operation or a notification mechanism preset by the upstream server, and the service process corresponding to the target upstream server is exited after the monitor takes the target upstream server offline based on the process exit instruction. In this way, it can be further ensured that the user request is not distributed to the current target upstream server when the service process corresponding to the target upstream server exits.
It should be noted that, determining whether the service process corresponding to the target upstream server exits abnormally to determine whether the target upstream server has the service abnormality is only one implementation manner described in this embodiment, and is not limited herein.
In the monitoring processing method for the upstream server provided in this embodiment, the process monitor deployed on each upstream server monitors the running state of the service process corresponding to the upstream server, and when it is monitored that the service process corresponding to the upstream server exits, it is determined that the target upstream server has a service abnormality, the monitor can immediately take the target upstream server off-line, and the downstream server does not distribute the received user request to the target upstream server but directly distributes the received user request to the upstream server where other service processes normally run, so that the response time of the service system is shortened, and meanwhile, the normal access of the user request can be ensured.
Optionally, monitoring a service status of at least one upstream server associated with the downstream server includes: monitoring a connection state between at least one upstream server associated with the downstream server, and monitoring whether a process exit indication sent by a process listener on the at least one upstream server is received or not under the condition that the at least one upstream server associated with the downstream server is kept connected, wherein the process exit indication is used for indicating that a corresponding service process on the at least one upstream server has exited.
In this embodiment, the monitor monitors a connection state between at least one upstream server associated with the downstream server, and meanwhile, when the at least one upstream server associated with the downstream server maintains the connection, the monitor may also monitor an operation state of the service process corresponding to each upstream server by monitoring whether a process exit instruction sent by a process listener on the at least one upstream server is received. The process quit instruction is used for indicating that the corresponding service process on the at least one upstream server quits monitoring the running state of the service process corresponding to each upstream server.
As shown in fig. 5, taking the service instances of nginnx and Tomcat as an example, the nginnx server is a downstream server, and the Tomcat server is an upstream server. And each Tomcat server is deployed with a process monitor for monitoring the running state of the Tomcat process corresponding to the Tomcat server and feeding back the running state of the Tomcat service process corresponding to each Tomcat server to the monitor. When the monitor monitors that the target Tomcat server has a service abnormality, the monitor may delete the target Tomcat server from a list of Tomcat servers associated with a corresponding Nginx server by using the corresponding Nginx server.
In addition, the monitor establishes connection with each Tomcat server, and may monitor the connection status of each Tomcat server, and when the monitor monitors that the connection of the target Tomcat server is disconnected, the monitor may also delete the target Tomcat server from the list of Tomcat servers associated with the corresponding Nginx server by using the corresponding Nginx server.
Specific implementation manners and beneficial effects can refer to the descriptions of the above embodiments, and are not described herein again to avoid repetition.
EXAMPLE III
Referring to fig. 6, fig. 6 is a flowchart of a monitoring processing method for an upstream server according to an embodiment of the present invention, where the method may be applied to a monitor, where the monitor is disposed on a downstream server, and the downstream server is a reverse proxy server and may distribute a user request to an upstream server associated with the downstream server based on a load balancing principle.
As shown in fig. 6, the method comprises the steps of:
step 601, monitoring a service status of at least one upstream server associated with the downstream server, including: monitoring whether a disconnection indication sent by the registration server is received or not under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected;
step 602, determining that a service anomaly exists in a target upstream server of the at least one upstream server when a connection is established with the registration server and the disconnection indication corresponding to the target upstream server of the at least one upstream server sent by the registration server is received;
step 603, in a case that it is determined that a target upstream server in the at least one upstream server has a service abnormality, deleting the target upstream server from an upstream server list corresponding to the downstream server; the upstream server list is used for the downstream server to distribute the received user request.
In this embodiment, monitoring a service status of at least one upstream server associated with the downstream server includes: monitoring whether a disconnection indication sent by the registration server is received or not under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected.
Specifically, at least one upstream server associated with a downstream server may register on the registration server and establish a long connection, and the registration server may determine whether the upstream server is online by receiving heartbeat packets sent by each upstream server at certain time intervals. In the process of establishing long connection with the upstream server, the registration server can timely acquire the connection state between the upstream servers.
Meanwhile, a long connection is also established between the registration server and the monitor, and the registration server can feed back the connection state between the registration server and each upstream server to the monitor. The monitor may determine whether a target upstream server disconnected from the at least one upstream server exists by monitoring whether a disconnection indication sent by the registration server is received, and further determine whether the target upstream server has a service abnormality.
When a target upstream server is disconnected from the registration server due to a fault or a downtime, the registration server may send a disconnection indication corresponding to the target upstream server to the monitor, where the disconnection indication indicates that the connection between the target upstream server and the registration server has been disconnected. When the monitor receives the disconnection indication corresponding to the target upstream server, the monitor may delete the target upstream server from the upstream server list corresponding to the downstream server, that is, the target upstream server is offline. The downstream server does not distribute the received user request to the target upstream server, but distributes the user request to the upstream servers in which other service processes normally run, so that normal access of the user request is ensured.
It should be noted that, when the service state of the target upstream server with the service abnormality returns to normal, the target upstream server may re-establish the long connection with the registration server after restarting. At this time, the registration server may send a restart indication corresponding to the target upstream server to the monitor. Based on the restart indication, the monitor may add the target upstream server back to the list of upstream servers associated with the downstream server, i.e., bring the target upstream server back online. Thereafter, the downstream server may still distribute the received user request to the target upstream server.
In the upstream server monitoring processing method provided in this embodiment, the monitor may monitor the connection status of the registration server and at least one upstream server associated with the downstream server, and immediately drop the target upstream server corresponding to the disconnection indication when receiving the disconnection indication sent by the registration server, so that the downstream server does not distribute the received user request to the target upstream server but directly distributes the received user request to an upstream server where other service processes normally operate, thereby shortening the response time of the service system and ensuring normal access of the user request.
Optionally, monitoring a service status of at least one upstream server associated with the downstream server includes: under the condition that at least one upstream server associated with the downstream server is kept connected, monitoring whether a process quitting instruction sent by a process listener on the at least one upstream server is received, wherein the process quitting instruction is used for indicating that a corresponding service process on the at least one upstream server is already quitted;
further, in the case of maintaining connection with a target upstream server in the at least one upstream server and receiving the process exit indication sent by the process listener on the target upstream server in the at least one upstream server, determining that a service exception exists in the target upstream server in the at least one upstream server.
The specific implementation manner and the beneficial effects of the embodiment can refer to the description of the above embodiment, and are not described herein again to avoid repetition.
Optionally, monitoring a service status of at least one upstream server associated with the downstream server includes: monitoring whether a disconnection indication sent by the registration server is received or not in the case of establishing connection with the registration server, and monitoring whether a process quitting indication sent by a process listener on at least one upstream server is received or not in the case of keeping connection with the at least one upstream server associated with the downstream server, wherein the process quitting indication is used for indicating that a corresponding service process on the at least one upstream server is quitted.
In this embodiment, the monitor monitors whether a disconnection instruction sent by the registration server is received or not when the monitor establishes connection with the registration server, and meanwhile, when at least one upstream server associated with a downstream server maintains connection, the monitor may also monitor the running state of the service process corresponding to each upstream server by monitoring whether a process quit instruction sent by a process listener on the at least one upstream server is received or not. The process quit instruction is used for indicating that the corresponding service process on the at least one upstream server quits monitoring the running state of the service process corresponding to each upstream server.
As shown in fig. 7, taking the service instances of nginnx and Tomcat as an example, the nginnx server is a downstream server, and the Tomcat server is an upstream server. Each Tomcat server is deployed with a process monitor for monitoring the running state of the Tomcat process corresponding to the Tomcat server and feeding back the running state of the Tomcat service process corresponding to each Tomcat server to the monitor. When the monitor monitors the target Tomcat server, the monitor may delete the target Tomcat server from the list of Tomcat servers associated with the nmginx server by using the corresponding nmginx server.
In addition, the registration server establishes connection with each Tomcat server, and the monitor establishes connection with the registration server and receives the connection state of each Tomcat server sent by the registration server. When the registration server detects that the target Tomcat server is disconnected, a disconnection instruction is sent to the monitor, and the monitor may also delete the target Tomcat server from the list of Tomcat servers associated with the corresponding Nginx server by using the corresponding Nginx server of the controller.
Specific implementation manners and beneficial effects may refer to the description of the above embodiments, and are not described herein again in order to avoid repetition.
Referring to fig. 8, fig. 8 is a structural diagram of a monitor according to an embodiment of the present invention.
As shown in fig. 8, monitor 800 includes:
a monitoring module 801 for monitoring a service status of at least one upstream server associated with the downstream server; the service state comprises at least one of a connection state of each upstream server and a target object and an operation state of a service process corresponding to each upstream server, and the target object comprises the monitor or the registration server;
a determining module 802, configured to determine whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
a offline module 803, configured to delete a target upstream server from an upstream server list corresponding to the downstream server when it is determined that a service anomaly exists in the target upstream server in the at least one upstream server; the upstream server list is used for the downstream server to distribute the received user request.
Optionally, the target object is the monitor, and the monitoring module 801 is specifically configured to at least one of:
monitoring a connection status between at least one upstream server associated with the downstream server;
monitoring whether a process quitting instruction sent by a process listener on the at least one upstream server is received or not under the condition that the at least one upstream server associated with the downstream server is kept connected, wherein the process quitting instruction is used for indicating that a corresponding service process on the at least one upstream server is already quitted.
Optionally, the determining module 802 is specifically configured to:
determining that a target upstream server of the at least one upstream server has a service anomaly when at least one of:
determining, based on the connection status, a disconnection from a target upstream server of the at least one upstream server;
receiving the process exit indication sent by the process listener on the target upstream server of the at least one upstream server while maintaining the connection with the target upstream server of the at least one upstream server.
Optionally, the target object is a registration server, and the registration server establishes a connection with at least one upstream server associated with the downstream server;
the monitoring module 801 may also be configured to:
and monitoring whether a disconnection indication sent by the registration server is received or not under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected.
Optionally, the determining module 802 may be further configured to:
and under the condition that connection is established with the registration server and the disconnection indication corresponding to a target upstream server in the at least one upstream server sent by the registration server is received, determining that the target upstream server in the at least one upstream server has service abnormity.
Monitor 800 is capable of implementing various processes implemented in the method embodiments shown in fig. 1, fig. 3, and fig. 6, and is not described here again to avoid repetition.
Referring to fig. 9, fig. 9 is a structural diagram of an electronic device according to an embodiment of the present invention.
As shown in fig. 9, the electronic device 900 includes a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902 and the memory 903 are communicated with each other through the communication bus 904.
The memory 903 is used for storing computer programs.
When the processor 901 is used to execute the program stored in the memory 903, the following steps are implemented:
monitoring a service status of at least one upstream server associated with the downstream server; the service state comprises at least one of a connection state of each upstream server and a target object and an operation state of a service process corresponding to each upstream server, and the target object comprises the monitor or a registration server;
determining whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
under the condition that the target upstream server in the at least one upstream server is determined to have service abnormity, deleting the target upstream server from an upstream server list corresponding to the downstream server; the upstream server list is used for the downstream server to distribute the received user request.
Optionally, the target object is the monitor, and the monitoring of the service status of at least one upstream server associated with the downstream server includes at least one of:
monitoring a connection status between at least one upstream server associated with the downstream server;
under the condition that at least one upstream server associated with the downstream server is kept connected, whether a process quit indication sent by a process listener on the at least one upstream server is received or not is monitored, wherein the process quit indication is used for indicating that a corresponding service process on the at least one upstream server is already quitted.
Optionally, the determining, based on the service status, whether a service exception exists in a target upstream server in the at least one upstream server includes:
determining that a target upstream server of the at least one upstream server has a service anomaly when at least one of:
determining, based on the connection status, a disconnection from a target upstream server of the at least one upstream server;
receiving the process exit indication sent by the process listener on the target upstream server of the at least one upstream server while maintaining the connection with the target upstream server of the at least one upstream server.
Optionally, the target object is a registration server, and the registration server establishes a connection with at least one upstream server associated with the downstream server;
the monitoring of the service status of at least one upstream server associated with the downstream server comprises:
monitoring whether a disconnection indication sent by the registration server is received or not under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected.
Optionally, the determining, based on the service status, whether a service exception exists in a target upstream server of the at least one upstream server includes:
and under the condition that connection is established with the registration server and the disconnection indication corresponding to a target upstream server in the at least one upstream server sent by the registration server is received, determining that the target upstream server in the at least one upstream server has service abnormity.
The communication bus 904 mentioned in the electronic device 900 may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 904 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown, but this is not intended to represent only one bus or type of bus.
The communication interface 902 is used for communication between the electronic device 900 and other devices.
The Memory 903 may include a Random Access Memory (RAM), and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor 901 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, discrete Gate or transistor logic device, or discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, which has instructions stored therein, and when the computer-readable storage medium runs on a computer, the computer is caused to execute the upstream server monitoring processing method in any one of the above embodiments.
In yet another embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the upstream server monitoring processing method 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, it 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 be performed 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 computer readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, 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.) means. 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 includes one or more 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 the 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 differences from 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 (8)

1. An upstream server monitoring processing method applied to a monitor, wherein the monitor is arranged on a downstream server, and the method comprises the following steps:
monitoring a service status of at least one upstream server associated with the downstream server;
determining whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
under the condition that the target upstream server in the at least one upstream server is determined to have service abnormity, deleting the target upstream server from an upstream server list corresponding to the downstream server;
the upstream server is a server for providing service resources, the downstream server is a reverse proxy server, and the downstream server distributes the received user request based on the upstream server list;
the monitoring of the service status of at least one upstream server associated with the downstream server comprises at least one of:
monitoring a connection status between at least one upstream server associated with the downstream server;
monitoring whether a process quitting instruction sent by a process listener on at least one upstream server is received or not under the condition that the at least one upstream server associated with the downstream server is kept connected, wherein the process quitting instruction is used for indicating that a corresponding service process on the at least one upstream server is already quitted;
monitoring whether a disconnection indication sent by a registration server is received under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected, and the registration server establishes connection with at least one upstream server associated with the downstream server.
2. The method of claim 1, wherein the determining whether a target upstream server of the at least one upstream server has a service anomaly based on the service status comprises:
determining that a target upstream server of the at least one upstream server has a service anomaly when at least one of:
determining, based on the connection status, a disconnection from a target upstream server of the at least one upstream server;
receiving the process exit indication sent by the process listener on the target upstream server of the at least one upstream server while maintaining the connection with the target upstream server of the at least one upstream server.
3. The method of claim 1, wherein the determining whether a target upstream server of the at least one upstream server has a service anomaly based on the service status comprises:
and under the condition that connection is established with the registration server and the disconnection indication corresponding to a target upstream server in the at least one upstream server sent by the registration server is received, determining that the target upstream server in the at least one upstream server has service abnormity.
4. A monitor, wherein the monitor is disposed on a downstream server, the monitor comprising:
a monitoring module for monitoring a service status of at least one upstream server associated with the downstream server;
a determining module, configured to determine whether a target upstream server of the at least one upstream server has a service anomaly based on the service status;
the offline module is used for deleting a target upstream server from an upstream server list corresponding to the downstream server under the condition that the target upstream server in the at least one upstream server is determined to have service abnormality;
the upstream server is a server for providing service resources, the downstream server is a reverse proxy server, and the downstream server distributes the received user request based on the upstream server list;
the monitoring module is specifically configured to at least one of:
monitoring a connection status between at least one upstream server associated with the downstream server;
monitoring whether a process quitting instruction sent by a process listener on at least one upstream server is received or not under the condition that the at least one upstream server associated with the downstream server is kept connected, wherein the process quitting instruction is used for indicating that a corresponding service process on the at least one upstream server is already quitted;
monitoring whether a disconnection indication sent by a registration server is received under the condition of establishing connection with the registration server, wherein the disconnection indication is used for indicating that the connection between the at least one upstream server and the registration server is disconnected, and the registration server establishes connection with at least one upstream server associated with the downstream server.
5. The monitor of claim 4, wherein the determining module is specifically configured to:
determining that a target upstream server of the at least one upstream server has a service anomaly when at least one of:
determining, based on the connection status, a disconnection from a target upstream server of the at least one upstream server;
receiving the process exit indication sent by the process listener on the target upstream server of the at least one upstream server while maintaining the connection with the target upstream server of the at least one upstream server.
6. The monitor of claim 4, wherein the determination module is further operable to:
and under the condition that connection is established with the registration server and the disconnection indication corresponding to a target upstream server in the at least one upstream server sent by the registration server is received, determining that the target upstream server in the at least one upstream server has service abnormity.
7. 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 3 when executing a program stored in the memory.
8. 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 to 3.
CN202010325509.9A 2020-04-23 2020-04-23 Upstream server monitoring processing method, monitor and electronic equipment Active CN111555931B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010325509.9A CN111555931B (en) 2020-04-23 2020-04-23 Upstream server monitoring processing method, monitor and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010325509.9A CN111555931B (en) 2020-04-23 2020-04-23 Upstream server monitoring processing method, monitor and electronic equipment

Publications (2)

Publication Number Publication Date
CN111555931A CN111555931A (en) 2020-08-18
CN111555931B true CN111555931B (en) 2022-07-22

Family

ID=72003092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010325509.9A Active CN111555931B (en) 2020-04-23 2020-04-23 Upstream server monitoring processing method, monitor and electronic equipment

Country Status (1)

Country Link
CN (1) CN111555931B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101141283A (en) * 2007-02-09 2008-03-12 中兴通讯股份有限公司 Server management method and system
CN102035697A (en) * 2010-12-31 2011-04-27 中国电子科技集团公司第十五研究所 Concurrent connections performance testing system and method for file system
CN102056200A (en) * 2009-11-09 2011-05-11 中国移动通信集团广西有限公司 Service processing flow monitoring method and system
CN102394901A (en) * 2011-06-23 2012-03-28 北京新媒传信科技有限公司 Server cluster system and updating method of monitoring policies in same
KR20140045055A (en) * 2012-10-08 2014-04-16 조선대학교산학협력단 U-healthcare measurement system and method based smart phone and web service
DE202016001256U1 (en) * 2015-02-26 2016-03-22 Wolfgang Borkner System for remote control

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7610631B2 (en) * 2004-11-15 2009-10-27 Alexander Frank Method and apparatus for provisioning software
US9262238B2 (en) * 2012-01-31 2016-02-16 Red Hat, Inc. Connection management for an application in a computing platform
US8954387B2 (en) * 2012-06-07 2015-02-10 Vmware, Inc. Tracking changes that affect performance of deployed applications
CN103384212A (en) * 2013-07-24 2013-11-06 佳都新太科技股份有限公司 Double-machine high availability scheme for communication application system and implementation thereof
CN105512027B (en) * 2015-11-26 2018-10-30 珠海多玩信息技术有限公司 Process status monitoring method and device
CN105721200A (en) * 2016-01-21 2016-06-29 北京乐动卓越科技有限公司 Master-slave server system application method and system thereof
CN109218349A (en) * 2017-06-29 2019-01-15 北京微影时代科技有限公司 A kind of method and device of management server cluster
CN108366102A (en) * 2018-01-26 2018-08-03 北京奇艺世纪科技有限公司 A kind of service discovery method, device and electronic equipment based on Consul

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101141283A (en) * 2007-02-09 2008-03-12 中兴通讯股份有限公司 Server management method and system
CN102056200A (en) * 2009-11-09 2011-05-11 中国移动通信集团广西有限公司 Service processing flow monitoring method and system
CN102035697A (en) * 2010-12-31 2011-04-27 中国电子科技集团公司第十五研究所 Concurrent connections performance testing system and method for file system
CN102394901A (en) * 2011-06-23 2012-03-28 北京新媒传信科技有限公司 Server cluster system and updating method of monitoring policies in same
KR20140045055A (en) * 2012-10-08 2014-04-16 조선대학교산학협력단 U-healthcare measurement system and method based smart phone and web service
DE202016001256U1 (en) * 2015-02-26 2016-03-22 Wolfgang Borkner System for remote control

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Cloud Computing Technology and Its Applications;zhao pei;《ZTE Communications》;20101225(第04期);全文 *
基于并行文件的分层Web服务器群;王燮等;《西南民族大学学报(自然科学版)》;20070815(第04期);全文 *

Also Published As

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

Similar Documents

Publication Publication Date Title
EP2454678B1 (en) Downloading a plug-in on an instant messaging client
EP2692088B1 (en) Providing a witness service
US9237077B2 (en) Monitoring persistent client connection status in a distributed server environment
US20090257431A1 (en) Global broadcast communication system
CN111176873A (en) Micro-service automatic offline method and device, computer equipment and storage medium
CN109327544B (en) Leader node determination method and device
CN111556125B (en) Access request distribution method, load balancing equipment and electronic equipment
CN107018159B (en) Service request processing method and device, and service request method and device
CN109286525B (en) Double-computer backup method based on MQTT communication and heartbeat between main and standby
US8150958B2 (en) Methods, systems and computer program products for disseminating status information to users of computer resources
CN111555931B (en) Upstream server monitoring processing method, monitor and electronic equipment
CN111083176A (en) Cloud self-adaptive online method and device for monitoring camera
CN109150587B (en) Maintenance method and device
CN114328034B (en) Control method and device of storage equipment, electronic equipment and storage medium
JP5050014B2 (en) Network monitoring system
JP2012015629A (en) Application monitoring method of communication system
JP4863984B2 (en) Monitoring processing program, method and apparatus
CN111064608A (en) Master-slave switching method and device of message system, electronic equipment and storage medium
CN111934909A (en) Method and device for switching IP (Internet protocol) resources of host and standby machine, computer equipment and storage medium
CN110309027B (en) APP fault positioning method and device, server and terminal
CN109818870B (en) Multicast routing method, device, service board and machine readable storage medium
CN113157615B (en) Service bus communication method, electronic equipment and computer storage medium
CN117279057A (en) Link switching method and device
CN111131528B (en) Equipment network domain determining method, server and terminal
CN113839836A (en) Aggregation timeout protection method, frame device, cartridge device, and 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