HI WELCOME TO KANSIRIS

How a scalable system works

Leave a Comment


Many beginners feel system design is confusing because they see too many terms:
Load Balancer, Cache, Queue, Microservices, CDN, Replicas, etc.

But when you see them together in one flow, everything starts making sense.
Let’s understand this diagram from left to right 👇

1️⃣ Users
These are real users using:
Mobile apps
Web apps
APIs
Every action they perform creates a request.

2️⃣ CDN (CloudFront)
Before requests hit our backend:
Static content (images, videos, CSS) is served by CDN
CDN serves data from the nearest location
👉 Result:
Faster response
Less load on backend
Better global performance

3️⃣ API Gateway
All dynamic requests enter through the API Gateway.
It handles:
Authentication & authorization
Rate limiting
Request validation
Routing requests to correct services
👉 Acts as a single entry point for the system.

4️⃣ Load Balancer
The load balancer distributes traffic across:
Multiple backend servers
Multiple microservices
👉 Prevents one server from getting overloaded
👉 Enables horizontal scaling

5️⃣ Microservices (A, B, C)
Instead of one big application, the system is split into:
Independent services
Each service handles a single responsibility
Benefits:
Easy scaling
Independent deployments
Better fault isolation

6️⃣ Cache (Redis / Memcached)
Before hitting the database:
Frequently used data is stored in cache
👉 Reduces database load
👉 Improves response time
👉 Handles high read traffic efficiently

7️⃣ Primary Database + Read Replicas
Primary Database → Handles writes
Read Replicas → Handle read traffic
👉 This separation helps:
Scale reads
Maintain performance
Handle high traffic safely

8️⃣ Queue System (SQS / Kafka)
Some tasks don’t need instant processing:
Emails
Notifications
Analytics
Background jobs
These are pushed into a queue.
👉 This keeps the system:
Fast
Reliable
Non-blocking

9️⃣ Event-Driven & Fanout Architecture
From the queue:
One event is sent to multiple consumers
Each consumer processes the event independently
👉 Example:
Order placed → inventory update + email + analytics
This is called fanout.

🔁 How Everything Works Together
User
➡️ CDN
➡️ API Gateway
➡️ Load Balancer
➡️ Microservices
➡️ Cache / Database
➡️ Queue & Events
➡️ Auto-scaling keeps system stable 🚀

💡 Final Takeaway
System design is not about tools.
It’s about:
Scalability
Reliability
Performance
Fault tolerance
When traffic grows, a well-designed system grows with it.

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.