2021-12-22
|~3 min read
|455 words
When presented with a question about system design, where do you begin?
The system-design-primer project on Github provides an accessible four-step approach:
Ask questions to clarify the problem, e.g., how would the system be used, who needs it, when do they need it, etc.
By the end of this step, you should have stated your key understanding of the use case, its scope, and key assumptions / constraints, and implied usage.
The following comes from a sample solution in the system design primer for Amazon Sales Rank By Category.
In terms of order of operations, the usage calculations require some sense of understanding what kind of data you’ll be storing.
How to estimate the storage requirements. Also, a handy conversion guide for quick estimates.
Problem statement:
Scope:
Out of scope:
Assumptions and constraints:
Usage:
created_at
- 5 bytesproduct_id
- 8 bytescategory_id
- 4 bytesseller_id
- 8 bytesbuyer_id
- 8 bytesquantity
- 4 bytestotal_price
- 5 bytesThis is where you actually draw out the core components of the system. Do not jump straight to a scaled design!
Identify which are the critical components
Design core APIs and processes
Identify single points of failure.
Outcome: A design diagram that scales the service to meet the usage requirements.
Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!