CN104601376A - Heartbeat message sending method and device - Google Patents

Heartbeat message sending method and device Download PDF

Info

Publication number
CN104601376A
CN104601376A CN201510008018.0A CN201510008018A CN104601376A CN 104601376 A CN104601376 A CN 104601376A CN 201510008018 A CN201510008018 A CN 201510008018A CN 104601376 A CN104601376 A CN 104601376A
Authority
CN
China
Prior art keywords
time
heartbeat message
network delay
negotiation
message
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.)
Granted
Application number
CN201510008018.0A
Other languages
Chinese (zh)
Other versions
CN104601376B (en
Inventor
李德果
朱明明
阮利
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Huawei Digital Technologies Co Ltd
Original Assignee
Beijing Huawei Digital Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Huawei Digital Technologies Co Ltd filed Critical Beijing Huawei Digital Technologies Co Ltd
Priority to CN201510008018.0A priority Critical patent/CN104601376B/en
Publication of CN104601376A publication Critical patent/CN104601376A/en
Application granted granted Critical
Publication of CN104601376B publication Critical patent/CN104601376B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a heartbeat message sending method and device and belongs to the communication field. The method comprises the following steps: obtaining the network time delay of N pieces of heartbeat message sent to the server before the current time; confirming the new negotiation timeout time T2 according to the network time delay of N pieces of heartbeat message and the negotiation timeout time T1 of the client; and sending the following heartbeat message to the server according to the negotiation timeout time T2. The method adjusts the negotiation timeout time currently used according to the network time delay of the sent heartbeat message, so that the negotiation timeout time is shortened as far as possible under the premise of meeting the fault detection accuracy for avoiding longer average fault detection time delay, the high fault detection accuracy rate and low fault detection time delay can be achieved.

Description

Heartbeat message sending method and device
Technical field
The present invention relates to the communications field, particularly a kind of heartbeat message sending method and device.
Background technology
Zookeeper has been applied to the distributed system in a lot of field as a kind of effective coordination service.Zookeeper is divided into client part and server section, and the fault detect of client is then one comparatively conventional in the application of Zookeeper.
In the prior art, static failure detection algorithm is adopted between the server of Zookeeper and client.Client and server are made an appointment one and are consulted time-out time (English full name: Negotiated SessionTimeout, abbreviation: NST), client sends heartbeat message (Ping message) to server end with the NST of 1/3rd in the cycle, after server receives heartbeat message, the overtime moment of the connection between this client and server is increased a NST, and reply heartbeat message (Pong message) to client.If server end does not receive the Ping message that client is sent in a NST, then think that client there occurs fault.If do not receive the Pong message that server end is sent in 2/3rds NST of client after transmission Ping message, then client determining server end time-out.
Realizing in process of the present invention, applicant finds that prior art at least exists following shortcoming:
In prior art, to ensure the accuracy of fault detect, just need to consult the comparatively large of time-out time setting, and it is long that mean failure rate can be made like this to detect time delay, when negotiation time-out time is set to fixed value, the accuracy rate of high fault detect and the time delay of low fault detect cannot be taken into account.
Summary of the invention
In order to solve in prior art, negotiation time-out time is set to fixed value, cause the problem cannot taking into account the accuracy rate of high fault detect and the time delay of low fault detect, embodiments providing a kind of heartbeat message sending method and device.Described technical scheme is as follows:
First aspect, provides a kind of heartbeat message sending method, and in client, described method comprises:
The network delay of N number of heartbeat message that the forward direction server obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
According to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
By the negotiation time-out time of described client by T 1be updated to T 2;
According to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to described server.
In the first possibility implementation of first aspect, for each heartbeat message in described N number of heartbeat message, described heartbeat message is included when being sent out, the system time t of described terminal in described heartbeat message and response message corresponding to described heartbeat message 1; The network delay of N number of heartbeat message of the forward direction server transmission of described acquisition current time, comprising:
When receiving response message corresponding to described heartbeat message, obtain the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2;
Determine the network delay δ=t of described heartbeat message 2-t 1;
To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N.
In conjunction with the first possibility implementation of first aspect, in the second possibility implementation of first aspect, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue;
Whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0;
If testing result is the mean value of described N number of network delay be greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
In conjunction with the first possibility implementation of first aspect, in the third possibility implementation of first aspect, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue;
Whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0;
If testing result is the maximum of described N number of network delay be greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
In conjunction with the first possibility implementation of first aspect, in the 4th kind of possibility implementation of first aspect, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue;
Whether the mean value detecting described N number of network delay is less than z*T 1, z > 0;
If testing result is the mean value of described N number of network delay be less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
In the 5th kind of possibility implementation of first aspect, described method also comprises:
By the negotiation time-out time T after described renewal 2send to described server.
Second aspect, provides a kind of heartbeat message dispensing device, and in client, described device comprises:
Delay acquisition module, the network delay of N number of heartbeat message that the forward direction server for obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
Consult time-out time determination module, for according to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
Consult time-out time update module, for by the negotiation time-out time of described client by T 1be updated to T 2;
Message sending module, for according to upgrade after negotiation time-out time T 2follow-up heartbeat message is sent to described server.
In the first possibility implementation of second aspect, described delay acquisition module, for for each heartbeat message in described N number of heartbeat message, when receiving response message corresponding to described heartbeat message, obtain the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2; Determine the network delay δ=t of described heartbeat message 2-t 1; To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N;
Wherein, described heartbeat message is included in described heartbeat message and response message corresponding to described heartbeat message when being sent out, the system time t of described terminal 1.
In conjunction with the first possibility implementation of second aspect, in the second possibility implementation of first aspect, described negotiation time-out time determination module, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0, if the mean value that testing result is described N number of network delay is greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
In conjunction with the first possibility implementation of second aspect, in the third possibility implementation of first aspect, described negotiation time-out time determination module, for when described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue, whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0, if the maximum that testing result is described N number of network delay is greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
In conjunction with the first possibility implementation of second aspect, in the 4th kind of possibility implementation of first aspect, described negotiation time-out time determination module, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is less than z*T 1, z > 0, if the mean value that testing result is described N number of network delay is less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
In the 5th kind of possibility implementation of second aspect, described device also comprises:
Consult time-out time sending module, for by the negotiation time-out time T after described renewal 2send to described server.
The beneficial effect that the technical scheme that the embodiment of the present invention provides is brought is:
The network delay of the N number of heartbeat message sent by the forward direction server of current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly described, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the method flow diagram of the heartbeat message sending method that one embodiment of the invention provides;
Fig. 2 is the method flow diagram of the heartbeat message sending method that another embodiment of the present invention provides;
Fig. 3 is that the network delay that another embodiment of the present invention provides obtains and consults time-out time renewal schematic diagram;
Fig. 4 is the structure drawing of device of the heartbeat message dispensing device that one embodiment of the invention provides;
Fig. 5 is the structure drawing of device of the heartbeat message dispensing device that another embodiment of the present invention provides;
Fig. 6 is the block diagram of the client that one embodiment of the invention provides.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
Please refer to Fig. 1, it illustrates the method flow diagram of the heartbeat message sending method that one embodiment of the invention provides.This heartbeat message sending method may be used in client.This heartbeat message sending method can comprise:
Step 102, the network delay of N number of heartbeat message that the forward direction server obtaining current time sends, this network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer.
Step 104, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of this client 1determine new negotiation time-out time T 2.
Step 106, by the negotiation time-out time of this client by T 1be updated to T 2.
Step 108, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to this server.
In sum, the heartbeat message sending method that the embodiment of the present invention provides, the network delay of the N number of heartbeat message sent by the forward direction server obtaining current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
In order to be further described the scheme shown in above-mentioned Fig. 1, please refer to Fig. 2, it illustrates the method flow diagram of the heartbeat message sending method that another embodiment of the present invention provides.This heartbeat message sending method may be used in client.This heartbeat message sending method can comprise:
In step 202., with T 1/ 3 send N number of heartbeat message for the cycle to server, T 1for the negotiation time-out time of client.
Client is when being connected with server, consulting time-out time with 1/3rd is the cycle send heartbeat message to server, also referred to as Ping message, if the network between client and server is unobstructed, server receives this Ping message smoothly, then can return a Pong message to client, identical information is carried in this Ping message and Pong message, if client receives the Pong message of client end response in the scheduled time after Ping message sending, then confirm with the connection of server normal.
In embodiments of the present invention, system time when type of message, message ID and client send Ping message can only be carried in the Ping message that sends of user end to server and the Pong message that returns of server; The message ID carried in the Ping message successively sent can increase progressively successively.
In step 204, for each heartbeat message in this N number of heartbeat message, when receiving response message corresponding to this heartbeat message, obtain the system time t comprised in this response message 1, and the system time t of this terminal when this response message is received 2.
When client receives a Pong message, can extract and to carry in this Pong message, client sends system time during corresponding Ping message.Client also obtains system time when receiving this Pong message simultaneously.
In step 206, the network delay δ=t of this heartbeat message is determined 2-t 1.
System time during this client got transmission Ping message and the time interval between system time when receiving corresponding Pong message are retrieved as the network delay of this Ping message by client.
In a step 208, to be added into by the network delay δ of this heartbeat message and to pre-set, length is the circle queue of N.
Pre-setting a length in client is N number of circle queue, if client obtains the network delay of a Ping message, and this circle queue state less than, then the network delay of this Ping message is added in this circle queue as an element.
Concrete, network delay as shown in Figure 3 obtains and consults time-out time and upgrades schematic diagram, and wherein, client is with T 1/ 3 is the cycle send Ping message to server, when server receives Ping message at every turn, namely return a corresponding Pong message to client, sending Ping message to the time received corresponding Pong message from client is network delay δ this Ping message.In figure 3, circle queue length is fixed as 8, each network delay δ that client will get 1, δ 2, δ 3δ 8be added into circle queue.
In step 210, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of this client 1determine new negotiation time-out time T 2.
Concrete, client can determine new negotiation time-out time according to three kinds of modes below:
1) when this circle queue is expired, the mean value of the N number of network delay in this circle queue is obtained; Whether the mean value detecting this N number of network delay is greater than x*T 1, x > 0; If testing result is the mean value of this N number of network delay be greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
For Fig. 3, when being added into 8 elements in circle queue, client obtains each network delay in circle queue, calculates its mean value, and compares this mean value and T 1/ 3 10% between magnitude relationship, if this mean value is greater than T 1/ 3 10%, then the network delay of Ping message sent before illustrating is bigger than normal, now, new negotiation time-out time can be defined as T 2=(1+0.1) T 1, as new negotiation time-out time after increasing 10% by former negotiation time-out time.
2) when this circle queue is expired, the maximum of the N number of network delay in this circle queue is obtained; Whether the maximum detecting this N number of network delay is greater than y*T 1, y > 0; If testing result is the maximum of this N number of network delay be greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
Or for Fig. 3, when being added into 8 elements in circle queue, client obtains each network delay in circle queue, extracts maximum wherein, and compares this maximum and T 1/ 3 15% between magnitude relationship, if this mean value is greater than T 1/ 3 15%, then the network delay of Ping message sent before illustrating is bigger than normal, now, new negotiation time-out time can be defined as T 2=(1+0.1) T 1, as new negotiation time-out time after increasing 10% by former negotiation time-out time.
3) when this circle queue is expired, the mean value of the N number of network delay in this circle queue is obtained; Whether the mean value detecting this N number of network delay is less than z*T 1, z > 0; If testing result is the mean value of this N number of network delay be less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
Or for Fig. 3, when being added into 8 elements in circle queue, client obtains each network delay in circle queue, extracts mean value wherein, and compares this maximum and T 1/ 3 10% between magnitude relationship, if this mean value is less than T 1/ 3 5%, then the network delay of Ping message sent before illustrating is less than normal, now, new negotiation time-out time can be defined as T 2=(1-0.05) T 1, reduce after 5% as new negotiation time-out time by former negotiation time-out time.
It should be noted that, scheme shown in the embodiment of the present invention is only illustrated with above-mentioned instantiation, in actual applications, can adjust above-mentioned threshold value for comparing and increase or the step-length that reduces according to the actual conditions of network, such as, when needing to ensure higher Detection accuracy, when detecting that needs increase negotiation time-out time, former negotiation time-out time once can be increased by 20%, when needing to ensure lower fault detect time delay, when detecting that needs reduce negotiation time-out time, can by former negotiation time-out time first-stage reduction 10%.
In the step 212, by the negotiation time-out time of this client by T 1be updated to T 2.
In step 214, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to this server.
As shown in Figure 3, after time-out time is consulted in renewal, namely client sends follow-up heartbeat message by the negotiation time-out time after renewal.
In the step 216, by the negotiation time-out time T after this renewal 2send to this server.
Know new negotiation time-out time in time for the ease of server, the negotiation time-out time after this renewal, after time-out time is consulted in renewal, is namely sent to server by new type of message, so that server accurately carries out fault detect by client.
Client, after time-out time is consulted in renewal, namely empties circle queue, and repeats above-mentioned steps 206-212, when circle queue is full of again, then according to negotiation time-out time T 2with the network delay in circle queue, negotiation time-out time is updated to T 3, circulate according to this.
In sum, the heartbeat message sending method that the embodiment of the present invention provides, the network delay of the N number of heartbeat message sent by the forward direction server obtaining current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
Please refer to Fig. 4, it illustrates the structure drawing of device of the heartbeat message dispensing device that one embodiment of the invention provides.This heartbeat message dispensing device may be used in client, performs method as shown in Figure 1 or 2.This heartbeat message dispensing device can comprise:
Delay acquisition module 401, the network delay of N number of heartbeat message that the forward direction server for obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
Consult time-out time determination module 402, for according to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
Consult time-out time update module 403, for by the negotiation time-out time of described client by T 1be updated to T 2;
Message sending module 404, for according to upgrade after negotiation time-out time T 2follow-up heartbeat message is sent to described server.
In sum, the heartbeat message dispensing device that the embodiment of the present invention provides, the network delay of the N number of heartbeat message sent by the forward direction server obtaining current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
Please refer to Fig. 5, it illustrates the structure drawing of device of the heartbeat message dispensing device that another embodiment of the present invention provides.This heartbeat message dispensing device may be used in client, performs method as shown in Figure 1 or 2.This heartbeat message dispensing device can comprise:
Delay acquisition module 401, the network delay of N number of heartbeat message that the forward direction server for obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
Consult time-out time determination module 402, for according to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
Consult time-out time update module 403, for by the negotiation time-out time of described client by T 1be updated to T 2;
Message sending module 404, for according to upgrade after negotiation time-out time T 2follow-up heartbeat message is sent to described server.
Optionally, described delay acquisition module 401, for for each heartbeat message in described N number of heartbeat message, when receiving response message corresponding to described heartbeat message, obtains the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2; Determine the network delay δ=t of described heartbeat message 2-t 1; To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N;
Wherein, described heartbeat message is included in described heartbeat message and response message corresponding to described heartbeat message when being sent out, the system time t of described terminal 1.
Optionally, described negotiation time-out time determination module 402, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0, if the mean value that testing result is described N number of network delay is greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
Optionally, described negotiation time-out time determination module 402, for when described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue, whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0, if the maximum that testing result is described N number of network delay is greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
Optionally, described negotiation time-out time determination module 402, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is less than z*T 1, z > 0, if the mean value that testing result is described N number of network delay is less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
Optionally, described device also comprises:
Consult time-out time sending module 405, for by the negotiation time-out time T after described renewal 2send to described server.
In sum, the heartbeat message dispensing device that the embodiment of the present invention provides, the network delay of the N number of heartbeat message sent by the forward direction server obtaining current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
Please refer to Fig. 6, it illustrates the block diagram of the client that one embodiment of the invention provides.This client may be used for the method performed as shown in Figure 1 or 2.This client can comprise: bus 610, and is connected to the processor 620 of bus 610, memory 630, receiver 640 and reflector 650.Wherein, memory 630 is for storing one or more than one instruction, and this instruction is configured to be performed by processor 620.Wherein:
Processor 620, the network delay of N number of heartbeat message that the forward direction server obtaining current time for controlling receiver 640 and reflector 650 sends, described network delay is transmission heartbeat message to the time delay received between corresponding response message, N >=1, and N is integer;
Processor 620, for according to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
Processor 620, for by the negotiation time-out time of described client by T 1be updated to T 2;
Processor 620, for control transmitter 650 according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to described server.
In sum, the client that the embodiment of the present invention provides, the network delay of the N number of heartbeat message sent by the forward direction server obtaining current time, according to the network delay of this N number of heartbeat message and the negotiation time-out time T of client 1determine new negotiation time-out time T 2, by the negotiation time-out time of client by T 1be updated to T 2, according to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to server, the negotiation time-out time of network delay to current use according to the heartbeat message sent adjusts, make negotiation time-out time under the prerequisite of accuracy that can meet fault detect, shorten as much as possible, avoid mean failure rate to detect time delay long, thus reach the effect of the time delay of accuracy rate and the low fault detect taking into account high fault detect.
Optionally, processor 620, for for each heartbeat message in described N number of heartbeat message, when receiver 640 receives response message corresponding to described heartbeat message, obtains the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2; Determine the network delay δ=t of described heartbeat message 2-t 1; To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N;
Wherein, described heartbeat message is included in described heartbeat message and response message corresponding to described heartbeat message when being sent out, the system time t of described terminal 1.
Optionally, processor 620, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0, if the mean value that testing result is described N number of network delay is greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
Optionally, processor 620, for when described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue, whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0, if the maximum that testing result is described N number of network delay is greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
Optionally, processor 620, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is less than z*T 1, z > 0, if the mean value that testing result is described N number of network delay is less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
Optionally, described device also comprises:
Processor 620, for control transmitter 650 by the negotiation time-out time T after described renewal 2send to described server.
It should be noted that: the heartbeat message dispensing device that above-described embodiment provides is when sending heartbeat message and upgrade negotiation time-out time, only be illustrated with the division of above-mentioned each functional module, in practical application, can distribute as required and by above-mentioned functions and be completed by different functional modules, internal structure by device is divided into different functional modules, to complete all or part of function described above.In addition, the heartbeat message dispensing device that above-described embodiment provides and heartbeat message sending method embodiment belong to same design, and its specific implementation process refers to embodiment of the method, repeats no more here.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be read-only memory, disk or CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (12)

