One of the most common ways of fault detection is through the heartbeat mechanism. A heartbeat is a signal or a message that is sent on regular intervals (usually a few seconds) between two services.
If a few consecutive heartbeats are missing, the receiving service can consider the sending service dead. In the case of our primary-backup service pair from a few sections previously, this can cause a failover to happen.
When implementing a heartbeat mechanism, be sure that it's reliable. False alarms can be troublesome, as the services may get confused, for example, about which one should be the new master. A good idea might be to provide a separate endpoint just for heartbeats, so it won't be as easily affected by the traffic on the regular endpoints.