System design refers to the process of creating a system based on the requirements. This involves choosing the technology stack, selecting modules, components, protocols, and more.
You can break system design into two levels.
HLD - HIGH-LEVEL DESIGN
LLD - LOW-LEVEL DESIGN
Let's use a real-life example to explain this concept. Imagine we are planning to construct a city.
In a High-Level Design (HLD), you would determine the main components such as Houses, Hospitals, and Schools. For connections, you would plan roads and a metro system.
In a Low-Level Design (LLD), you would delve into the details of constructing Houses, Hospitals, Schools, roads, and the metro system.
Requirement gathering:
This is the first step before you go on to design any system. First, we have to understand what the customer wants, and what the actual requirement is, then we go and do our research on it.
Then comes things like Prioritizing, Planning features, Planning resources, and Cost estimations, Components.
Requirement gathering can also be separated into two further categories:
Functional
Need of customer
Features to be used
Example - chatting in a chat application
Non-Functional
Performance
Latency
Availability
Reliability
Consistency
Ease of use
Scalability
Security
Some 'back of the Envelop' calculations, handy for calculations:
Units conversions:
1 byte = 8 bits
1 ASCII character = 1 byte = 8bits
1 KB = 1024 bytes ≈103 bytes
1 MB = 106 bytes (million bytes)= 103 KB
1 GB = 109 bytes (billion bytes) = 106 KB = 103 MB
1 TB = 1012 bytes (trillion bytes) = 109 KB = 106 MB = 103 GB
1 PB = 1015 bytes (quadrillion bytes) = 1012 KB = 109 MB = 106 GB = 103 TB
Units of time:
Seconds - s
milliseconds - ms
microseconds - μs
nanoseconds - ns
[ 1 second = 103 ms = 106 μs = 109 ns ]
Availability:
QPS (Queries per second):
Example: Let's say Twitter has below specifications:
Monthly average users (MAU) = 300 million
Daily average users (DAU) = 150 million
Tweets (a person per day) = 2 tweets/day
Time the data to be stored = 10 years
Query per second (QPS) = (DAU x tweets/day)/ 24 hrs
QPS = ( 150 x 106 x 2 ) / ( 24 x 60 x 60 )
QPS ≈ 8000 QPS
Note: Since peak QPS is 8000, we will build a system to be tolerant for at least 16000 QPS.
That is it for the basic overview, please head to the next article for further details by clicking here.
Thanks for coming this far in the article, I Hope I was able to explain the concept well enough. If in any case, you face any issues please feel free to reach out to me, I'd be happy to help.
You can always connect to me over LinkedIn to share feedback or queries by clicking here -->>Connect with me on LinkedIn.