1. a heartbeat message sending method, in client, is characterized in that, described method comprises:
The network delay of N number of heartbeat message that the forward direction server obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
According to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
By the negotiation time-out time of described client by T 1be updated to T 2;
According to the negotiation time-out time T after renewal 2follow-up heartbeat message is sent to described server.
2. method according to claim 1, it is characterized in that, for each heartbeat message in described N number of heartbeat message, include described heartbeat message in described heartbeat message and response message corresponding to described heartbeat message when being sent out, the system time t of described terminal 1; The network delay of N number of heartbeat message of the forward direction server transmission of described acquisition current time, comprising:
When receiving response message corresponding to described heartbeat message, obtain the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2;
Determine the network delay δ=t of described heartbeat message 2-t 1;
To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N.
3. method according to claim 2, is characterized in that, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue;
Whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0;
If testing result is the mean value of described N number of network delay be greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
4. method according to claim 2, is characterized in that, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue;
Whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0;
If testing result is the maximum of described N number of network delay be greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
5. method according to claim 2, is characterized in that, the negotiation time-out time T of the described network delay according to described N number of heartbeat message and described client 1determine new negotiation time-out time T 2, comprising:
When described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue;
Whether the mean value detecting described N number of network delay is less than z*T 1, z > 0;
If testing result is the mean value of described N number of network delay be less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
6. method according to claim 1, is characterized in that, described method also comprises:
By the negotiation time-out time T after described renewal 2send to described server.
7. a heartbeat message dispensing device, in client, is characterized in that, described device comprises:
Delay acquisition module, the network delay of N number of heartbeat message that the forward direction server for obtaining current time sends, described network delay is transmission heartbeat message to the time delay between the response message receiving correspondence, N >=1, and N is integer;
Consult time-out time determination module, for according to the network delay of described N number of heartbeat message and the negotiation time-out time T of described client 1determine new negotiation time-out time T 2;
Consult time-out time update module, for by the negotiation time-out time of described client by T 1be updated to T 2;
Message sending module, for according to upgrade after negotiation time-out time T 2follow-up heartbeat message is sent to described server.
8. device according to claim 7, is characterized in that,
Described delay acquisition module, for for each heartbeat message in described N number of heartbeat message, when receiving response message corresponding to described heartbeat message, obtains the system time t comprised in described response message 1, and the system time t of described terminal when described response message is received 2; Determine the network delay δ=t of described heartbeat message 2-t 1; To be added into by the network delay δ of described heartbeat message and to pre-set, length is the circle queue of N;
Wherein, described heartbeat message is included in described heartbeat message and response message corresponding to described heartbeat message when being sent out, the system time t of described terminal 1.
9. device according to claim 8, it is characterized in that, described negotiation time-out time determination module, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is greater than x*T 1, x > 0, if the mean value that testing result is described N number of network delay is greater than x*T 1, then T is determined 2=(1+X) T 1; X > 0.
10. device according to claim 8, it is characterized in that, described negotiation time-out time determination module, for when described circle queue is expired, obtain the maximum of the N number of network delay in described circle queue, whether the maximum detecting described N number of network delay is greater than y*T 1, y > 0, if the maximum that testing result is described N number of network delay is greater than y*T 1, then T is determined 2=(1+Y) T 1; Y > 0.
11. devices according to claim 8, it is characterized in that, described negotiation time-out time determination module, for when described circle queue is expired, obtain the mean value of the N number of network delay in described circle queue, whether the mean value detecting described N number of network delay is less than z*T 1, z > 0, if the mean value that testing result is described N number of network delay is less than z*T 1, then T is determined 2=(1-Z) T 1; 0 < Z < 1.
12. devices according to claim 7, is characterized in that, described device also comprises:
Consult time-out time sending module, for by the negotiation time-out time T after described renewal 2send to described server.
CN201510008018.0A 2015-01-07 2015-01-07 Heartbeat message sending method and device Active CN104601376B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510008018.0A CN104601376B (en) 2015-01-07 2015-01-07 Heartbeat message sending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510008018.0A CN104601376B (en) 2015-01-07 2015-01-07 Heartbeat message sending method and device

