Kaneki Logo

Ilyass Ezzam

(KanekiEzz)AI Engineer & Full Stack Developer

← Back to posts
SystemDesignArchitecture

System Design: From Theory to Practice

10 April 2026·2 min read

When you start learning System Design, you are bombarded with buzzwords: Load Balancers, Microservices, CAP Theorem, Sharding, Message Queues. It can be overwhelming. Let's break down the core concepts moving from a single server to a distributed system.

The Monolith (Level 1)

Every great application usually starts here. A single server running a web framework (like Django), connecting to a local database (like MySQL). It's simple to deploy, easy to debug, and fast to develop. Do not scale until you need to.

Vertical vs Horizontal Scaling (Level 2)

When your single server gets too much traffic, you hit a bottleneck. You have two choices:

  • Vertical Scaling (Scaling Up): Buy a bigger, faster server (more RAM, better CPU). It's incredibly easy, but there's a hard hardware ceiling, and your system has a single point of failure.
  • Horizontal Scaling (Scaling Out): Add more servers to the pool. This provides near-infinite scale and fault tolerance, but requires architectural changes.

The Load Balancer (Level 3)

If you have three servers, how do users know which one to talk to? You introduce a Load Balancer (like NGINX or AWS ALB). The Load Balancer acts as a traffic cop, receiving all incoming requests and distributing them evenly across your servers. If Server A crashes, the load balancer stops sending traffic there.

Database Scaling (Level 4)

Web servers are stateless — they are easy to scale horizontally. Databases hold state, which makes them incredibly hard to scale.

The first step is often Replication (Master/Slave). The Master handles all WRITE operations, and replicates the data to one or more Slave databases. The Slaves handle all the READ operations. Since most web apps are read-heavy, this drastically improves performance.

When Replication isn't enough, you Cache. Adding Redis between your web servers and your database can instantly serve repetitive queries from memory rather than hitting disk.

Microservices (Level 5)

As the team and the codebase grow, the monolith becomes impossible to maintain. You extract distinct business logic (e.g., Billing, Authentication, Inventory) into separate, independent services. They communicate via APIs or message brokers like RabbitMQ or Kafka.

Microservices fix organizational scaling issues, but they introduce massive operational complexity (network latency, distributed tracing, eventual consistency). You should only adopt them when the monolith’s pain outweighs the complexity of distributed systems.

My advice? Start simple. Follow the "If it's working don't touch it" philosophy until your metrics scream that you need to scale.

← All postsBrowse tags →