Knowledge / Computer Science and Engineering / System design basics for freshers

System design basics for freshers

Computer Science and Engineering (B.E./B.Tech) · Web, cloud and design · free study notes for exams, placements and interviews

In short

System design is the practice of choosing the components of a software system — web servers, load balancers, databases, caches, queues, storage — and the way they talk to each other, so that the system meets its functional needs while staying fast, available and affordable under real traffic. For a fresher it is examined less as "build Twitter" and more as "can you reason about load, bottlenecks, trade-offs and failure". It appears in Software Engineering and Distributed Systems papers of most AICTE/CBCS curricula, in GATE CS indirectly (through operating systems, DBMS transactions and computer networks), and almost universally in the design round at Indian product companies and service firms — Flipkart, Zomato, Swiggy, Razorpay, PhonePe, Zoho, Freshworks, Infosys, TCS Digital and Wipro Turbo. The core skill is a structured conversation: clarify requirements, estimate numbers, draw a high-level diagram, pick data stores, then attack the bottlenecks you created.

Explained

What a design question is actually asking

Scalability: vertical, horizontal and statelessness

Databases: SQL, NoSQL, replication, sharding

CAP, consistency and availability

Making it fast: caching, async work, CDNs at the design level

Architecture styles and service communication

Estimation and capacity planning

Key points

Formulas and examples

QPS (average) = (DAU × requests per user per day) / 86,400 — DAU in users, result in requests/second
Peak QPS = average QPS × peak factor (typically 2 to 5; higher for flash sales)
Storage per day = writes per day × bytes per record; Total storage = storage per day × retention days × replication factor
Bandwidth = QPS × average payload size (bytes/s; ×8 for bits/s)
Servers needed = Peak QPS / QPS handled per server (then add redundancy, typically N+1 or N+2)
Availability (series) = A₁ × A₂ × … × Aₙ; Availability (n parallel redundant) = 1 − (1 − A)ⁿ
Downtime per year = (1 − Availability) × 525,600 minutes
Effective read latency with cache = (hit rate × cache latency) + ((1 − hit rate) × DB latency)
Little's Law: L = λ × W — L = concurrent requests in system, λ = arrival rate (req/s), W = average time in system (s)
Keys moved on node change with consistent hashing ≈ K / N — K = total keys, N = number of nodes

Example 1 — Capacity estimate for a URL shortener. Assume 100 million new URLs created per month, read:write ratio 100:1, each record 500 bytes, retention 5 years.

Conclusion: writes are trivial, reads are 100× heavier — so cache the hot short-codes in Redis and use read replicas; a single sharded key-value store suffices.

Example 2 — Servers and availability for a food-delivery API. 2 million DAU, 20 API calls per user per day, each server handles 500 QPS, peak factor 4.

Example 3 — Cache effectiveness. DB read = 20 ms, Redis read = 1 ms, cache hit rate 90%.

Example 4 — Little's Law for thread-pool sizing. A service receives 2,000 requests/s and each takes 150 ms (0.15 s) on average.

Example 5 — Consistent hashing benefit. 1,000,000 cache keys across 10 nodes; add an 11th node.

AspectSQL (RDBMS)NoSQL
SchemaFixed, enforcedFlexible / schema-less
TransactionsFull ACIDLimited; often BASE
JoinsNativeUsually unsupported — denormalise
ScalingVertical first, sharding is manualHorizontal by design
Best forPayments, orders, inventoryFeeds, sessions, logs, time series
ExamplePostgreSQL, MySQLCassandra, MongoDB, Redis
AvailabilityDowntime/yearDowntime/monthTypical use
99% ("two nines")~3.65 days~7.2 hoursInternal tools
99.9% ("three nines")~8.76 hours~43.8 minutesStandard SaaS SLA
99.99% ("four nines")~52.6 minutes~4.4 minutesPayments, UPI-grade
99.999% ("five nines")~5.26 minutes~26 secondsTelecom, core exchanges
Client → DNS → CDN (static) → Load Balancer → API Gateway (auth, rate limit)
                                                   │
                        ┌──────────────────────────┼──────────────────────┐
                        ▼                          ▼                      ▼
                  Service A (stateless)      Service B              Service C
                        │                          │                      │
              Redis cache ─── Primary DB ── Replicas          Queue (Kafka) → Workers
                                   │                                        │
                              Sharded by user_id                     Object store (files)

Where it is used

Interview questions

Common mistakes

Related topics

Caching, queues and CDNs · REST APIs · Cloud computing basics · Containers: Docker and Kubernetes · System design case studies · Authentication and authorisation: sessions, OAuth and JWT

Open in the Knowledge reader →Find jobs →