CN114785846B - Method and system for heartbeat monitoring based on ProtoBuf protocol - Google Patents

Method and system for heartbeat monitoring based on ProtoBuf protocol Download PDF

Info

Publication number
CN114785846B
CN114785846B CN202210286266.1A CN202210286266A CN114785846B CN 114785846 B CN114785846 B CN 114785846B CN 202210286266 A CN202210286266 A CN 202210286266A CN 114785846 B CN114785846 B CN 114785846B
Authority
CN
China
Prior art keywords
response
heartbeat
client
server
signal
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
CN202210286266.1A
Other languages
Chinese (zh)
Other versions
CN114785846A (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.)
Nanjing University of Posts and Telecommunications
Original Assignee
Nanjing University of Posts and Telecommunications
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 Nanjing University of Posts and Telecommunications filed Critical Nanjing University of Posts and Telecommunications
Priority to CN202210286266.1A priority Critical patent/CN114785846B/en
Publication of CN114785846A publication Critical patent/CN114785846A/en
Application granted granted Critical
Publication of CN114785846B publication Critical patent/CN114785846B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • 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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a heartbeat monitoring method and a heartbeat monitoring system based on ProtoBuf protocol, wherein the method comprises the following steps: the client builds a request heartbeat packet based on ProtoBuf protocol, and sends the request heartbeat packet to the server, wherein the request heartbeat packet comprises a heartbeat instruction signal; in response to not receiving the heartbeat instruction signal, the server closes a connection channel with the client; responding to the failure to receive the response heartbeat packet, closing a connection channel between the client and the server, and reconnecting; responding to the heartbeat instruction signal, constructing a response heartbeat packet by the service end based on ProtoBuf protocol, and sending the response heartbeat packet to the client; acquiring time I when a client sends a request heartbeat packet and time II when a response heartbeat packet is received, and calculating a ping value according to the time I and the time II; comparing the ping value with a preset threshold value, and triggering an alarm signal by the server in response to the ping value being greater than or equal to the preset threshold value. The invention can improve and monitor the running speed of the server in real time.

Description