Publications (2)

Publication Number Publication Date
CN104601376A true CN104601376A (en) 2015-05-06
CN104601376B CN104601376B (en) 2019-03-01

Family

ID=53126901

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510008018.0A Active CN104601376B (en) 2015-01-07 2015-01-07 Heartbeat message sending method and device

Country Status (1)

Country Link
CN (1) CN104601376B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105634864A (en) * 2015-12-29 2016-06-01 南京国电南自电网自动化有限公司 GOOSE network performance self-diagnosis method used for intelligent transformer substation relay protection
CN105827697A (en) * 2016-03-14 2016-08-03 广州趣丸网络科技有限公司 User off-line detection method and user off-line detection system
WO2018074587A1 (en) * 2016-10-20 2018-04-26 日本電気株式会社 Server device, cluster system, cluster control method, and program
CN110007886A (en) * 2019-04-10 2019-07-12 广州视源电子科技股份有限公司 Pass screen time-out time dynamic setting method, device, wireless screen transmission device and receiving end

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1286505A1 (en) * 2001-08-23 2003-02-26 Samsung Electronics Co., Ltd. Method for compensating for propagation delay in a point-to-multipoint data communication network
CN102843250A (en) * 2011-06-21 2012-12-26 中兴通讯股份有限公司 Adaptive method and adaptive device of heartbeat cycle
CN104052569A (en) * 2013-03-12 2014-09-17 中兴通讯股份有限公司 MCS switching method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1286505A1 (en) * 2001-08-23 2003-02-26 Samsung Electronics Co., Ltd. Method for compensating for propagation delay in a point-to-multipoint data communication network
CN102843250A (en) * 2011-06-21 2012-12-26 中兴通讯股份有限公司 Adaptive method and adaptive device of heartbeat cycle
CN104052569A (en) * 2013-03-12 2014-09-17 中兴通讯股份有限公司 MCS switching method and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105634864A (en) * 2015-12-29 2016-06-01 南京国电南自电网自动化有限公司 GOOSE network performance self-diagnosis method used for intelligent transformer substation relay protection
CN105827697A (en) * 2016-03-14 2016-08-03 广州趣丸网络科技有限公司 User off-line detection method and user off-line detection system
WO2018074587A1 (en) * 2016-10-20 2018-04-26 日本電気株式会社 Server device, cluster system, cluster control method, and program
US10911295B2 (en) 2016-10-20 2021-02-02 Nec Corporation Server apparatus, cluster system, cluster control method and program
CN110007886A (en) * 2019-04-10 2019-07-12 广州视源电子科技股份有限公司 Pass screen time-out time dynamic setting method, device, wireless screen transmission device and receiving end

