Common coordination tasks

Most distributed applications need to perform some tasks which are common across applications. Some of these tasks are listed below:

  1. Service discovery
  2. Locking
  3. Synchronization
  4. 2 phase commit
  5. Configuration management
  6. Leader election

1. Service discovery
This is one of the most important task in a distributed application/systems. What does service discovery mean? It means to determine the IP address and port of the services you application needs to connect to. In case of simple applications, you may connect to a service and you provide the address to the service in a configuration file. However, in a distributed environment, these services may be hosted on one server now and could dynamically change to another server(because of some reason like failure, scaling etc). In that case, your application should be able to retrieve the address of the service and work normally.

2. Locking
To allow serialized access to shared resource, the distributed system needs implement distributed mutex.

3. Synchronization
Process synchronization is required when you want a process to wait while some other process is accessing the shared resource, so that the system maintains consistency.

4. 2 phase commit
It is an atomic commitment protocol in which the transaction manager commits transaction in 2 phases. In first phase it asks the participating server to reply back whether they can commit or not. Only if all the servers that are participating in the transaction replies back saying that they can commit, the transaction manager in the second phase gives the instructions to commit.

5. Configuration management
In a distributed system, servers get added and removed all the time. It would be great to have a common place where the configuration related to the application can be kept. In that way the new server gets up-to date as soon as it connects to the distributed system.

6. Leader election
In many distributed systems, you would want a server to act as a leader and perform leadership activities like distributing tasks, knowing about the heath of other servers etc.

The list of tasks listed above is certainly not exhaustive and it cannot be. These are only few common tasks that every distributed system might need to have. Because of this reason, the creators of Zookeeper have not come up with the implementation of these tasks. However, they have designed Zookeeper in such a way that it is relatively  easy to implement these any other tasks.


References
1. https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/
2. http://www.ibm.com/developerworks/library/bd-zookeeper/

Tagged: , , , , , ,

Leave a comment