How to design a system
##Step 1: Describe usage scenarios, constraints and assumptions(Recommended learning: PHP video tutorial)
Gather all the necessary things together and examine the problem. Keep asking questions so that we can clearly understand usage scenarios and constraints. Discuss assumptions. Who will use it? How will they use it? How many users are there? What is the function of the system? What are the input and output of the system? How much data do we want to process? What is our desired read-write ratio?Step 2: Create a high-level design
Use all important components to outline a high-level designDraw the main Components and connectionsProve your idea
Step 3: Design core components
For each core component Conduct detailed and in-depth analysis. For example, if you are asked to design a URL abbreviation service, start the discussion: Generate and store a hash of the complete URL MD5 and Base62 Hash collision SQL or NoSQL Database modelTranslate a hashed url into a complete url Database lookupAPI and object-oriented designStep 4: Measurement Design
Identify and deal with bottlenecks and limitations.For example, do you need the following to complete an expanded topic?
Load BalancingHorizontal ScalingCacheDatabase ShardingDiscuss possible solutions and costs. Everything requires trade-offs. Bottlenecks can be handled using scalable system design principles.Estimated Estimated Amount
You may be asked to make some estimates through hand calculations. The appendices involved involve the following resources:Using the power table of the estimated calculation quantity
2The number of delays that every programmer should knowFor more PHP-related technical articles, please visit the
PHP Graphic Tutorial column to learn!
The above is the detailed content of How to design a system. For more information, please follow other related articles on the PHP Chinese website!