Open In App
Related Articles

Communication Protocols In System Design

Improve Article
Improve
Save Article
Save
Like Article
Like

Communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. 

The protocol defines the rules, syntax, semantics and synchronization of communication and possible error recovery methods. Protocols may be implemented by hardware, software, or a combination of both.

There are 3 types of communication that occur across services that help us in building quality scalable systems:

  1. Synchronous Communication
  2. Asynchronous Communication
  3. Message-based Communication

1. Synchronous Communication

Synchronous communication is a form of communication when two or more parties exchange information nonstop from beginning to end. 

An example of synchronous communication or a blocking call is when the client has made a request and waits for its fulfillment.

Illustration: Consider below 3 steps:

  1. Data is being fetched from the database.
  2. Updation over data received.
  3. Return the updated data.    

All above steps above will occur sequentially 

Synchronous Communication

Synchronous Communication

Applications of Synchronous Communications: 

  1. To achieve consistency
  2. Transaction communications

Real-time applications of Synchronous Communication:

  1. Bank payments 
  2. Ticket booking 
  3. Real-time decision making
  4. Stock Market 

2. Asynchronous Communication

Asynchronous communication is a form of communication in which the client is free to initiate or pause additional tasks without having to wait for a response. The client can do any action on the application without having to wait for a response, even though responses might take some time to reach the client. 

Illustration: Consider the same above illustration where the client is being rewarded with a cashback. Hence prior to returning, there will be another step: 

  1. Data is being fetched from the database.
  2. Updation over data received.
  3. Any operation where we are waiting for our data again to get updated. (In the above case we need to send a notification to the client who is getting cashback for the transaction)  
  4. Return the updated data.

Note: The step of adding a product to a cart over an e-commerce website is a Synchronous Communication Protocol.

The product is being checked in real-time as we require the database to be consistent so there will be no blocking. Hence it will be a synchronous communication. 

Difference between Synchronous and Asynchronous communications:

 

Let us plot visualization from the above media in a tabular format that is as follows: 

Synchronous Communication Asynchronous Communication
In synchronous communication, data is sent in form of blocks or frames.   In Asynchronous communication, data is sent in form of bytes or characters.
Synchronous communication is fast.  Asynchronous communication is slow.
Synchronous communication is costly. Asynchronous communication is economical.
In Synchronous communication, the time interval of transmission is constant.  In Asynchronous communication, the time interval of transmission is not constant, it is random.
In this transmission, users have to wait till the transmission is complete before getting a response back from the server.  Here, users do not have to wait for the completion of transmission in order to get a response from the server.
In synchronous communication, there is no gap present between data.  In Asynchronous communication, there is a gap present between data.
Efficient use of communication lines is done in synchronous transmission.  While in Asynchronous communication, the communication line remains empty during a gap in character transmission.
The start and stop bits are not used in transmitting data. The start and stop bits are used in transmitting data that imposes extra overhead.
Synchronous communication needs precisely synchronized clocks for the information of new bytes.  It does not need synchronized clocks as a parity bit is used in this transmission for information of new bytes.

3. Message-based Communication

It is the exchange of information based on messages is referred to as communication.

The client sends a message to a service with a request. The response is provided by the service in the form of a message. Since the communication is asynchronous, the client is free to start or stop any other process and is not obligated to wait for the process.

Message-based Communication

Message-based Communication

Other parts in this System Design Tutorial:

  1. What is System Design
  2. Analysis of Monolithic and Distributed Systems
  3. Important Key Concepts and Terminologies
  4. What is Scalability and How to achieve it – Learn System Design
  5. Databases in Designing Systems
  6. What is High-Level Design and Roadmap in System Design
  7. What is Low-Level Design and Roadmap in System Design
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 22 Mar, 2023
Like Article
Save Article
Similar Reads