Also Published As

Publication number Publication date
CN104601376B (en) 2019-03-01

Similar Documents

Publication Publication Date Title
CN104601376A (en) Heartbeat message sending method and device
US9532359B2 (en) Resource allocation method and device
RU2558680C2 (en) Method, device and system of processing for control of pass-band
KR20190047598A (en) Method and device of transmitting data
CN107682460B (en) Distributed storage cluster data communication method and system
CN109788027A (en) Method of data synchronization, device, server and computer storage medium
CN101796774A (en) Method and system for checking automatically connectivity status of an IP link on IP network
CN107360239A (en) A kind of client connection status detection method and system
CN104243609A (en) Information service pushing method and device
CN103685480A (en) Transmission control protocol (TCP) network implementing method and server
US20190053169A1 (en) Method for dynamic adaptation of a data rate
CN104468337A (en) Message transmission method and device, message management center device and data centers
CN110275680B (en) Double-control double-active storage system
CN110784365A (en) Standby device of station control layer and entity device of transformer substation and automatic online method thereof
CN103457748A (en) Data transmission method, system and device
CN109218137B (en) Method and device for detecting state of node in distributed system
CN110808948A (en) Remote procedure calling method, device and system
CN105553865A (en) FC switch chip communication credit management testing method
CN106911581B (en) Transmission method, device and terminal
CN108712494A (en) Handle the method, apparatus and equipment of asynchronous message
CN108966362A (en) Control method, device, equipment and the storage medium of RRC connection status
CN100566272C (en) A kind of wireless device radio management method and device
CN105207795A (en) IOT communication method and device
CN104918314A (en) Method and device for adjusting power consumption of AP
CN110300035B (en) Method, system, device and server for judging load state of storage system

Legal Events

Date Code Title Description
PB01 Publication
C06 Publication
SE01 Entry into force of request for substantive examination
C10 Entry into substantive examination
GR01 Patent grant
GR01 Patent grant