<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
heartbeat	B-Operating_System
is	O
a	O
periodic	O
signal	O
generated	O
by	O
hardware	B-Architecture
or	O
software	B-Application
to	O
indicate	O
normal	O
operation	O
or	O
to	O
synchronize	O
other	O
parts	O
of	O
a	O
computer	O
system	O
.	O
</s>
<s>
Heartbeat	B-Operating_System
mechanism	O
is	O
one	O
of	O
the	O
common	O
techniques	O
in	O
mission	O
critical	O
systems	O
for	O
providing	O
high	O
availability	O
and	O
fault	B-General_Concept
tolerance	I-General_Concept
of	O
network	B-General_Concept
services	I-General_Concept
by	O
detecting	O
the	O
network	O
or	O
systems	O
failures	O
of	O
nodes	O
or	O
daemons	O
which	O
belongs	O
to	O
a	O
network	B-General_Concept
cluster	I-General_Concept
—	O
administered	O
by	O
a	O
master	B-Application
server	I-Application
—	O
for	O
the	O
purpose	O
of	O
automatic	O
adaptation	O
and	O
rebalancing	O
of	O
the	O
system	O
by	O
using	O
the	O
remaining	O
redundant	O
nodes	O
on	O
the	O
cluster	O
to	O
take	O
over	O
the	O
load	B-Operating_System
of	O
failed	O
nodes	O
for	O
providing	O
constant	O
services	O
.	O
</s>
<s>
Usually	O
a	O
heartbeat	B-Operating_System
is	O
sent	O
between	O
machines	O
at	O
a	O
regular	O
interval	O
in	O
the	O
order	O
of	O
seconds	O
;	O
a	O
heartbeat	B-Operating_System
message	I-Operating_System
.	O
</s>
<s>
If	O
the	O
endpoint	O
does	O
not	O
receive	O
a	O
heartbeat	B-Operating_System
for	O
a	O
time	O
—	O
usually	O
a	O
few	O
heartbeat	B-Operating_System
intervals	O
—	O
the	O
machine	O
that	O
should	O
have	O
sent	O
the	O
heartbeat	B-Operating_System
is	O
assumed	O
to	O
have	O
failed	O
.	O
</s>
<s>
Heartbeat	B-Operating_System
messages	I-Operating_System
are	O
typically	O
sent	O
non-stop	O
on	O
a	O
periodic	O
or	O
recurring	O
basis	O
from	O
the	O
originator	O
's	O
start-up	O
until	O
the	O
originator	O
's	O
shutdown	O
.	O
</s>
<s>
When	O
the	O
destination	O
identifies	O
a	O
lack	O
of	O
heartbeat	B-Operating_System
messages	I-Operating_System
during	O
an	O
anticipated	O
arrival	O
period	O
,	O
the	O
destination	O
may	O
determine	O
that	O
the	O
originator	O
has	O
failed	O
,	O
shutdown	O
,	O
or	O
is	O
generally	O
no	O
longer	O
available	O
.	O
</s>
<s>
A	O
heartbeat	B-Operating_System
protocol	O
is	O
generally	O
used	O
to	O
negotiate	O
and	O
monitor	O
the	O
availability	O
of	O
a	O
resource	O
,	O
such	O
as	O
a	O
floating	O
IP	B-Protocol
address	I-Protocol
,	O
and	O
the	O
procedure	O
involves	O
sending	O
network	B-Protocol
packets	I-Protocol
to	O
all	O
the	O
nodes	O
in	O
the	O
cluster	O
to	O
verify	O
its	O
reachability	O
.	O
</s>
<s>
Typically	O
when	O
a	O
heartbeat	B-Operating_System
starts	O
on	O
a	O
machine	O
,	O
it	O
will	O
perform	O
an	O
election	O
process	O
with	O
other	O
machines	O
on	O
the	O
heartbeat	B-Operating_System
network	O
to	O
determine	O
which	O
machine	O
,	O
if	O
any	O
,	O
owns	O
the	O
resource	O
.	O
</s>
<s>
On	O
heartbeat	B-Operating_System
networks	O
of	O
more	O
than	O
two	O
machines	O
,	O
it	O
is	O
important	O
to	O
take	O
into	O
account	O
partitioning	O
,	O
where	O
two	O
halves	O
of	O
the	O
network	O
could	O
be	O
functioning	O
but	O
not	O
able	O
to	O
communicate	O
with	O
each	O
other	O
.	O
</s>
<s>
As	O
a	O
heartbeat	B-Operating_System
is	O
intended	O
to	O
be	O
used	O
to	O
indicate	O
the	O
health	O
of	O
a	O
machine	O
,	O
it	O
is	O
important	O
that	O
the	O
heartbeat	B-Operating_System
protocol	O
and	O
the	O
transport	O
that	O
it	O
runs	O
on	O
are	O
as	O
reliable	O
as	O
possible	O
.	O
</s>
<s>
Causing	O
a	O
failover	B-General_Concept
because	O
of	O
a	O
false	O
alarm	O
may	O
,	O
depending	O
on	O
the	O
resource	O
,	O
be	O
highly	O
undesirable	O
.	O
</s>
<s>
It	O
is	O
also	O
important	O
to	O
react	O
quickly	O
to	O
an	O
actual	O
failure	O
,	O
further	O
signifying	O
the	O
reliability	O
of	O
the	O
heartbeat	B-Operating_System
messages	I-Operating_System
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
it	O
is	O
often	O
desirable	O
to	O
have	O
a	O
heartbeat	B-Operating_System
running	O
over	O
more	O
than	O
one	O
transport	O
;	O
for	O
instance	O
,	O
an	O
Ethernet	O
segment	O
using	O
UDP/IP	B-Protocol
,	O
and	O
a	O
serial	O
link	O
.	O
</s>
<s>
A	O
heartbeat	B-Operating_System
program	O
as	O
a	O
whole	O
consist	O
of	O
various	O
subsystems	O
:	O
</s>
<s>
Heartbeat	B-Operating_System
Subsystem	O
(	O
HS	O
)	O
:	O
The	O
subsystem	O
that	O
monitors	O
the	O
node	O
's	O
presence	O
within	O
the	O
cluster	O
through	O
a	O
series	O
of	O
keepalive	B-Protocol
or	O
"	O
hear-beat	O
messages	O
"	O
.	O
</s>
<s>
Cluster	O
Manager	O
(	O
CM	O
)	O
:	O
The	O
subsystem	O
within	O
the	O
cluster	O
—	O
usually	O
the	O
master	B-Application
server	I-Application
—	O
which	O
keeps	O
track	O
of	O
the	O
"	O
cluster	O
members	O
"	O
and	O
records	O
which	O
resources	B-General_Concept
are	O
on	O
which	O
nodes	O
.	O
</s>
<s>
Cluster	O
Transition	O
(	O
CT	O
)	O
:	O
When	O
a	O
node	O
joins	O
or	O
leaves	O
the	O
cluster	O
,	O
this	O
subsystem	O
is	O
responsible	O
for	O
keeping	O
track	O
of	O
such	O
occurrences	O
for	O
the	O
purpose	O
of	O
triggering	O
events	O
to	O
rebalancing	O
and	O
reconfiguring	O
the	O
master	O
to	O
distribute	O
the	O
load	B-Operating_System
.	O
</s>
<s>
Heartbeat	B-Operating_System
messages	I-Operating_System
are	O
sent	O
in	O
a	O
periodic	O
manner	O
through	O
techniques	O
such	O
as	O
broadcast	B-Operating_System
or	O
multicasts	O
in	O
larger	O
clusters	O
.	O
</s>
<s>
Since	O
CMs	O
have	O
transactions	O
across	O
the	O
cluster	O
,	O
the	O
most	O
common	O
pattern	O
is	O
to	O
send	O
heartbeat	B-Operating_System
messages	I-Operating_System
to	O
all	O
the	O
nodes	O
and	O
"	O
await	O
"	O
responses	O
in	O
non-blocking	O
fashion	O
.	O
</s>
<s>
Since	O
the	O
heartbeat	B-Operating_System
or	O
keepalive	B-Protocol
messages	O
are	O
the	O
overwhelming	O
majority	O
of	O
non-application	O
related	O
cluster	O
control	O
messages	O
—	O
which	O
also	O
goes	O
to	O
all	O
the	O
members	O
of	O
the	O
cluster	O
—	O
major	O
critical	O
systems	O
also	O
include	O
non-IP	O
protocols	O
like	O
serial	B-Protocol
ports	I-Protocol
to	O
deliver	O
heartbeats	B-Operating_System
.	O
</s>
<s>
Every	O
CM	O
on	O
the	O
master	B-Application
server	I-Application
maintains	O
a	O
finite-state	B-Architecture
machine	I-Architecture
with	O
three	O
states	O
for	O
each	O
node	O
it	O
administers	O
:	O
Down	O
,	O
Init	O
,	O
and	O
Alive	O
.	O
</s>
<s>
Whenever	O
a	O
new	O
node	O
joins	O
,	O
the	O
CM	O
changes	O
the	O
state	O
of	O
the	O
node	O
from	O
Down	O
to	O
Init	O
and	O
broadcasts	B-Operating_System
a	O
"	O
boot-up	O
message	O
"	O
,	O
which	O
the	O
node	O
receives	O
the	O
executes	O
set	O
of	O
start-up	O
procedures	O
.	O
</s>
<s>
It	O
then	O
responses	O
with	O
an	O
acknowledgment	O
message	O
,	O
CM	O
then	O
includes	O
the	O
node	O
as	O
the	O
member	O
of	O
the	O
cluster	O
and	O
transitions	B-Application
the	I-Application
state	I-Application
of	O
the	O
node	O
from	O
Init	O
to	O
Alive	O
.	O
</s>
<s>
Every	O
node	O
in	O
the	O
Alive	O
state	O
would	O
receive	O
a	O
periodic	O
broadcast	B-Operating_System
heartbeat	B-Operating_System
message	I-Operating_System
from	O
the	O
HS	O
subsystem	O
and	O
expects	O
an	O
acknowledgment	O
message	O
back	O
within	O
a	O
timeout	O
range	O
.	O
</s>
<s>
If	O
CM	O
did	O
n't	O
receive	O
an	O
acknowledgment	O
heartbeat	B-Operating_System
message	I-Operating_System
back	O
,	O
the	O
node	O
is	O
considered	O
unavailable	O
,	O
and	O
a	O
state	B-Application
transition	I-Application
from	O
Alive	O
to	O
Down	O
takes	O
place	O
for	O
that	O
node	O
by	O
CM	O
.	O
</s>
<s>
The	O
procedures	O
or	O
scripts	O
to	O
run	O
,	O
and	O
actions	O
to	O
take	O
between	O
each	O
state	B-Application
transition	I-Application
is	O
an	O
implementation	O
detail	O
of	O
the	O
system	O
.	O
</s>
<s>
Heartbeat	B-Operating_System
network	O
is	O
a	O
private	B-Protocol
network	I-Protocol
which	O
is	O
shared	O
only	O
by	O
the	O
nodes	O
in	O
the	O
cluster	O
,	O
and	O
is	O
not	O
accessible	O
from	O
outside	O
the	O
cluster	O
.	O
</s>
<s>
The	O
heartbeat	B-Operating_System
method	O
uses	O
the	O
FIFO	B-Operating_System
nature	O
of	O
the	O
signals	O
sent	O
across	O
the	O
network	O
.	O
</s>
<s>
In	O
this	O
communications	O
protocol	O
every	O
node	O
sends	O
back	O
a	O
message	O
in	O
a	O
given	O
interval	O
,	O
say	O
delta	O
,	O
in	O
effect	O
confirming	O
that	O
it	O
is	O
alive	O
and	O
has	O
a	O
heartbeat	B-Operating_System
.	O
</s>
<s>
Once	O
a	O
message	O
with	O
a	O
timestamp	O
later	O
than	O
the	O
given	O
marked	O
time	O
is	O
received	O
from	O
every	O
node	O
,	O
the	O
system	O
determines	O
that	O
all	O
messages	O
have	O
been	O
received	O
since	O
the	O
FIFO	B-Operating_System
property	O
ensures	O
that	O
the	O
messages	O
are	O
ordered	O
.	O
</s>
<s>
If	O
delta	O
is	O
too	O
small	O
,	O
it	O
requires	O
too	O
much	O
overhead	O
and	O
if	O
it	O
is	O
large	O
it	O
results	O
in	O
performance	O
degradation	O
as	O
everything	O
waits	O
for	O
the	O
next	O
heartbeat	B-Operating_System
signal	O
.	O
</s>
