System Design – Fundamentals of System Design

Tram Ho

In this article, we will learn about basic concepts and principles in system design such as: scalability, throughput, and bandwidth. ), latency, .. to have a better overview of the topic of system design is like.

1. Scalability

In system design, scalability is the hallmark of any system

Scalability means that data rates and throughput will be increased as the system scales.

Some important points when scaling the system – Need enough resources to handle the growing – The system should not be too complex to scale at any time – Performance should always increase as the system expands system

2. Throughput (Throughput)

Throughput is the amount of work done by a machine in a particular time

Throughput is one of the important metrics for network performance, how many APIs are called per unit of time.

Throughput units: GBps, MBps, KBps

Example: In a food ordering application, suppose there is a server of a food ordering application that can handle 100 order requests from many clients within 10 minutes and there is another large scale system that can handle 1000 in the same time period. So the throughput in the first case is lower than in the second case.

3. Bandwidth (BandWidth)

Bandwidth is the maximum amount of data that can be transmitted over different networks

Scenario to increase system performance – High bandwidth and high throughput: this case has enough resources to pass through different channels to make the most of available bandwidth and achieve high throughput. – High bandwidth but low throughput: in this case, there are not enough resources to use the bandwidth and hence the throughput remains low. – Low bandwidth, enough resources: in this case, even if more resources are available, lower bandwidth will limit passing through those resources, thus only achieving low throughput

4. Response Time

Response time is the time it takes any API to respond to an API call.

When it says that the system serves 100 requests per second, it means that the response time for a single request is 0.01 seconds.

Let’s say the server has a throughput of 100 GBps and a Response Time of 1 second and the server can serve 1000 requests/second. Now at any point the API stops working due to any issues and the response time goes up to 1s -> 2s, in that case throughput will drop as your request takes twice as much time even if you have enough bandwidth.

5. Latency

Latency is an important measure of system performance. It is defined as how long it takes the system to transmit data from one point to another in the system.

6. Availability

With throughput and latency, availability also plays a very important role. It simply means how fault tolerant the system is. If anything goes wrong, how will the system work? It is the ability of a system to withstand adverse conditions and how the system repairs itself when necessary.

7. Concurrency

Concurrency simply means concurrent access to the same resource and if it is mutable then a data race starts and can lead to inconsistencies.

Threads : This is the basic unit of any execution process, following the instructions of the system. There can be multiple threads currently running as part of the system. And resources can be shared between threads.

8. Consistency

When two or more nodes are supposed to share the same data, any node can manipulate the data first and the other node is also trying to access it, while node A writes something at time t1 and node B reads t1 first, but the data has been updated in the meantime, resulting in inconsistency.

To avoid inconsistencies, we can use Master-Slave architecture, which can become peer in some cases while two replicas share data at the same level.

Let’s use a Google Drive example, Let’s say Haris and Navy are working on a project file and Haris has the same file up to version 1.0 on the drive and an updated version on Haris’s local machine. Now Navy tried to go to Drive and download version 1.0 of that file but Haris was uploading version 2.0 at the same time. In this case, the Navy will use the wrong file and all changes and actions by the Navy will follow version 1.0. It’s an example of ultimate consistency.

source: https://www.codingninjas.com/codestudio/guided-paths/system-design/content/119088/offering/1474987

 

Share the news now

Source : Viblo