Bird
Raised Fist0
HLDsystem_design~10 mins

Heartbeat mechanism in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the main purpose of a heartbeat mechanism.

HLD
The heartbeat mechanism is used to [1] the health status of system components.
Drag options to blanks, or click blank then click option'
Adelete
Bignore
Cmonitor
Dencrypt
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'ignore' because it sounds unrelated.
Confusing heartbeat with encryption or deletion.
2fill in blank
medium

Complete the code to specify the typical interval for sending heartbeat signals.

HLD
Heartbeat signals are usually sent every [1] seconds to ensure timely detection of failures.
Drag options to blanks, or click blank then click option'
A5
B60
C300
D0.1
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 60 seconds which is too slow for quick failure detection.
Choosing 0.1 seconds which is too frequent and costly.
3fill in blank
hard

Fix the error in the failure detection condition.

HLD
If no heartbeat received for [1] times the interval, mark the component as failed.
Drag options to blanks, or click blank then click option'
A1
B3
C10
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 1 which is too sensitive and causes false alarms.
Choosing 10 which delays failure detection too much.
4fill in blank
hard

Fill both blanks to complete the heartbeat message format and its transport protocol.

HLD
Heartbeat message format: [1]; Transport protocol: [2]
Drag options to blanks, or click blank then click option'
AJSON
BXML
CTCP
DUDP
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing TCP which adds overhead and latency.
Choosing XML which is heavier than JSON.
5fill in blank
hard

Fill all three blanks to complete the failure detection logic in pseudocode.

HLD
if missed_heartbeats > [1] and last_heartbeat_time < current_time - [2] * [3]:
    mark_component_failed()
Drag options to blanks, or click blank then click option'
A3
Binterval
Ctimeout
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'timeout' as a variable instead of 'interval'.
Setting missed_heartbeats threshold too low or too high.