CN110661673B - Heartbeat detection method and device - Google Patents

Heartbeat detection method and device Download PDF

Info

Publication number
CN110661673B
CN110661673B CN201810692078.2A CN201810692078A CN110661673B CN 110661673 B CN110661673 B CN 110661673B CN 201810692078 A CN201810692078 A CN 201810692078A CN 110661673 B CN110661673 B CN 110661673B
Authority
CN
China
Prior art keywords
server
heartbeat
client
response
request
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.)
Expired - Fee Related
Application number
CN201810692078.2A
Other languages
Chinese (zh)
Other versions
CN110661673A (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.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN201810692078.2A priority Critical patent/CN110661673B/en
Publication of CN110661673A publication Critical patent/CN110661673A/en
Application granted granted Critical
Publication of CN110661673B publication Critical patent/CN110661673B/en
Expired - Fee Related 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/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • 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

Abstract

The embodiment of the application relates to the technical field of communication, in particular to a heartbeat detection method and device. In the embodiment of the application, a first server receives a heartbeat request sent by a client, the heartbeat request is used for determining a communication state of a second server, the first server is distributed for the client when a Domain Name Server (DNS) receives a heartbeat domain name resolution request which is sent by the client and is specific to the second server, when the first server determines that an effective heartbeat response which is specific to the second server is stored, the first server sends the effective heartbeat response to the client, and the effective heartbeat response is determined based on the communication state between the first server and the second server. Therefore, the first server does not need to send each received heartbeat request to the second server and requires the second server to make feedback, and when the stored heartbeat response is effective, the first server makes feedback, so that the occupation of the heartbeat request on the resources of the second server can be reduced.

Description

Heartbeat detection method and device
Technical Field
The embodiment of the application relates to the technical field of communication, in particular to a heartbeat detection method and device.
Background
When data Transmission is performed based on a Transmission Control Protocol (TCP) and a network Protocol (IP), reliability of communication becomes a key to guarantee quality of service. In order to ensure the rapidity and stability of communication based on the TCP/IP protocol, a heartbeat detection mechanism is generally adopted between communication devices. The heartbeat detection mechanism is a data packet which is generated according to a custom protocol and is sent in a circulating mode, and is mainly used for judging whether the communication equipment is in a connection state or not. Specifically, one end sends a communication packet regularly, and if a response from the other end is not received within a specified time, it is determined that the connection with the other end has been interrupted.
In the prior art, as a large data volume transmission mode between a client and a server is started, the number of clients served by one server is increased, and the client can regularly send heartbeat detection data packets to the server for communication detection in order to ensure the stability of communication between the client and the server, which results in that a large amount of server resources are occupied by the heartbeat detection data packets of the client.
Disclosure of Invention
The embodiment of the application provides a heartbeat detection method and a heartbeat detection device, which are used for reducing occupation of a heartbeat request of a client on server resources.
The embodiment of the application provides a heartbeat detection method, which is applicable to a system comprising a plurality of clients, a first server and a second server, wherein the second server is used for providing service services for the clients, the method comprises the steps that the first server receives heartbeat requests sent by the clients, the heartbeat requests are used for determining the communication state of the second server, the first server is allocated for the clients when a Domain Name Server (DNS) receives heartbeat domain name resolution requests, which are sent by the clients and aim at the second server, when the first server determines that effective heartbeat responses aiming at the second server are stored, the effective heartbeat responses are sent to the clients, and the effective heartbeat responses are determined based on the communication state between the first server and the second server.
Optionally, after the first server receives the heartbeat request sent by the client, the method further includes: when the first server determines that no effective heartbeat response aiming at the second server is stored, the first server sends a heartbeat request to the second server, the first server receives a response instruction sent by the second server, determines the effective heartbeat response according to the response instruction, and sends the effective heartbeat response to the client. In this way, the first server can obtain the response indication from the second server under a specific condition, and a foundation is laid for the subsequent heartbeat request reception.
Optionally, the receiving, by the first server, the response instruction sent by the second server, and determining a valid heartbeat response according to the response instruction includes: and the first server receives a response instruction sent by the second server, the first server analyzes the response instruction to obtain a heartbeat response, and the first server determines the heartbeat response to be a valid heartbeat response and stores the heartbeat response to the local.
Optionally, the receiving, by the first server, the response instruction sent by the second server, and determining a valid heartbeat response according to the response instruction includes: and the first server receives the response indication sent by the second server, and the first server locally acquires the heartbeat response according to the response indication and determines the heartbeat response as a valid heartbeat response.
Optionally, the heartbeat request includes an identifier of the client, a number of times that the client sends the heartbeat request, and an operating state of the client, and after the first server receives the heartbeat request sent by the client, the method further includes: the first server generates a heartbeat record of the client according to the identification of the client, the number of times of sending heartbeat requests by the client and the running state of the client, and sends the heartbeat record of the client in a preset time period to the second server. In this way, the second server may monitor whether the client is online through heartbeat records.
Optionally, before the first server receives the heartbeat request sent by the client, the method further includes: the first server sends the heartbeat request rule to the client, the heartbeat request rule is used for enabling the client to generate a heartbeat request according to the heartbeat request rule, the heartbeat request rule is sent to the first server by the second server, and the second server generates a response instruction according to the heartbeat request rule. Therefore, the first server, the second server and the client can be unified through the heartbeat request rule, and errors are avoided in the heartbeat detection process.
The application provides a heartbeat detection's device, the device includes receiving element, processing unit and transmitting element: the device comprises a receiving unit used for receiving a heartbeat request sent by a client, wherein the heartbeat request is used for determining the communication state of a second server, the device is distributed for the client when a domain name server DNS receives the heartbeat domain name resolution request which is sent by the client and aims at the second server, and the sending unit is used for sending an effective heartbeat response to the client when the processing unit determines that the effective heartbeat response to the second server is stored, and the effective heartbeat response is determined based on the communication state between the device and the second server.
Optionally, the sending unit is further configured to send a heartbeat request to the second server when the processing unit determines that an effective heartbeat response for the second server is not stored, the receiving unit is further configured to receive a response instruction sent by the second server, and determine an effective heartbeat response according to the response instruction through the processing unit, and the sending unit is further configured to send the effective heartbeat response to the client.
Optionally, the receiving unit is specifically configured to receive a response instruction sent by the second server, and the processing unit is specifically configured to obtain a heartbeat response by analyzing the response instruction, determine the heartbeat response as a valid heartbeat response, and store the valid heartbeat response locally.
Optionally, the receiving unit is specifically configured to receive a response instruction sent by the second server, and the processing unit is specifically configured to obtain a valid heartbeat response from the local according to the response instruction.
Optionally, the heartbeat request includes an identifier of the client, a number of times the client sends the heartbeat request, and an operating state of the client, and the processing unit is further configured to: the sending unit is also used for sending the heartbeat record of the client in a preset time period to the second server.
Optionally, the sending unit is further configured to: and sending the heartbeat request rule to the client, wherein the heartbeat request rule is used for enabling the client to generate a heartbeat request according to the heartbeat request rule, the heartbeat request rule is sent to the device by the second server, and the second server generates a response instruction according to the heartbeat request rule.
In the embodiment of the application, a first server receives a heartbeat request sent by a client, the heartbeat request is used for determining a communication state of a second server, the first server is allocated to the client when a Domain Name Server (DNS) receives a heartbeat domain name resolution request, which is sent by the client and is specific to the second server, the first server sends an effective heartbeat response to the client after determining that the effective heartbeat response is stored and is specific to the second server, and the effective heartbeat response is determined based on the communication state between the first server and the second server. In this way, the second server does not need to directly receive the heartbeat requests from the clients, but responds to the heartbeat requests of the clients through the first server, and therefore system resources are saved. When receiving the heartbeat request from the client, the first server can obtain an effective heartbeat response from the local and directly respond to the client, and each received heartbeat request does not need to be sent to the second server and the second server is required to make feedback, so that the occupation of the heartbeat request on the resources of the second server can be further reduced.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a suitable system architecture according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for detecting heartbeat according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a method for detecting heartbeat according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a device for detecting heartbeat according to an embodiment of the present application.
Detailed Description
In order to make the purpose, technical solution and beneficial effects of the present application more clear and more obvious, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 illustrates a system architecture diagram applicable to the embodiment of the present application, as shown in fig. 1, including a plurality of clients 101, a first server 102, and a second server cluster 103. The second server cluster 103 may include a plurality of second servers, where the plurality of second servers in the same server cluster may be servers that provide the same service for the client 101, and each second server has its own network Protocol (IP) address. Next, the number of the first servers may be one as shown in fig. 1, and a plurality of first servers may be set according to service requirements, and each first server has its own IP address.
Based on the above system architecture diagram, the communication link between the first server and any second server in the second server cluster can be established by the client before sending the access request to the second server, or can be established in real time when the first server receives the heartbeat request sent by the first client to the second server.
When a client sends a heartbeat request to a second server in a second server cluster, a Domain Name Server (DNS) on the client side is required to resolve a target access Domain Name in the heartbeat request to obtain a specific access address including a target IP address and a target port. In this way, the client sends the heartbeat request to the first server based on the domain name resolution result.
When receiving a heartbeat request from a client for a second server, a first server may directly send a locally stored valid heartbeat response for the second server to the client according to the first server.
Fig. 2 is a schematic flowchart illustrating a method for detecting a heartbeat according to an embodiment of the present application, where as shown in fig. 2, the method includes:
step 201, a first server receives a heartbeat request sent by a client, wherein the heartbeat request is used for determining a communication state of a second server; the first server is distributed for the client by a Domain Name Server (DNS) when receiving a heartbeat domain name resolution request aiming at a second server and sent by the client;
in step 202, when the first server determines that a valid heartbeat response for the second server is stored, the valid heartbeat response is sent to the client, wherein the valid heartbeat response is determined based on the communication state between the first server and the second server.
In the embodiment of the application, the first server receives a heartbeat request sent by the client, the heartbeat request is used for determining the communication state of the second server, the first server is allocated to the client when the domain name server DNS receives the heartbeat domain name resolution request sent by the client and directed to the second server, the first server sends an effective heartbeat response to the client after determining that the effective heartbeat response directed to the second server is stored, and the effective heartbeat response is determined based on the communication state between the first server and the second server.
In this way, the second server does not need to directly receive the heartbeat requests from the clients, but responds to the heartbeat requests of the clients through the first server, and therefore system resources are saved. When receiving the heartbeat request from the client, the first server can obtain an effective heartbeat response from the local and directly respond to the client, and each received heartbeat request does not need to be sent to the second server and the second server is required to make feedback, so that the occupation of the heartbeat request on the resources of the second server can be further reduced.
In this embodiment, the second server may provide service services for the client, such as providing video, audio, text, pictures, and the like, and therefore, the second server may be referred to as a service server.
In this embodiment of the application, the first server may be a server loaded with a quid software, and may be referred to as a quid server. The web-like cache agent supports hypertext Transfer Protocol (HTTP), hypertext Transfer Protocol over Secure Socket Layer (HTTPs), and File Transfer Protocol (FTP). The method has the advantages that the bandwidth can be reduced, the response time can be prolonged, meanwhile, the method has flexible access control functions, namely, the method can determine which requests can be received by the Squid server and which requests cannot be received by the Squid server, and based on the functions, the method is an excellent server accelerator.
In addition, the Squid can optimize data between the server and the client to improve performance, and the content request is routed to the server in various ways, so that a cache server structure capable of optimizing network throughput is constructed.
Before step 201, that is, before the first server receives the heartbeat request sent by the client, in an alternative embodiment, the first server and the second server cluster already establish a communication link, after the communication link is established, the second server or the second server cluster may send the heartbeat request rule to the first server, and after the client establishes the communication link with the first server, the first server may send the heartbeat request rule to the client, so that the client may generate the heartbeat request according to the heartbeat request rule.
Optionally, the heartbeat request rule may include a very small resource class file configured by the second server for the client, for example, the very small resource class file may be a TXT file, and after receiving the heartbeat request rule, the client parses and obtains the very small resource class file, and generates a link that can be directly accessed according to the heartbeat request rule. When the client sends a heartbeat request, the link can be accessed to obtain the extremely small resource class file, the extremely small resource class file is packaged and sent to the first server as the heartbeat request, the TXT file can be an empty file, and the extremely small resource class file can also be a certain field and a character string. The advantage of a very small resource class file is that it occupies a small amount of capacity, thus saving bandwidth when the client sends a heartbeat request to the first server.
Prior to step 202, the first server receives a heartbeat request sent by the client, and the first server may determine whether a valid heartbeat response is stored for the second server. In an alternative embodiment, the first server only stores valid heartbeat responses, and the heartbeat responses can be directly sent to the client. The heartbeat response is used for determining a communication state of the first server and the second server, that is, the first server stores a valid heartbeat response, normal communication can be performed between the first server and the second server, that is, the second server can provide normal business service to the client through the first server.
In another optional embodiment, the first server receives the heartbeat request, determines that a valid heartbeat response for the second server is not stored in the first server, the first server may send the heartbeat request to the second server, receive a response indication sent by the second server, and send the heartbeat response to the client by the first server according to the response indication, where the heartbeat response is determined to be valid.
The following describes how the first server determines the effective heartbeat response according to the received response indication sent by the second server.
After receiving the heartbeat request sent by the first server, the second server may generate a response indication according to the heartbeat request in a first optional implementation manner, for example, after the content in the heartbeat request is "please reply 1", and after obtaining the heartbeat request, the second server may analyze the heartbeat request, generate "1" according to the content in the heartbeat request, encapsulate "1" into a heartbeat response, and send the heartbeat response as a part of the response indication to the first server. Correspondingly, the first server receives a response indication sent by the second server, the first server can analyze the response indication to obtain a heartbeat response, and the first server takes the heartbeat response as a valid heartbeat response and stores the heartbeat response locally. The response indication is used for instructing the first server to obtain the heartbeat response from the response indication, and the heartbeat response is saved as a valid heartbeat response to a local cache of the first server.
In a second optional implementation manner, when the first server receives the heartbeat request and determines that no valid heartbeat response for the second server is stored in the first server, a preset mark may be marked on a header of the heartbeat request according to a heartbeat request rule, and the heartbeat request with the mark may be sent to the second server. And after receiving the heartbeat request with the mark, the second server acquires the mark, but directly sends the heartbeat indication with the heartbeat response to the first server according to the mark without analyzing specific content in the heartbeat request.
Correspondingly, the first server receives a response indication sent by the second server, the first server can analyze the response indication to obtain a heartbeat response, and the first server takes the heartbeat response as a valid heartbeat response and stores the heartbeat response locally. The response indication is used for instructing the first server to obtain the heartbeat response from the response indication, and the heartbeat response is saved as a valid heartbeat response to a local cache of the first server. The processing procedure of directly returning the response indication with the heartbeat response after the second server acquires the heartbeat request with the mark is determined according to the heartbeat request rule. I.e. the second server may generate a response indication according to the heartbeat request rule.
In the second embodiment, the content in the heartbeat request may be a TXT file, a character string or null, because the second server does not generate the heartbeat response according to the content in the heartbeat request, but generates the heartbeat response according to the preset mark based on the rule of the heartbeat request. Thus, the heartbeat response is also determined according to the heartbeat request rule. Therefore, in this manner, when the first server sends the heartbeat request rule to the client, the client may determine that the second server is providing the business service for the client according to the received heartbeat response based on the heartbeat request rule.
For example, the client sends a heartbeat request with empty content according to a received heartbeat request rule, after the first server receives the heartbeat request and determines that no valid heartbeat response is stored, a preset mark is directly marked on a packet header after the heartbeat request, and the heartbeat request with the mark is sent to the second server. After receiving the heartbeat request with the mark, the second server acquires the mark, generates a heartbeat response based on a heartbeat request rule and carries the heartbeat response in a response instruction, sends the response instruction to the first server, and the first server analyzes the response instruction to acquire the heartbeat response. And storing the heartbeat response to a local cache of the first server, and sending the heartbeat response to the client. And after receiving the heartbeat response, the client analyzes the heartbeat response to obtain a special character string. The special string may indicate that the second server is providing a business service for the client, i.e. that the second server is currently available, based on information in the heartbeat request rule.
In the two manners, when the first server determines that a valid heartbeat response for the second server is not stored, the response instruction of the second server obtains a valid heartbeat response. Optionally, each heartbeat response may be time-limited, for example, the heartbeat response is valid within five minutes sent from the second server, and in the five minutes, after the first server receives any heartbeat request sent by the client, the heartbeat request may be directly fed back to the client without requesting a response of the heartbeat request from the second server. After five minutes, if the first server receives the heartbeat request, the above process is repeated. Therefore, the occupation of the heartbeat detection data packet (namely, the heartbeat request) of the client on the resources of the second server can be reduced.
In a third optional implementation manner, the first server receives a response indication sent by the second server, and the first server locally obtains the heartbeat response according to the response indication and takes the heartbeat response as a valid heartbeat response.
In the third manner, since the first server may be a Squid server, optionally, a forced cache of the heartbeat response corresponding to the heartbeat request may be configured through a refresh _ pattern attribute, that is, the heartbeat response is always stored in a local cache in the first server, but is invalid when the indication of the second server is not received.
The specific process is described below, where the first server sends the heartbeat request to the second server, and the second server may generate a response instruction according to the heartbeat request rule after receiving the heartbeat request, where the response instruction is used to instruct the first server to obtain a preset heartbeat response stored in the local cache in the subsequent process, and feed back the heartbeat response to the client. And after receiving the response instruction, the first server acquires a heartbeat response from the local cache and sends the heartbeat response to the client.
Optionally, the response indication is time limited, for example, within five minutes of receiving the response indication, the first server may obtain a heartbeat response in the local cache, that is, within the five minutes, the heartbeat response is valid, and after five minutes, if the first server receives a heartbeat request, the above process is repeated. Therefore, the occupation of the heartbeat detection data packet (namely, the heartbeat request) of the client on the resources of the second server can be reduced. It is understood that the specific setting of the effective time limit in the present specification may be determined based on practical circumstances and is not limited to the embodiments provided in the present specification.
In the embodiment of the application, a resource of a permanent cache can be written in the Squid server, the heartbeat request is equal to a request for a very small resource, and as long as the heartbeat request can hit the resource, a heartbeat response can be fed back to the client, so that the effectiveness of heartbeat is ensured. Because the Squid server utilizes the native characteristics of the Squid, a large number of concurrent heartbeat requests can be supported, and because the Squid server is easy to expand, if the current first server reaches the bottleneck of receiving the heartbeat requests, hardware can be added on the basis, and then the Squid server is deployed to expand the heartbeat service.
In an optional implementation manner, the heartbeat request includes an identifier of the client, the number of times the client sends the heartbeat request, and an operating state of the client, after the first server receives the heartbeat request sent by the client, the first server generates a heartbeat record of the client according to the identifier of the client, the number of times the client sends the heartbeat request, and the operating state of the client, and the first server sends the heartbeat record of the client in a preset time period to the second server.
Specifically, the heartbeat request is increased by three parameter values, namely index, status and client, wherein the index is mainly used for indicating that the current heartbeat request of the client is the request of the heartbeat of the number of times, the status is used for indicating the state of the current client (whether a problem exists in payment or not and the like), and the client is used for indicating the identification of the client.
For example:
http://heartbeat_domian.com:port/heartbeatinde=11&status=1& cliented=111111
the domain name or IP address of the heartbeat-domian first server, port is the port monitored by the first server, index is 11 to identify that this client has sent the heartbeat request 11 th time, status is 1 to identify that the current client has accessed normally and that the client has no other problem, and clientmeans that the heartbeat request is sent by the client identified as 111111.
Optionally, if the client 111111 disconnects after sending a plurality of heartbeat requests to the first server, the number of times of sending heartbeat requests may be reset to 0 after establishing a connection with the first server again.
The first server may classify the number of times of the heartbeat request of the client and the running state of the client carried in each heartbeat request together with the identifier of the client as a reference, and generate a heartbeat record of the client. Optionally, the first server may send the heartbeat record of each client to the second server within a preset time period.
Optionally, the first server may send the heartbeat records of the clients with the abnormal operating states to the second server, and optionally, the first server may send the heartbeat records of the clients with the abnormal operating states to the second server. Therefore, the second server can count the online conditions and the network states implemented by all the clients, and is convenient for running monitoring of the massive clients.
Optionally, an ACL rule may be added to forcibly transfer the heartbeat request to a tiny resource class file of the second server, that is, the heartbeat request content may be stored on the second server in a particularly small file format.
Fig. 3 is a schematic flowchart illustrating a method for detecting a heartbeat according to an embodiment of the present application, where as shown in fig. 3, the method includes:
step 301, after the first server and the second server cluster establish a communication link, the second server may send the heartbeat request rule to the first server;
step 302, when the client accesses the second server cluster, the address of the first server is obtained through the DNS. After the client and the first server establish a communication link, the first server sends the heartbeat request rule to the client;
step 303, the client generates a heartbeat request according to a heartbeat request rule, wherein the heartbeat request includes an identifier of the client, the number of times the client sends the heartbeat request, and an operating state of the client;
step 304, the client sends the heartbeat request to a first server;
305, after receiving a heartbeat request, a first server generates a heartbeat record of a client according to an identifier of the client, the number of times of sending the heartbeat request by the client and the running state of the client;
step 306, the first server determines whether a valid heartbeat response for the second server is stored, if yes, the step 307 is carried out, and if not, the step 309 is carried out;
step 307, the first server obtains an effective heartbeat response from the local cache;
in step 308, the first server sends the heartbeat response to the client.
Step 309, the first server may send a heartbeat request to the second server;
step 310, the second server generates a response instruction according to the heartbeat request;
step 311, the second server sends the response indication to the first server;
step 312, the first service determines a valid heartbeat response according to the response indication, and stores the heartbeat response in a local cache;
step 313, the first server sends the heartbeat response to the client.
In step 314, the first server sends the heartbeat record of the client to the second server.
In an alternative embodiment, the software may be installed directly on the second server, that is, the second server and the software are combined together, so that the investment of intermediate equipment can be saved within a certain period of time, and the cost can be saved.
Based on the above embodiments and the same concept, a schematic structural diagram of an apparatus provided in the embodiments of the present application is illustrated, and as shown in fig. 4, the heartbeat detection apparatus 400 may include a receiving unit 401, a processing unit 402, and a transmitting unit 403.
The application provides a heartbeat detection's device, the device includes receiving element, processing unit and transmitting element: the device comprises a receiving unit used for receiving a heartbeat request sent by a client, wherein the heartbeat request is used for determining the communication state of a second server, the device is distributed for the client when a domain name server DNS receives the heartbeat domain name resolution request which is sent by the client and aims at the second server, and the sending unit is used for sending an effective heartbeat response to the client when the processing unit determines that the effective heartbeat response to the second server is stored, and the effective heartbeat response is determined based on the communication state between the device and the second server.
In the embodiment of the application, the heartbeat request sent by the client is received, and the heartbeat response is sent to the client after the effective heartbeat response aiming at the second server is determined to be stored, wherein the heartbeat response is determined based on the communication state between the first server and the second server. In this way, the second server does not need to directly receive the heartbeat requests from the clients, but responds to the heartbeat requests of the clients through the device, and therefore system resources are saved. When receiving the heartbeat request from the client, the device can obtain effective heartbeat response from the local part and directly respond to the client, does not need to send each received heartbeat request to the second server and requires the second server to make feedback, and can further reduce the occupation of the heartbeat request on the resources of the second server.
In an optional implementation manner, the sending unit is further configured to send, to the second server, a heartbeat request when the processing unit determines that a valid heartbeat response for the second server is not stored, the receiving unit is further configured to receive a response indication sent by the second server, and determine, by the processing unit according to the response indication, that the heartbeat response is valid, and the sending unit is further configured to send the heartbeat response to the client.
In an optional implementation manner, the receiving unit is specifically configured to receive a response instruction sent by the second server, and the processing unit is specifically configured to parse the response instruction to obtain a heartbeat response, determine the heartbeat response as a valid heartbeat response, and store the valid heartbeat response locally.
In an optional implementation manner, the receiving unit is specifically configured to receive a response indication sent by the second server, and the processing unit is specifically configured to obtain a heartbeat response from the local according to the response indication, and determine the heartbeat response as a valid heartbeat response.
In an optional embodiment, the heartbeat request includes an identifier of the client, a number of times that the client sends the heartbeat request, and an operating state of the client, and the processing unit is further configured to: the sending unit is also used for sending the heartbeat record of the client in a preset time period to the second server.
In an optional implementation manner, the sending unit is further configured to: and sending the heartbeat request rule to the client, wherein the heartbeat request rule is used for enabling the client to generate a heartbeat request according to the heartbeat request rule, the heartbeat request rule is sent to the device by the second server, and the second server generates a response instruction according to the heartbeat request rule.
For specific description of the heartbeat detection device provided in the embodiment of the present application, reference may be made to the heartbeat detection method provided in the foregoing embodiment, which is not described herein again.
It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation. Each functional unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
In an embodiment of the present application, a computer apparatus may include a memory, a transceiver, and a processor.
The memory can be used for storing instructions and data, the memory can mainly comprise a storage instruction area and a storage data area, and the storage data area can store association relations; the storage instruction area can store an operating system, instructions required by at least one function and the like; the instructions may cause the processor to perform a method comprising: the method comprises the steps that a first server receives a heartbeat request sent by a client, the heartbeat request is used for determining the communication state of a second server, the first server is distributed for the client when a Domain Name Server (DNS) receives the heartbeat domain name resolution request which is sent by the client and aims at the second server, when the first server determines that an effective heartbeat response which aims at the second server is stored, the first server sends the effective heartbeat response to the client, and the effective heartbeat response is determined based on the communication state between the first server and the second server.
The processor is a control center of the computer equipment, is connected with various parts of the whole mobile phone by various interfaces and lines, and executes various functions and processes data of the computer equipment by operating or executing instructions stored in the memory and calling data stored in the memory. Alternatively, the processor may include one or more processing units; optionally, the processor may integrate an application processor and a modem processor, wherein the application processor mainly handles operating systems, user interfaces, application programs, and the like, and the modem processor mainly handles wireless communications. In some embodiments, the processor and memory may be implemented on a single chip, or in some embodiments, they may be implemented separately on separate chips.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any combination thereof, and when the implementation is realized by a software program, all or part of the implementation may be realized in the form of a computer program product. The computer program product includes one or more instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The instructions may be stored in or transmitted from one computer storage medium to another, for example, instructions may be transmitted from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. A computer storage medium may be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more available media. The usable medium may be a magnetic medium (e.g., a flexible Disk, a hard Disk, a magnetic tape, a magneto-optical Disk (MO), etc.), an optical medium (e.g., a CD, a DVD, a BD, an HVD, etc.), or a semiconductor medium (e.g., a ROM, an EPROM, an EEPROM, a nonvolatile memory (NAND FLASH), a Solid State Disk (SSD)), etc.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus, and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by instructions. These instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
The instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various changes and modifications may be made in the embodiments of the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to encompass such modifications and variations.

Claims (12)

1. A method for detecting heartbeat is characterized in that the method is suitable for a system comprising a first server, a second server and a plurality of clients, wherein the second server is used for providing business services for the clients; the method comprises the following steps:
the first server receives a heartbeat request sent by the client, wherein the heartbeat request is used for determining the communication state of the second server; the first server is allocated for the client by a Domain Name Server (DNS) when receiving a heartbeat domain name resolution request aiming at the second server and sent by the client;
when the first server determines that a valid heartbeat response for the second server is stored, sending the valid heartbeat response to the client, wherein the valid heartbeat response is determined based on the communication state between the first server and the second server.
2. The method of claim 1, wherein after the first server receives the heartbeat request sent by the client, further comprising:
the first server sending the heartbeat request to the second server when the first server determines that a valid heartbeat response for the second server is not stored;
the first server receives a response instruction sent by the second server, and determines a valid heartbeat response according to the response instruction;
the first server sends the valid heartbeat response to the client.
3. The method of claim 2, wherein the first server receiving a response indication sent by the second server and determining a valid heartbeat response based on the response indication comprises:
the first server receives the response indication sent by the second server;
the first server analyzes the response indication to obtain a heartbeat response;
and the first server determines the heartbeat response as the valid heartbeat response and stores the heartbeat response to the local.
4. The method of claim 2, wherein the first server receiving a response indication sent by the second server and determining a valid heartbeat response based on the response indication comprises:
the first server receives the response indication sent by the second server;
and the first server acquires the heartbeat response from the local according to the response indication and determines the heartbeat response as a valid heartbeat response.
5. The method of claim 1, wherein the heartbeat request includes an identification of the client, a number of times the client sent heartbeat requests, and an operational status of the client;
after the first server receives the heartbeat request sent by the client, the method further includes:
the first server generates a heartbeat record of the client according to the identification of the client, the number of times of sending heartbeat requests by the client and the running state of the client;
and the first server sends the heartbeat record of the client side in a preset time period to the second server.
6. The method of any of claims 1 to 5, wherein prior to the first server receiving the heartbeat request sent by the client, further comprising:
the first server sends a heartbeat request rule to the client; the heartbeat request rule is used for enabling the client to generate the heartbeat request according to the heartbeat request rule;
the heartbeat request rule is sent to the first server by the second server, and the second server generates a response indication according to the heartbeat request rule.
7. An apparatus for heartbeat detection, the apparatus comprising a receiving unit, a processing unit, and a transmitting unit:
the receiving unit is configured to receive a heartbeat request sent by a client, where the heartbeat request is used to determine a communication state of a second server; the device is distributed for the client by the domain name server when receiving a heartbeat domain name resolution request aiming at the second server and sent by the client;
the sending unit is configured to send, to the client, a valid heartbeat response when the processing unit determines that a valid heartbeat response for the second server is stored, where the valid heartbeat response is determined based on a communication state between the device and the second server.
8. The apparatus of claim 7,
the sending unit is further configured to send the heartbeat request to the second server when the processing unit determines that a valid heartbeat response for the second server is not stored;
the receiving unit is further configured to receive a response instruction sent by the second server, and determine, by the processing unit, an effective heartbeat response according to the response instruction;
the sending unit is further configured to send the valid heartbeat response to the client.
9. The apparatus of claim 8,
the receiving unit is specifically configured to receive the response indication sent by the second server;
the processing unit is specifically configured to obtain a heartbeat response from the response indication through analysis; and determining the heartbeat response as the effective heartbeat response and storing the effective heartbeat response to the local.
10. The apparatus of claim 8,
the receiving unit is specifically configured to receive the response indication sent by the second server;
the processing unit is specifically configured to locally obtain the valid heartbeat response according to the response indication.
11. The apparatus of claim 7, wherein the heartbeat request includes an identification of the client, a number of times the client sent heartbeat requests, and an operational status of the client;
the processing unit is further configured to:
generating a heartbeat record of the client according to the identification of the client, the number of times of sending heartbeat requests by the client and the running state of the client;
the sending unit is further configured to send the heartbeat record of the client to the second server within a preset time period.
12. The apparatus of any of claims 7 to 11, wherein the sending unit is further configured to:
sending a heartbeat request rule to the client; the heartbeat request rule is used for enabling the client to generate the heartbeat request according to the heartbeat request rule;
the heartbeat request rule is sent to the device by the second server, and the second server generates a response indication according to the heartbeat request rule.
CN201810692078.2A 2018-06-28 2018-06-28 Heartbeat detection method and device Expired - Fee Related CN110661673B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810692078.2A CN110661673B (en) 2018-06-28 2018-06-28 Heartbeat detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810692078.2A CN110661673B (en) 2018-06-28 2018-06-28 Heartbeat detection method and device

Publications (2)

Publication Number Publication Date
CN110661673A CN110661673A (en) 2020-01-07
CN110661673B true CN110661673B (en) 2021-02-26

Family

ID=69026460

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810692078.2A Expired - Fee Related CN110661673B (en) 2018-06-28 2018-06-28 Heartbeat detection method and device

Country Status (1)

Country Link
CN (1) CN110661673B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112770415B (en) * 2020-12-31 2023-07-14 上海连尚网络科技有限公司 Information processing method and device for wireless hotspots
CN113472606B (en) * 2021-06-29 2022-09-30 聚好看科技股份有限公司 Heartbeat overtime detection method, server and electronic equipment
CN115278213A (en) * 2022-07-11 2022-11-01 海南乾唐视联信息技术有限公司 Offline detection method, server, electronic device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815104A (en) * 2010-03-19 2010-08-25 中兴通讯股份有限公司 Network protocol address feedback method and domain name resolution server
CN102404378A (en) * 2010-09-07 2012-04-04 成都索贝数码科技股份有限公司 Streaming media distribution and transmission network system
CN102624570A (en) * 2012-04-27 2012-08-01 杭州东信北邮信息技术有限公司 Monitoring system and method for detecting availability of web server
CN102769603A (en) * 2011-05-03 2012-11-07 中国移动通信集团公司 Method, system and apparatus for data transmission
CN103560922A (en) * 2013-11-18 2014-02-05 北京特立信电子技术股份有限公司 Disaster recovery method and system
US9578567B1 (en) * 2014-08-26 2017-02-21 Luminate Wireless, Inc. Data center relocation methods and apparatus

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070168495A1 (en) * 2005-01-11 2007-07-19 Rothstein Richard S Systems and methods for network data storage

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101815104A (en) * 2010-03-19 2010-08-25 中兴通讯股份有限公司 Network protocol address feedback method and domain name resolution server
CN102404378A (en) * 2010-09-07 2012-04-04 成都索贝数码科技股份有限公司 Streaming media distribution and transmission network system
CN102769603A (en) * 2011-05-03 2012-11-07 中国移动通信集团公司 Method, system and apparatus for data transmission
CN102624570A (en) * 2012-04-27 2012-08-01 杭州东信北邮信息技术有限公司 Monitoring system and method for detecting availability of web server
CN103560922A (en) * 2013-11-18 2014-02-05 北京特立信电子技术股份有限公司 Disaster recovery method and system
US9578567B1 (en) * 2014-08-26 2017-02-21 Luminate Wireless, Inc. Data center relocation methods and apparatus

Also Published As

Publication number Publication date
CN110661673A (en) 2020-01-07

Similar Documents

Publication Publication Date Title
US11632392B1 (en) Distributed malware detection system and submission workflow thereof
US11863581B1 (en) Subscription-based malware detection
US10798112B2 (en) Attribute-controlled malware detection
US10671721B1 (en) Timeout management services
US11671402B2 (en) Service resource scheduling method and apparatus
US10601863B1 (en) System and method for managing sensor enrollment
CN106790758B (en) Method and device for accessing network object in NAT network
KR102167613B1 (en) Message push method and device
US10230644B2 (en) Distributed API proxy system and apparatus and method for managing traffic in such system
CN110661673B (en) Heartbeat detection method and device
US20230412456A1 (en) Data communication method and apparatus, electronic device, and storage medium
CN111769997A (en) Method, server, device and computer readable medium for network monitoring
CN108989420B (en) Method and system for registering service and method and system for calling service
CN112597039A (en) Virtual machine access method, system, device and computer readable storage medium
US11411887B2 (en) Method and device for performing traffic control on user equipment
CN111092958A (en) Node access method, device, system and storage medium
CN113411228B (en) Network condition determining method and server
CN114025010B (en) Method for establishing connection and network equipment
CN113285920B (en) Service access method, device, equipment and storage medium
US11546408B2 (en) Client-side measurement of computer network conditions
CN115190062A (en) Service processing method and device, electronic equipment and computer readable storage medium
CN113746909A (en) Network connection method, device, electronic equipment and computer readable storage medium
CN109510864B (en) Forwarding method, transmission method and related device of cache request
US10951501B1 (en) Monitoring availability of content delivery networks
CN105306238A (en) Terminal access method, terminal access device and terminal access system

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
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210226