In HDFS DataNodes sends the heartbeat to NameNode in every “3 sec”(Default value of heartbeat.interval is 3 seconds.)
Heartbeat interval can be set in hdfs-site.xml as follows:
<description>Determines data node heartbeat interval in seconds.</description>
Timeout = 2 * heartbeat.recheck.interval + 10 * heartbeat.interval.
After which namenode will consider the datanode as a dead node and namenode stops sending I/O requests to this datanode. NameNode then schedules the creation of replicas of those Data Blocks on another datanodes.
Datanodes sends heartbeats to Namenodes to apprise that its that it is alive and working. In this heartbeats the datanodes also send the information like the total disk space, total space in use and the data transfers in the process, It helps namenode to perform load balancing.
By default, the heartbeat interval is 3 seconds. If the Namenode doesn’t get any heartbeat, it waits for 10 minutes and considers the Datanode as dead. When Namenode declares any datanode dead, it replicates the blocks stored on the dead datanode to other working nodes for data availability.