What is Heartbeat Signal?

A heartbeat signal is a periodic message or activity used to give another component evidence that a device, connection or service is still communicating. If the expected signal does not arrive within a defined time, the observer can mark the sender as suspect, raise an alert or begin a recovery procedure.
A heartbeat is evidence of a specific exchange, not proof that every part of a system is healthy. A sensor can send a heartbeat while its measurement is stale. A server can answer a protocol ping while its database is unavailable. Understanding what the signal actually checks is more useful than simply asking whether it is green.
How a heartbeat works
Imagine a home sensor sends a small status message to a monitoring service. The monitor records the latest arrival and compares its age with an agreed threshold. Some systems use a one-way signal; others send a request and expect a response. The direction, interval, response and failure rule depend on the implementation.

The sender transmits a signal or the monitor sends a probe.
The receiver records a valid arrival or returns an expected response.
A timer tracks the time since the last qualifying evidence.
If the deadline passes, the observer marks the peer as suspect or unavailable according to its policy.
An alert, reconnect, failover or further investigation follows, if configured.
The observer needs an initial grace period as well as a rule for recovery. A device that has never reported should not quietly appear healthy merely because no timer has been started. After a signal returns, decide whether one response is enough to clear an alert or whether a period of stable behaviour is required.
Term | Meaning | Question to ask |
|---|---|---|
Interval | How often a signal is expected or a probe is attempted. | Is it measured from sending, receiving or the previous successful response? |
Timeout | The period allowed before the observer treats evidence as too old. | What event starts or resets the timer? |
Failure threshold | A number of failures or missed checks used to trigger a decision. | Are checks consecutive, and do attempts overlap? |
Recovery rule | The conditions for clearing a failure or restoring service. | Does one response suffice, and is a human review needed? |
The names and timing rules vary. A setting called heartbeat timeout may not be the same as the interval between messages. Read the documentation for the actual product and protocol rather than copying a value from another system.
What a heartbeat can and cannot tell you
A valid one-way heartbeat tells the observer that a qualifying message arrived. A request and response provides evidence that a request reached something capable of replying and that a response came back. Neither alone proves that all other routes, services or operations are working.
A monitoring process might send a pulse independently of the worker doing the useful job. If the worker stalls while the pulse thread continues, the monitor can still see regular signals. Conversely, a healthy worker can be declared unavailable if its heartbeat is delayed by congestion, a paused virtual machine, a busy monitor or an asymmetric network failure.
Design the check around the outcome that matters. A connection-level ping can test communication with a peer. A service readiness check can test whether it can accept work. An end-to-end synthetic transaction can test a wider path, but it costs more and must be safe to run repeatedly. Use more than one kind of evidence when the consequences justify it.
The connection state guide explains why a local socket can still appear established even after another device on the path has forgotten its state. A heartbeat can help reveal that disagreement, but it does not make the state of every component identical.
Missed does not automatically mean failed
A heartbeat that arrives late may indicate a device failure, but it can also result from packet loss, congestion, scheduling delay, a busy process, radio sleep, a monitoring outage or a lost return path. The monitor knows only that expected evidence was not received on time.
Observation | Possible explanations | Useful next check |
|---|---|---|
No signal from one device | Device, local network, authentication or its individual monitoring path. | Device logs, last successful send and connection state. |
Many devices go missing together | Shared gateway, broadband, broker, monitor or upstream path. | Identify the first shared dependency and compare independent observations. |
Signals return after a short delay | Congestion, sleep, load or an overly tight threshold. | Compare arrival timing, retries and system load. |
Heartbeat succeeds but service fails | The check reaches a different component or does not exercise useful work. | Readiness and end-to-end transaction evidence. |
Monitor reports failure while a second monitor succeeds | A path or observer problem rather than a universal outage. | Compare locations, clocks, routes and timestamps. |
Calling a missed signal a suspicion gives operators room to investigate before taking a disruptive action. For automatic failover, define how split-brain is prevented: a network partition can leave both sides running even when each believes the other is gone. A heartbeat alone does not establish safe exclusive ownership.
Worked example: detection time and the missing interval
Suppose an illustrative sensor sends a heartbeat every 10 seconds. A monitor records each valid arrival and declares it stale when the age of the last arrival reaches 30 seconds. Assume perfectly scheduled delivery, no other qualifying traffic, and an immediate decision at the threshold. These numbers are an example, not measurements or recommended defaults.
If the last heartbeat arrives at 12:00:00 and the device fails immediately afterwards, the monitor reaches its threshold at 12:00:30. Detection takes about 30 seconds from the failure. If the device instead fails just before its next scheduled heartbeat at 12:00:10, the same threshold is reached at 12:00:30, approximately 20 seconds after the failure.
In this simplified model, the failure-to-detection time ranges from roughly timeout minus interval to timeout, or 20 to 30 seconds. Scheduling delays, network latency, polling frequency, grace periods and alert delivery add uncertainty. A rule based on three failed probes is not necessarily identical: its timing also depends on probe duration, scheduling and whether attempts overlap.
Reducing the deadline speeds up suspicion but leaves less room for temporary delays. Increasing it tolerates more disruption but prolongs detection. Choose a threshold against the time the service can safely remain unavailable and the cost of a false alarm, then measure the real arrival distribution on the intended path.
Heartbeat, keep-alive, ping and health check
These terms overlap, but the layer and intent matter. A keep-alive can maintain an idle connection, detect an unresponsive peer or both. A heartbeat often communicates periodic liveness. A ping is a request and response in a particular protocol. A health check evaluates a defined condition, which may include more than reachability.
Mechanism | What it can show | What it does not establish alone |
|---|---|---|
ICMP echo request and reply | An IP-level response along the tested path. | That a particular application or database is working. |
TCP keep-alive | Evidence about an idle TCP peer and path when enabled and configured. | That application work is progressing. |
Application heartbeat | That the component producing the signal is communicating. | That an unrelated worker or dependency is healthy. |
Readiness check | Whether a service meets the conditions defined for receiving work. | That every operation or dependency is healthy forever. |
End-to-end synthetic transaction | Whether one selected workflow completed under test conditions. | That every customer or network path has the same result. |
An ICMP reply can be filtered even when an application works. Equally, a successful ICMP reply can come from a host whose application is broken. Compare like with like and document the exact endpoint and success criteria for each check.
MQTT: a protocol-specific heartbeat example
An MQTT client communicates with a broker over a network connection. In MQTT 3.1.1, a non-zero Keep Alive specifies the maximum interval between sending MQTT Control Packets. If the client has no other Control Packet to send within that interval, it must send PINGREQ; the broker responds with PINGRESP. Other qualifying control packets can satisfy the sending requirement, so PINGREQ need not occur at a fixed interval during active traffic.
The OASIS MQTT 3.1.1 specification requires the server to disconnect when it receives no client Control Packet within one and a half times a non-zero Keep Alive period. With an illustrative 60-second value, that rule gives 90 seconds from the last received Control Packet, subject to the specification and implementation. Zero disables this keep-alive mechanism; it does not forbid other reasons for disconnection.
MQTT 5 can allow the server to provide a Server Keep Alive value in CONNACK, which the client must use instead of its proposed value. Check the version and client behaviour. A PINGRESP shows the broker and path responded to that exchange. It does not prove a subscriber processed a message or that a sensor reading is current. The MQTT broker guide explains the separate publishing and delivery responsibilities.
A Will Message can provide an additional indication after the broker detects a qualifying connection loss, but its timing depends on detection and protocol settings. It is not a substitute for checking the freshness and validity of the underlying measurements.
Timers, NAT and a UK home network
A long-lived connection from a home device to a cloud service can cross WiFi, the home router, the access network and remote firewalls or load balancers. Each may have its own state and idle policy. A signal that actually crosses a stateful device and qualifies under its rules may refresh its entry, but a local timer or a failed send cannot prove the whole route was refreshed.
For an illustrative router timeout of 5 minutes and an application heartbeat every 10 minutes, a mapping could expire before the next signal if no other qualifying traffic keeps it active. Shortening the heartbeat may help if permitted by the application and network, but verify the actual timer, traffic direction, device sleep and security policy. Carrier-grade NAT can add another stateful layer; it is not automatically the cause of every idle disconnect.
QUIC runs over UDP and has its own connection state and negotiated idle timeout. RFC 9000 notes that middleboxes may lose state sooner. A QUIC PING can elicit an acknowledgement, but the protocol cautions against unnecessary traffic. An interval that works on one path is not a universal guarantee for another.
How frequent should a heartbeat be?
Start with the recovery objective and the cost of a mistaken failure declaration. A short interval and timeout can detect a problem quickly, but can also create false positives during transient congestion or a busy process. A long interval reduces traffic and wake-ups, but makes an outage visible later. Battery-powered devices may pay for radio wake time as well as the few bytes sent.
RabbitMQ's heartbeat documentation distinguishes its negotiated timeout from its frame interval and warns that very low values can generate false positives. Its suggested range is specific operational guidance for that product, not a standard for every application. Its supported clients and settings must be checked for the deployed version.
Consider these factors before selecting a value:
How quickly must the system detect a genuine failure, and what happens if it reacts incorrectly?
How variable are network delay, loss, CPU scheduling and device sleep under normal and stressed conditions?
Which intermediate idle timers apply, and which traffic actually refreshes them?
Does the device have power, airtime, bandwidth and server capacity for the chosen frequency?
Can the monitor itself fail, and is there an independent way to detect that failure?
Add a margin based on observed conditions, not a guessed universal multiplier. Use jitter when scheduling large fleets where supported so simultaneous reconnects and heartbeat bursts do not create unnecessary load. Test both the normal path and realistic interruptions.
Separate liveness from readiness
A process can be running without being ready to serve requests. It can also be temporarily unready while a restart would make the problem worse. Kubernetes uses distinct liveness, readiness and startup probes; readiness can remove a pod from service traffic, while repeated liveness failure can cause a restart under the configured policy.
A health endpoint that fails whenever a shared database is briefly unavailable can cause every instance to restart together if used as a liveness probe. That can amplify an outage. Use checks appropriate to the decision, include startup time, and ensure an automatic restart is a useful response to the condition being detected. A heartbeat should support a decision, not dictate the same response to every symptom.
A practical diagnostic workflow
Use an authorised test and protect logs and captures that contain addresses, identifiers or sensitive payloads. The following steps describe a method, not a test performed on your network.
Identify the sender, receiver, protocol, direction, interval, timeout and expected recovery action. Confirm whether ordinary traffic resets the timer.
Record the last successful send and arrival, the time of the alert and the clock source at both ends. Prefer monotonic elapsed-time measurement for local timers where supported.
Compare the heartbeat with application logs and a separate readiness or transaction check. Identify exactly what continued or stopped working.
Inspect the shared path, including WiFi, router, firewall, broker and monitor. Look for correlated failures across devices and both directions of traffic.
Test one controlled interruption at a time. Compare detection time and recovery with the configured rules, including startup and alerting delays.
Adjust one setting, repeat the test and review false alerts, resource use and recovery. Do not disable security controls merely to make a heartbeat pass.
A packet capture may show request and response timing, retransmissions or missing traffic. Encryption can hide application content, host offload can affect capture appearance and a capture at one endpoint cannot establish what every device saw. Combine evidence from multiple locations where authorised.
Security and scale
Authenticate the peer where the protocol supports it, protect messages on untrusted networks and avoid placing secrets or unnecessary personal data in status payloads. A forged heartbeat could hide an outage; a replayed old message could make stale evidence look current if the design lacks appropriate freshness checks. Sequence numbers, timestamps and expiry policies can help when implemented and validated correctly, but clocks and replay handling need their own design.
At fleet scale, small periodic messages add up. For example, 1,000 devices sending one 100-byte application payload every 30 seconds produce about 33.3 messages per second and 26.7 kbit/s of payload in the sending direction. This illustrative calculation excludes transport, encryption, responses, link overhead, retries and wake-up energy. If a response is required, account for the return direction separately. The cost of an additional wake-up can matter more than the payload size on a sleeping device.
Heartbeat signal questions answered
Is a heartbeat the same as a ping?
Not always. A ping usually describes a request and response in a named protocol. A heartbeat can be a one-way periodic message or another liveness mechanism. Check the actual implementation.
Does a missed heartbeat prove a device has failed?
No. It proves that expected evidence was not received within the configured window. Device failure, network delay, monitor failure and other causes can produce that observation.
Does a heartbeat keep a connection alive?
It can refresh relevant state when its traffic crosses the device and meets its refresh rules. It does not guarantee that all intermediate state survives or that the application remains healthy.
How many missed heartbeats should trigger an alert?
There is no universal number. The answer depends on interval, timeout semantics, normal delay, false-alert cost and required recovery time. Test the actual implementation and path.
Can a service send heartbeats while its useful work is broken?
Yes. A separate heartbeat process can continue while a worker or dependency fails. Add a readiness or end-to-end check designed around the outcome that matters.
Is MQTT PINGREQ sent on every keep-alive interval?
Not necessarily. In MQTT 3.1.1, other outgoing Control Packets can satisfy the Keep Alive requirement. PINGREQ is required in the absence of other qualifying traffic when the non-zero interval would otherwise be exceeded.
Do heartbeat signals consume much bandwidth?
The payload may be small, but complete traffic includes protocol and security overhead, responses and retransmissions. At scale, scheduling and device wake-ups can also matter.
The practical takeaway
A heartbeat provides timely evidence about a defined communication. Make the interval, timeout, success condition and recovery action explicit. Then verify the useful service separately and treat missing evidence as a clue to investigate rather than proof of one particular cause.
The broadband terminology guide connects these ideas with network performance, transport and remote access.

