System Design Interview Questions and Answers
Ques 1. Design a URL shortening service like bit.ly.
The system would involve a database to store mappings of short URLs to original URLs, a front-end for user input, and a back-end to handle requests by redirecting to the original URL.
Example:
A user shortens 'https://www.example.com/page123' to 'http://bit.ly/xyz'.
Ques 2. Create a distributed cache system.
The system can use a consistent hashing algorithm to distribute keys across multiple cache nodes, and a mechanism to handle cache misses by fetching data from the main storage.
Example:
When a node receives a cache miss, it fetches the data from the main database and stores it in the cache for future requests.
Ques 3. Design a chat application like WhatsApp.
The system involves a messaging server to handle real-time communication, a database to store messages, and end-to-end encryption for security.
Example:
User A sends a text message to User B, and the message is delivered in real-time.
Ques 4. Build a content delivery network (CDN).
The system includes edge servers strategically placed worldwide to cache and deliver static content, reducing latency and improving performance.
Example:
A user in Asia requests an image, and it's served from the nearest edge server instead of the origin server.
Ques 5. Design a scalable news feed system like Facebook's.
The system comprises a feed generation service, a storage system for user posts, and algorithms to rank and personalize the feed based on user interests.
Example:
User sees posts in their feed based on relevance and recency.
Most helpful rated by users: