Animesh Shukla’s Post

View profile for Animesh Shukla, graphic

GCP Data Engineer at Cognizant | GCP Dataflow | Distributed System Design | Machine Learning | Data Science | GCP 2X

In distributed computing, data is replicated across multiple nodes because of the following reasons: 1) to improve latency so that data from the closest data-center (geographical locations) serves the read-request, 2) if one of the node goes down, the requests being served to this node can be routed to some other node (fault-tolerance). Thus, the key to distributed systems is replication of data across multiple nodes. However, the architect needs to decide whether to use synchronous- or asynchronous-replication in the distributed system.. I'll try to make it easy for you to understand the difference between synchronous and asynchronous replication with the example of write-request being sent to a distributed database. However, first we need to understand what leader-follower (master-slave) configuration is. Leader is the node where all the write requests are directed to and the changes are made in the local storage of the leader and are also stored in the replication log. This replication log is further sent to each of the followers so that the latest changes could be updated on them. Now, if we want to read the data, we have multiple replicas of the latest data. Thus, the read-requests are sent to the followers with the help of load-balancer. In this way, we can take advantage of the architecture containing multiple followers and single leader. This is how we get low latency and high throughput reads. As the read-request increases, we can attach new followers by taking the snapshot of one of the existing followers (which stores the current state of the data) and create a new node using that snapshot. Meanwhile when this node was getting created, whatever new changes were made should be stored in the leader's replication log. Thus, we can detect the incremental changes by comparing the leader's replication log with that of the newly created node's replication log and the incremental changes found can be updated in the newly created node. Now, the follower (node) stores the latest changes and hence, is ready to serve read-requests. In this way, we can go ahead and setup as many followers as required. This is how auto-scaling is done in distributed systems. #datascience #dataengineering #distributedcomputing #bigdata

To view or add a comment, sign in

Explore topics