Artificial Intelligence (AI) & Machine Learning Course for ManagersEnroll Now
== Sessions ==
Lets try to understand how do the zookeeper decides to delete ephermals nodes and takes care of session management.
A client has list of servers in the ensemble. The client enumerates over the list and tries to connect to each until it is successful. Server creates a new session for the client. A session has a timeout period - decided by the client. If the server hasn’t received a request within the timeout period, it may expire the session. On session expire, ephermal nodes are deleted. To keep sessions alive client sends pings also known as heartbeats. The client library takes care of heartbeats and session management.
The session remains valid even on switching to another server.
Though the failover is handled automatically by the client library, application can not remain agnostic of server reconnections because the operation might fail during switching to another server.
Taking you to the next exercise in seconds...