Open In App

Remote Write Protocol in Distributed Systems

Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisites: Network Protocols
 

A protocol is a set of rules or procedures that need to be followed on every request. The data store is a high-level view of databases; that is, it is simply a collection of all the databases scattered across the geographical region.

In a distributed system, the client can perform a read or write a request on data stored in a distributed manner in a distributed environment.

Remote Write Protocol

There are 2 categories where the data is stored, which are as follows:

  1. Primary store (in our case Primary)
  2. Replica (in our case there is Replica 1, Replica 2, and Replica 3)

There are 2 requests made by the client, which are as follows:

  1. W: Write
  2. R: Read

Moreover, the arrows with the label have 2 parts:

  1. The first part indicates whether the request is to read or write. For instance, in W_1, W indicates a write operation, and similarly, R_1 indicates a read operation.
  2. The second part indicates the step number of the read or writes request. For example, in W_3 3, which denotes the third step of the write operation,

The writing procedure is divided into two parts:

  1. The flow of requests from the client to the primary server.
  2. The flow of requests between the primary server and the replica.

       The arrows that are bent or curved indicate steps taken to keep the data consistent. That is, a procedure or set of steps is performed between the primary server and local server to keep the data the same across the entire data store. This is done to give the same results to all the users accessing the same data from different databases.

The steps or protocol to be followed for a written request are as follows:

  1.  W_1: The  Client sends a written request on variable x to the distributed system.
  2.  W_2: The written request on x is not executed by the database even though it has the variable. Instead, the received request is forwarded to the primary database.
  3. W_3: The primary server/database executes the write request on x and forwards the update request to the other replica to perform a similar update operation.
  4. W_4: The replica server acknowledges the write request from the primary server.
  5. W_5: Now, after the datastore is consistent, the local datastore containing the copy of value x can be sent to the client.

The steps or protocol to be followed for a read request are as follows:

  1. R_1: The client performs a read request on x at a different location than the previous write location.
  2. R_2: The client’s request to read the data of variable x is immediately executed on the local replica and responds with the updated value, i.e., the value after the last write request is executed.

Last Updated : 30 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads