Building high-availability services using heartbeat