System Design
Published: 2024-01-31 14:53:40

**Design Pattern**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9uy1ei89awyov16s2em3.png)


What is System Design?
The process of establishing system aspects such as modules, architecture, components and their interfaces, and data for a system based on specified requirements is known as system design. It is the process of identifying, creating, and designing systems that meet a company’s or organization’s specific objectives and expectations. Systems design is more about system analysis, architectural patterns, APIs, design patterns, and glueing it all together than it is about coding. Because your application will be able to handle the architectural load, designing your system adequately for the requirements of your application will eliminate unnecessary costs and maintenance efforts, as well as provide a better experience for your end-users.

Play
It’s impossible to overlook system design when it comes to tech interviews! In the interview, almost every IT giant, whether it’s Facebook, Amazon, Google, or another, asks a series of questions based on System Design concepts like scalability, load balancing, caching, and so on. So without any further adieu, let us go through the most frequently asked interview questions on System Design.

System Design Interview Questions for Freshers
1. What is CAP theorem?

Explain it using Ticket booking system -> At a time u can maximum take 2 things into consideration
CAP(Consistency-Availability-Partition Tolerance) theorem says that a distributed system cannot guarantee C, A and P simultaneously. It can at max provide any 2 of the 3 guarantees. Let us understand this with the help of a distributed database system. 

Consistency: This states that the data has to remain consistent after the execution of an operation in the database. For example, post database updation, all queries should retrieve the same result.
Availability: The databases cannot have downtime and should be available and responsive always.
Partition Tolerance: The database system should be functioning despite the communication becoming unstable.

**Overview**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f81yq85yt5x0kqrc6y6r.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ebycs8a32yrccks2scay.png)
This type of consistency works well with YOuTube where no. of likes, comments and views can be different at a point of time for 2 users because it doesn't matter that much.

**Causal Consistency**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwkq9axkmggxk5wgui1k.png)
If an event b is dependent on a then b should be updates as soon as a is updated. But if n event c is not dependent on a so order might not be maintained in that case.

**Sequential Consistency**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z8l3z51ot3ty3365gpbg.png)
Eg -> when a fb friend make multiple posts they appear in order but the order might be not sorted for posts across different friends


**Strict Consistency**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hu2bhct4pe6oz7720x0h.png)
Eg -> Bank apps