Method and system for heartbeat monitoring based on ProtoBuf protocol
Technical Field
The invention relates to a heartbeat monitoring method and system based on ProtoBuf protocol, belonging to the technical field of high concurrency.
Background
With the continuous development in the internet technology, the relationship between the life of people and the internet is more and more compact, and the activities like shopping and traveling under the influence of the internet technology are converted into online activities in the past, so that the life of people is greatly facilitated by the generation of the internet technology.
The Chinese Internet information center in 2020 issues a '46 th China Internet development status statistics report', and reports show that the number of Internet users in China reaches 9.4 hundred million by the end of 6 months in 2020, the Internet popularity rate reaches 67% compared with 3625 ten thousand in 3 months in 2020, and the Internet popularity rate is improved by 2.5 percent compared with 3 months in 2020. Meanwhile, the system is fully opened in the 5G era, people are more and more closely connected with the Internet in daily life, and the Internet interaction behaviors are more and more. In the background of the current internet age, huge service requests and wide service calls are more and more in high concurrency scenes, and the pressure faced by the system is larger and larger. For example, in the application of the WeChat red packet in the spring festival of 2021, the total receiving and transmitting amount of the WeChat red packet in the whole country breaks through 460 hundred million times in the period from the first five days, the peak value of the maximum flow of double eleven in the year 2020 is 583 ten thousand strokes/second, the peak value is 1457 times of the first double eleven in the year 2009, and the high concurrency scene has very high requirements on the application of an Internet system.
Therefore, the application provides a heartbeat monitoring method and system based on ProtoBuf protocol.
Disclosure of Invention
The invention aims to overcome the defects in the prior art and provides a ProtoBuf protocol-based heartbeat monitoring method and system, which can improve and monitor the running speed of a server in real time.
In order to achieve the above purpose, the invention is realized by adopting the following technical scheme:
in a first aspect, the present invention provides a heartbeat monitoring method based on ProtoBuf protocol, which is executed by a client:
receiving a write signal, and constructing a request heartbeat packet based on ProtoBuf protocol in response to the fact that the write signal is not received continuously within a preset time I, sending the request heartbeat packet to a server, and receiving a response heartbeat packet constructed based on ProtoBuf protocol in response to a heartbeat instruction signal by the server;
after the response heartbeat packet is sent, continuously not receiving the response heartbeat packet within the preset time II, closing a connection channel with the server side, and reconnecting;
acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II;
comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value;
The request heartbeat packet includes a heartbeat command signal.
Further, the request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
Further, after the response to the request heartbeat packet is sent, the response heartbeat packet is not received continuously within the preset time II, the connection channel with the server is closed, and the reconnection includes:
After responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within a preset time II, generating a client system activity state signal by a trigger, and transmitting the client system activity state signal to a client;
The client verifies the activity state of the client system according to the activity state signal of the client system;
Responding to the state of the client system activity as the heartbeat detection activity state, and judging the magnitude of the accumulated value I of the failed heartbeat counter of the client and the preset upper limit frequency I:
When the accumulated value I is greater than or equal to the preset upper limit times I, the client closes a connection channel with the server and reconnects the connection channel;
when the accumulated value I is smaller than the preset upper limit times I, the client sends the request heartbeat packet to the server again;
And in response to the client sending the request heartbeat packet to the server again, the client failed heartbeat counter is incremented by 1.
Further, the heartbeat monitoring method based on ProtoBuf protocol includes:
and responding to the server side to send a response heartbeat packet to the client side, and resetting the failed heartbeat counter of the client side.
In a second aspect, the present invention provides a heartbeat monitoring method based on ProtoBuf protocol, which is executed by a server side:
receiving a heartbeat instruction signal transmitted by a client, closing a connection channel with the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within preset time III, and waiting for reconnection of the client;
Responding to the heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol, and transmitting the response heartbeat packet to the client;
acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II;
comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value.
Further, the request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
Further, the responding to the heartbeat instruction signal which is not received and transmitted by the server in the preset time III, the closing of the connection channel with the client by the server includes:
responding to the fact that the request signal is not received continuously within the preset time III, generating a server system activity state signal by a server trigger, and sending the server system activity state signal to a server;
the server verifies the active state of the server system according to the active state signal of the server system;
Responding to the state of the system activity of the server side as a non-heartbeat detection state, and judging the accumulated value II of the failed heartbeat counter of the server side and the magnitude of the preset upper limit times II:
When the accumulated value II is greater than or equal to a preset upper limit number II, the server closes a connection channel with the client and waits for the client to be reconnected;
and when the accumulated value II is smaller than the preset upper limit times II, the failed heartbeat counter of the server is increased by 1.
Further, the heartbeat monitoring method based on ProtoBuf protocol includes:
and in response to the server sending the response heartbeat packet to the client, the server failure heartbeat counter is cleared.
In a third aspect, the present invention provides a heartbeat monitoring system based on ProtoBuf protocol, including:
the request response module receives the writing signal, constructs a request heartbeat packet based on ProtoBuf protocols in response to the fact that the writing signal is not received continuously within a preset time I, sends the request heartbeat packet to the server, and receives a response heartbeat packet constructed based on ProtoBuf protocols in response to the heartbeat instruction signal from the server;
The reconnection module is used for responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within the preset time II, closing a connection channel with the server and reconnecting;
the ping value calculation module is used for acquiring time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II;
And the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value.
In a fourth aspect, the present invention provides a heartbeat monitoring system based on ProtoBuf protocol, including:
The disconnection module is used for receiving the heartbeat instruction signal transmitted by the client, closing a connection channel with the client and waiting for reconnection of the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within the preset time III;
The response module is used for responding to the heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol and transmitting the response heartbeat packet to the client;
the ping value calculation module is used for acquiring time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II;
And the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value.
Compared with the prior art, the invention has the beneficial effects that:
The heartbeat monitoring method based on ProtoBuf protocol can improve and monitor the running speed of the server in real time, realize the automatic reconnection of the client and the server after downtime, optimize the network resource utilization rate and the network transmission rate in time, and improve the reliability of the normal running of the server in a high concurrency environment.
Drawings
FIG. 1 is a flow chart of one embodiment of a method for heartbeat monitoring based on the ProtoBuf protocol of the present invention;
fig. 2 is a flowchart illustrating an embodiment of a heartbeat monitoring method based on ProtoBuf protocol in accordance with the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present invention, and are not intended to limit the scope of the present invention.
After no signal transmission occurs between the client and the server for establishing connection within a preset time, calculating a ping value of the server by a heartbeat monitoring method, and judging whether the server operates normally or not.
The ProtoBuf protocol is known as Google Protocol Buffers protocol, and is a tool library developed by google and used for data storage and protocol encoding and decoding during network communication. Compared with the Json protocol and Kryo protocols, the ProtoBuf protocol has higher conversion efficiency, time efficiency and space efficiency, so the application constructs a request heartbeat packet and a response heartbeat packet based on the ProtoBuf protocol.
Example 1
The present embodiment provides a heartbeat monitoring method based on ProtoBuf protocol, referring to fig. 1, executed by a client:
S11, receiving a write signal, and responding to the fact that the write signal is not received continuously within a preset time I, constructing a request heartbeat packet based on ProtoBuf protocol, sending the request heartbeat packet to a server, and receiving response heartbeat constructed based on ProtoBuf protocol by the server in response to a heartbeat instruction signal, wherein the request heartbeat packet comprises the heartbeat instruction signal;
S12, after responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within a preset time II, closing a connection channel with the server side, and reconnecting;
s13, acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II, wherein the ping value is half of the time difference between the time I and the time II in application;
S14, comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being larger than or equal to the preset threshold value.
The heartbeat monitoring method based on ProtoBuf protocol can improve and monitor the running speed of the server in real time, realize the automatic reconnection of the client and the server after downtime, optimize the network resource utilization rate and the network transmission rate in time, and improve the reliability of the normal running of the server in a high concurrency environment.
Example 2
On the basis of embodiment 1, this embodiment describes in detail a request heartbeat packet and a response heartbeat packet.
Firstly, defining a message protocol file and an instruction type protocol file based on ProtoBuf protocols;
Then, a message class file is generated through the message protocol file, the content expression meaning of the message protocol file is consistent with that of the message class file, and the message class file is message. The instruction type protocol file is used for generating an instruction type class file, the content expressions of the instruction type protocol file and the instruction type class file are consistent, and the instruction type class file is command.
The request heartbeat packet and the response heartbeat packet both comprise a message type file and an instruction type file.
The message class file of the request heartbeat packet includes three sets of data: client identification number, client system content and instruction type; the instruction types of the request heartbeat packet include: a heartbeat instruction, a verification instruction, an uploading data instruction and a pushing data instruction; the client system content is generated by internal logic of the client system;
The instruction type file of the request heartbeat package comprises data corresponding to a heartbeat instruction, a verification instruction, an uploading data instruction and a pushing data instruction, and is generated by internal logic of a client system.
The message class file in response to the heartbeat packet includes three sets of data: a server identification number, server system content and instruction type; the instruction types of the response heartbeat packet include: responding to the instruction, verifying a return instruction, uploading a data instruction and pushing the data instruction; the content of the server system is generated by logic inside the server system.
The instruction type file of the response heartbeat packet comprises data corresponding to a response instruction, a verification return instruction, an uploading data instruction and a pushing data instruction, and is generated by internal logic of a server system.
Therefore, the request heartbeat packet of the embodiment can transmit the client identification number signal, the client system content signal, the heartbeat instruction signal, the verification instruction signal, the uploading data instruction signal and the pushing data instruction signal; the response heartbeat packet is capable of delivering a server identification number signal, a server system content signal, a response command signal, a verification return command signal, an upload data command signal, and a push data command signal.
Example 3
On the basis of embodiment 1 or 2, this embodiment describes in detail the request heartbeat cycle:
after the response heartbeat packet is sent, the response heartbeat packet is not received continuously within the preset time II, the connection channel between the client and the server is closed, and the connection channel between the client and the server is reconnected, wherein the method comprises the following steps:
S121, after responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within a preset time II, closing a connection channel with the server side, and reconnecting the connection channel comprises:
s122, after responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within a preset time II, generating a client system activity state signal by a trigger, and transmitting the client system activity state signal to a client;
s123, the client verifies the active state of the client system according to the active state signal of the client system;
S124, in response to the active state of the client system being the heartbeat detection active state, judging the magnitude of the accumulated value I of the failed heartbeat counter of the client and the preset upper limit number of times I:
When the accumulated value I is greater than or equal to the preset upper limit times I, the client closes a connection channel with the server and reconnects the connection channel;
when the accumulated value I is smaller than the preset upper limit times I, the client sends the request heartbeat packet to the server again;
S125 responds to the client sending the request heartbeat packet again to the server, the client failed heartbeat counter is incremented by 1.
In the application, in response to the client system activity state being a non-heartbeat detection activity state or the client receiving a response heartbeat packet, the client failed heartbeat counter is cleared.
Example 4
The embodiment provides a heartbeat monitoring method based on ProtoBuf protocol, referring to fig. 2, the method is executed by a server:
S21, receiving a heartbeat instruction signal transmitted by the client, and closing a connection channel with the client to wait for reconnection of the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within preset time III;
S22, responding to a heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol, and transmitting the response heartbeat packet to the client;
S23, acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II;
S24, comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being larger than or equal to the preset threshold value.
In an application, requesting a heartbeat packet includes: a client identification number signal, a client system content signal, a heartbeat instruction signal, an upload data instruction signal and a verification instruction number; the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
The heartbeat monitoring method based on ProtoBuf protocol can improve and monitor the running speed of the server in real time, realize disconnection of the client and the server after downtime, optimize the network resource utilization rate and the network transmission rate in time, and improve the reliability of normal running of the server in a high concurrency environment.
Example 5
On the basis of embodiment 4, this embodiment details the response heartbeat cycle:
And responding to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within the preset time III, closing a connection channel with the client by the server, and comprising the following steps:
S211, responding to the fact that the request signal is not received continuously within the preset time III, generating a server system activity state signal by a server trigger, and sending the server system activity state signal to a server;
S212, the server verifies the active state of the server system according to the active state signal of the server system;
S213, in response to the active state of the server system being the non-heartbeat detection active state, judging the magnitude of the accumulated value II of the server failed heartbeat counter and the preset upper limit times II:
When the accumulated value II is greater than or equal to a preset upper limit number II, the server closes a connection channel with the client and waits for the client to be reconnected;
and when the accumulated value II is smaller than the preset upper limit times II, the failed heartbeat counter of the server is increased by 1.
In the application, responding to a heartbeat instruction signal or the heartbeat detection active state of the service end system, constructing a response heartbeat packet by the service end based on ProtoBuf protocol, and sending the response heartbeat packet to the client; and in response to the server sending the response heartbeat packet to the client, the server failure heartbeat counter is cleared.
Example 6
On the basis of any one of embodiments 1-5, this embodiment starts A, B, C three servers, wherein the heartbeat packet of the a server is constructed based on the Json protocol, the heartbeat packet of the B server is constructed based on the Kryo protocol, and the heartbeat packet of the C server is constructed based on the ProtoBuf protocol.
And carrying out 10 heartbeat detection experiments on A, B, C servers simultaneously and continuously. In each experimental process, the client of each server sends lw concurrent summation calculation requests, and the ping value of each experiment of each server is counted in ms.
Ping values of 10 heart beat detection by three servers in tables 1A and B, C
Server device A B C
First experiment 11253 5689 5366
Second experiment 6605 5530 4963
Third experiment 5988 5764 5532
Fourth experiment 5633 5326 5267
Fifth experiment 6032 6011 5628
Sixth experiment 6785 5628 5536
Seventh experiment 5923 5963 5126
Eighth experiment 6555 6032 5264
Ninth experiment 6322 5786 5367
Tenth experiment
As can be seen from table 1, the ping value of the server constructing the heartbeat packet based on ProtoBuf protocol is significantly lower than Kryo protocol and Json protocol. From this, the present embodiment can improve the running speed of the server.
Example 7
The embodiment provides a heartbeat monitoring system based on ProtoBuf protocol, including:
The request response module receives the writing signal, constructs a request heartbeat packet based on ProtoBuf protocols in response to the fact that the writing signal is not received continuously within a preset time I, sends the request heartbeat packet to the server, and receives response heartbeats constructed based on ProtoBuf protocols in response to the heartbeat command signal from the server;
The reconnection module is used for responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within the preset time II, closing a connection channel with the server and reconnecting;
The ping value calculation module is used for obtaining time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II, wherein the ping value is half of the time difference between the time I and the time II;
And the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value.
Specific functional implementation of each of the functional modules described above refers to the matters related to the methods of embodiments 1-3
Example 8
The embodiment provides a heartbeat monitoring system based on ProtoBuf protocol, including:
The disconnection module is used for receiving the heartbeat instruction signal transmitted by the client, closing a connection channel with the client and waiting for reconnection of the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within the preset time III;
The response module is used for responding to the heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol and transmitting the response heartbeat packet to the client;
the ping value calculation module is used for acquiring time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II;
And the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value.
Specific functional implementation of each of the functional modules described above is described with reference to the relevant matters in the methods of embodiments 4-5
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, 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, 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.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program 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 computer program 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.
These computer program 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.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are all within the protection of the present invention.

