Back to Interview Hub

System Design Questions

High-level architecture, scalability, caching, and microservices.

Showing 1-6 of 81 questions

1 / 14
1QuestionsMedium🔥 65% Asked

How do you design a URL Shortener like TinyURL?

Asked in:SwiggyGoogle

Core Requirements:

  • Generate a unique short alias for a given URL.
  • Redirect users when they access the short URL.

Architecture Components:

  1. API Servers: To handle incoming read/write requests.
  2. Database: A NoSQL database (like Cassandra or MongoDB) to store the mapping of short_url -> long_url.
  3. Key Generation Service (KGS): A standalone service that pre-generates random 6-character strings and stores them in a DB. When a new request comes in, KGS provides a pre-generated key.
  4. Caching: Redis or Memcached to store frequently accessed URLs.

Note: For more insights, explore the Brightness Slider.

2QuestionsMedium🔥 77% Asked

Vertical vs Horizontal Scaling

Asked in:MetaAtlassianGoogle

Scenario: DB becomes slow.

Fix: Vertical (Increase RAM/CPU - easy but limited) vs Horizontal (Add more machines - hard but infinite).

Note: You might also find it helpful to learn how to Fix Build Issues or discover the Invisible Notepad.

3QuestionsMedium🔥 85% Asked

CAP Theorem:

Asked in:RazorpayStripeGoogle

Scenario: Network partition occurs. Choice: Consistency (CP - e.g., Zookeeper) or Availability (AP - e.g., Cassandra).

4QuestionsMedium🔥 76% Asked

Consistent Hashing

Asked in:PaytmOracleIBM

Scenario: In a distributed cache, 1 server goes down.

Fix: Use Ring topology so that only 1/N keys are re-assigned, and the entire cache is not reset.

5QuestionsMedium🔥 66% Asked

Load Balancing Algorithms

Asked in:AppleMicrosoft

Scenario: Server capacities are different.

Fix: Round Robin will fail. Use Least Connections or Weighted Round Robin.

6QuestionsMedium🔥 73% Asked

CDN Architecture

Asked in:WiproAirbnbTwitterLinkedIn

Scenario: Need to stream video fast to global users.

Fix: Cache content on edge servers. Push CDN (upload) vs Pull CDN (on-demand).