System Design Basics

 

System Design Basics


Load Balancing Algorithms
In cloud computing, distributed systems, and network architectures, load balancing ensure optimal performance, reliability, and scalability.

load balancing handling web traffic, distributing computational tasks, or managing resource utilization directly impacts the efficiency and stability of the entire system.

8 Load Balancing Algorithms for System Design:
1) Round Robin
The Round Robin algorithm operates on a cyclic basis, evenly distributing incoming requests across a pool of servers. It sequentially assigns requests starting from the first server and loops back once reaching the last, ensuring a fair distribution of workload.
Round Robin algorithms works best when have a homogeneous server environment with similar hardware and the requests are generally uniform in complexity and resource requirements.

2) Least Connections

3) Weighted Round Robin

4) Weighted Least Connections

5) IP Hash

6) Least Response Time

7) Random

8) Least Bandwidth

API Gateway


Caching


Rate Limiter


Distributed Messaging Queues



Software Architecture Diagrams with C4 Model

A picture is worth a thousand words

C4 Model
The C4 model was created as a way to help software development teams describe and communicate software architecture.

C4 stands for “Context, Containers, Components, and Code”. 
Those are four levels that should be enough to describe a complex system.

Level 1: Context
This level is the most zoomed out, it is a bird’s eye view of the system in the context of the world. 
The diagram concentrates on actors and systems.


Level 2: Containers
The containers level is a more detailed view of your system.

It reveals how various functional units like applications and databases work together and distribute responsibilities.

If you have Microservice architecture then each Microservice would be a container.

Examples of containers are:
- Single page application
- Web server
- Serverless function
- Database
- API
- Message buses
  etc.
  
Level 3: Components
The next level of zoom is components. This shows the major structural building blocks of your application, it is often a conceptual view of your application. The term component is loose here. It could represent a controller, or service containing business logic.

Level 4: Code
The deepest level of zoom is the code diagram.

Diagrams as Code
The power of C4 comes with a diagram-as-code approach, this means treating your diagrams just like your codebase:

Version control: Store them in a source control system (like Git) for easy tracking and collaboration.
Collaboration: Work together on diagrams using pull requests, similar to code reviews.
Automation: Integrate them into your build pipelines for automatic rendering with your preferred tools.

DSL (Domain Specific Language).

Supplementary diagrams
Besides the 4 diagrams above there are a few more worth mentioning:

Deployment diagram
Dynamic diagram: to describe the process or a flow


There are few tools to help with modeling and diagramming, however the most popular nowadays is Structurizr with their custom DSL (Domain Specific Language).

Comments

Popular posts from this blog

PL/SQL

JAVA8 Features

Build Automation