Claims (8)

1. A heartbeat monitoring method based on ProtoBuf protocols, characterized in that it is executed by a client:
receiving a write signal, and constructing a request heartbeat packet based on ProtoBuf protocol in response to the fact that the write signal is not received continuously within a preset time I, sending the request heartbeat packet to a server, and receiving a response heartbeat packet constructed based on ProtoBuf protocol in response to a heartbeat instruction signal by the server;
after the response heartbeat packet is sent, continuously not receiving the response heartbeat packet within the preset time II, closing a connection channel with the server side, and reconnecting;
acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II;
comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value;
The request heartbeat packet comprises a heartbeat instruction signal;
The request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
2. The method for monitoring heartbeat based on ProtoBuf protocols of claim 1 wherein after the response to the sending of the request heartbeat packet, the response heartbeat packet is not received for a preset time ii, closing a connection channel with the server, and reconnecting includes:
After responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within a preset time II, generating a client system activity state signal by a trigger, and transmitting the client system activity state signal to a client;
The client verifies the activity state of the client system according to the activity state signal of the client system;
Responding to the state of the client system activity as the heartbeat detection activity state, and judging the magnitude of the accumulated value I of the failed heartbeat counter of the client and the preset upper limit frequency I:
When the accumulated value I is greater than or equal to the preset upper limit times I, the client closes a connection channel with the server and reconnects the connection channel;
when the accumulated value I is smaller than the preset upper limit times I, the client sends the request heartbeat packet to the server again;
And in response to the client sending the request heartbeat packet to the server again, the client failed heartbeat counter is incremented by 1.
3. The method for monitoring heartbeat based on the ProtoBuf protocol of claim 2 including the steps of:
and responding to the server side to send a response heartbeat packet to the client side, and resetting the failed heartbeat counter of the client side.
4. A heartbeat monitoring method based on ProtoBuf protocol is characterized in that the method is executed by a server:
receiving a heartbeat instruction signal transmitted by a client, closing a connection channel with the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within preset time III, and waiting for reconnection of the client;
Responding to the heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol, and transmitting the response heartbeat packet to the client;
acquiring time I when sending a request heartbeat packet and time II when receiving a response heartbeat packet, and calculating a ping value according to the time I and the time II;
comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value;
The request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
5. The method for monitoring a heartbeat based on the ProtoBuf protocols of claim 4 wherein the closing the connection channel with the client by the server in response to the heartbeat command signal transmitted by the server being not received within the preset time iii includes:
responding to the fact that the request signal is not received continuously within the preset time III, generating a server system activity state signal by a server trigger, and sending the server system activity state signal to a server;
the server verifies the active state of the server system according to the active state signal of the server system;
Responding to the state of the system activity of the server side as a non-heartbeat detection state, and judging the accumulated value II of the failed heartbeat counter of the server side and the magnitude of the preset upper limit times II:
When the accumulated value II is greater than or equal to a preset upper limit number II, the server closes a connection channel with the client and waits for the client to be reconnected;
and when the accumulated value II is smaller than the preset upper limit times II, the failed heartbeat counter of the server is increased by 1.
6. The method for monitoring heartbeat based on the ProtoBuf protocol of claim 5 including the steps of:
and in response to the server sending the response heartbeat packet to the client, the server failure heartbeat counter is cleared.
7. A ProtoBuf protocol-based heartbeat monitoring system, comprising:
the request response module receives the writing signal, constructs a request heartbeat packet based on ProtoBuf protocols in response to the fact that the writing signal is not received continuously within a preset time I, sends the request heartbeat packet to the server, and receives a response heartbeat packet constructed based on ProtoBuf protocols in response to the heartbeat instruction signal from the server;
The reconnection module is used for responding to the request heartbeat packet, continuously not receiving the response heartbeat packet within the preset time II, closing a connection channel with the server and reconnecting;
the ping value calculation module is used for acquiring time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II;
the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value;
The request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
8. A ProtoBuf protocol-based heartbeat monitoring system, comprising:
The disconnection module is used for receiving the heartbeat instruction signal transmitted by the client, closing a connection channel with the client and waiting for reconnection of the client in response to the fact that the heartbeat instruction signal transmitted by the client is not received continuously within the preset time III;
The response module is used for responding to the heartbeat instruction signal transmitted by the client, constructing a response heartbeat packet based on ProtoBuf protocol and transmitting the response heartbeat packet to the client;
the ping value calculation module is used for acquiring time I when the request heartbeat packet is sent and time II when the response heartbeat packet is received, and calculating a ping value according to the time I and the time II;
the alarm module is used for comparing the ping value with a preset threshold value, and triggering an alarm signal in response to the ping value being greater than or equal to the preset threshold value;
The request heartbeat packet includes: a client identification number signal, a client system content signal, an upload data instruction signal and a verification instruction number;
the response heartbeat packet includes: the server identification number signal, the server system content signal, the response command signal, the push data command signal, and the verification return command signal.
CN202210286266.1A 2022-03-23 2022-03-23 Method and system for heartbeat monitoring based on ProtoBuf protocol Active CN114785846B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210286266.1A CN114785846B (en) 2022-03-23 2022-03-23 Method and system for heartbeat monitoring based on ProtoBuf protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210286266.1A CN114785846B (en) 2022-03-23 2022-03-23 Method and system for heartbeat monitoring based on ProtoBuf protocol

