Source
Original article
Review of the book Hacking the System Design Interview on the Code of Architecture blog
Hacking the System Design Interview
Authors: Stanley Chiang
Publisher: Independently published, 2022
Length: —
Analysis of the Stanley Chiang book: 7-step framework, 16 practice problems and comparison with other materials.
OriginalPersonal opinion
I found this book more interesting than "System Design Interview" by Alex Xu. The structure of presentation of basic concepts here is more understandable and systematized.
Book structure
The book consists of an introduction, in which the author tells general words about the system design interview, as well as three main parts:
1. The System Design Interview
A short intro about this type of interview and how to use the book to prepare for it.
2. Essential Concepts
Basic terminology and fundamental principles for service design:
3. Core Components
Basic components of modern systems:
4. System Design Questions
Seven-step approach to problem solving, approximate estimation techniques, diagramming and 16 practice problems to practice skills.
7 Step Approach to System Design
The framework that the author proposes consists of seven sequential steps. Let's look at each of them in detail.
Understanding the task and defining boundaries
At this stage, you need to find out from the interviewer what functions the system should support. This will allow you to avoid unnecessary deepening and decide how deeply you need to dive into each topic.
Key questions:
- What main use cases should the system support?
- What are the expected loads (users, requests per second)?
- What are the time/budget restrictions?
Defining a Data Model
At the second stage, you need to decide what messages are exchanged between system elements and what data is stored in the system.
Messages
Data exchange formats between system components
Storage
Data schema and storage type selection
High-level load estimation
We carry out Back of the Envelope Estimation - we estimate the orders of magnitude for the main metrics of the system.
What we evaluate:
- Number of users (DAU/MAU)
- Queries per second (QPS)
- Amount of data stored
- Network Bandwidth
High level design
After defining the basic requirements and characteristics, we build a high-level architecture and agree it with the interviewer. This is a critical moment!
Be sure to get confirmation from the interviewer that you are on the right track before going into detail.
Detailed design
After agreeing on the high-level design, we move on to detailed design critical parts of the system.
What to pay attention to:
- Implementation details of key components
- Algorithms and data structures
- Processing edge cases
- Selection of specific technologies
API and Interface Specification
We define public APIs of the system and interaction interfaces between components.
External APIs
REST, GraphQL, gRPC endpoints for clients
Internal interfaces
Contracts between microservices
Discussion of bottlenecks and performance
The final stage is a discussion of potential problems and ways to solve them.
Topics for discussion:
- Bottlenecks and how to eliminate them
- Single points of failure
- Scaling to suit load growth
- Monitoring and alerting
16 practice problems
The book presents 16 problems for practicing System Design skills. Most of them overlap with tasks from the repository system-design-primer, but there are also unique examples.
SStandard tasks
- URL Shortener (TinyURL)
- Chat System (WhatsApp/Messenger)
- Autocomplete/Typeahead
- News Feed (Facebook/Twitter)
- Web Crawler
- Rate Limiter
- Notification System
- Video Streaming (YouTube/Netflix)
UUnique challenges
- Proximity Service (Yelp/Google Maps)
- Ride Sharing (Uber/Lyft)
- Ticketing System (Ticketmaster)
- Hotel Reservation System
- Distributed File System (GFS/HDFS)
- Distributed Key-Value Store
- Interplanetary Distributed Computing System
- Real-time Gaming Leaderboard
Particularly interesting task
"Interplanetary Distributed Computing System" is a unique problem that makes you think about systems with very high latencies (minutes to hours) and limited throughput. Excellent practice for understanding the fundamental principles of distributed systems.
Conclusions and recommendations
Who is this book suitable for?
For beginners — a good structure of basic concepts will help systematize knowledge.
Experienced engineers — unique challenges like "Interplanetary System" will give a new perspective on familiar concepts.
As a supplement — the book works great in conjunction with other materials on System Design.
I recommend using this book as one of your preparation sources, combining it with “System Design Interview” by Alex Xu and the repositorysystem-design-primer.
Where to find the book
Amazon
Hacking the System Design Interview
