Overview
defination
the process of defining the architecture, components, modules, interfaces and data to satisfy specified requirements.
- conceptual design (macro)
- logical design
- physical design (micro)
Top-down design
Eg. MS Office, Huawei Security System
Bottom-up design
Most start-up use, MVP first using Medetor + MongoDb.
5 steps (SNAKE Principle):
- Scenario: case/interface - input
- Necessary: constrain/hypothesis - input
- Application: service/algorithm - output
- Kilobit: data - output
- Evolve - solution
A top-down example
Example one: design a radio
Step One, Scenario
brain storm
- register/log in
- play music
- recommendation
prioritize
- play music
- Get channel
- select a channel
- play
- play music
Step Two, Necessary
ask
- total user - 100,000,000
- daily users - 1,000,000
predict
- user analysis
- Traffic analysis
- Memory analysis
- QPS
Details:
user analysis
Avg Concurrent users = daily users / 5 = 200,000
Peak Concurrent users = concurrent user * 3 = 600,000
considering your product may grow in the next 3 month:
Max Peak users in 3 month = Peak users * 10 = 6,000,000
Traffic analysis
Request of new music per user: 1 music/min
Music size = 3MB
Max peak traffic (in 3 months) = 6,000,000 * 3MB / 60 = 300GB/s
Memory analysis
Memory per user (metadata) = 10KB
Max daily memory = 1,000,000 * 10 * 10 = 100 million KB = 100GB
(10 times of avg daily user)
Step Three, Application
- Replay the case, one service for each
- Merge the services
Step Four, Kilobit: data
Append 1 dataset for each service
Eg. User service: stability, more addition, less modify and deletion.
Eg. Channel Service: high concurrency, MongoDB
Eg. Music Service: MP3 File Systems
Last Step, Evolve
Better: constrains
eg. able to handle 300GB/s traffic?
Broader: new cases
share music? delete user account?
Deeper: details design
From views of Performance, Scalability and Robustness.