Publications (2)

Publication Number Publication Date
CN114785846A CN114785846A (en) 2022-07-22
CN114785846B true CN114785846B (en) 2024-05-24

Family

ID=82425583

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210286266.1A Active CN114785846B (en) 2022-03-23 2022-03-23 Method and system for heartbeat monitoring based on ProtoBuf protocol

Country Status (1)

Country Link
CN (1) CN114785846B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546437A (en) * 2012-02-20 2012-07-04 南京邮电大学 Internet of things platform-oriented socket implementation method
CN109905259A (en) * 2017-12-08 2019-06-18 中国电信股份有限公司 Communicate to connect maintenance method, system and relevant device
CN110661673A (en) * 2018-06-28 2020-01-07 网宿科技股份有限公司 Heartbeat detection method and device
WO2020211373A1 (en) * 2019-04-19 2020-10-22 平安科技(深圳)有限公司 Heartbeat packet sending method and apparatus based on intermediate server, and computer device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102546437A (en) * 2012-02-20 2012-07-04 南京邮电大学 Internet of things platform-oriented socket implementation method
CN109905259A (en) * 2017-12-08 2019-06-18 中国电信股份有限公司 Communicate to connect maintenance method, system and relevant device
CN110661673A (en) * 2018-06-28 2020-01-07 网宿科技股份有限公司 Heartbeat detection method and device
WO2020211373A1 (en) * 2019-04-19 2020-10-22 平安科技(深圳)有限公司 Heartbeat packet sending method and apparatus based on intermediate server, and computer device

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Performance analysis of a NB-IoT based smart lamp solution with application enabled platform(Conference Paper);Lou, Sijia;《Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)》;20191231;全文 *
SCTP协议分析与仿真研究;夏云;孙力娟;叶晓国;肖甫;;计算机技术与发展;20091110(第11期);全文 *
基于改进心跳包机制的整流远程监控系统;胡志坤;何多昌;桂卫华;阳春华;;计算机应用;20080215(第02期);全文 *
多指标综合评价的负载均衡路由策略研究;倪晓军;《小型微型计算机系统》;20170215;全文 *

Also Published As

Publication number Publication date
CN114785846A (en) 2022-07-22

Similar Documents

Publication Publication Date Title
JP6686033B2 (en) Method and apparatus for pushing messages
CN111277846A (en) Live broadcast abnormity positioning method and device, computer equipment and storage medium
CN105656763A (en) Message pushing method and message pushing device
CN109274747A (en) Market gateway system and its processing method
CN114357495B (en) Prediction machine under-chain aggregation method, device, equipment and medium based on block chain
CN111459834B (en) Asynchronous transaction performance testing method and device
JP2013533555A5 (en)
CN114785846B (en) Method and system for heartbeat monitoring based on ProtoBuf protocol
CN111131499A (en) Concurrent and asynchronous task processing method and device thereof
CN103428070B (en) instant group communication method, session management server and client
CN111930548B (en) Fault simulation system for multi-cluster distributed service
CN108614820B (en) Method and device for realizing streaming source data analysis
CN113301103A (en) Data processing system, method and device
CN114640705B (en) Large-scale Internet of things terminal heartbeat monitoring method
US10506021B2 (en) Method and device for providing communication connection for a plurality of candidate applications in a mobile device
CN106850153B (en) Data retransmission method and system
CN114172958B (en) Privacy computing node, system, method, device and storage medium
CN115514746A (en) Instant messaging method, device, system, equipment and storage medium
WO2017107462A1 (en) P2p network-based data processing method, apparatus and system
Saveliev et al. Architecture of data exchange with minimal client-server interaction at multipoint video conferencing
CN114139087A (en) Transaction information subscription platform system
CN111245705B (en) Method for realizing training simulation of server and client instant messaging
CN108173849B (en) System and method for monitoring video service quality
CN114095404B (en) Video equipment state calculation output method, device and equipment based on stream calculation
CN102546539B (en) Interaction method and interaction system for implementing energy conservation of network client sides

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