Want to know the next second kill system design so Baidu as follows
- Access pressure even simple static page high concurrency is also a need to add machine solutions to increase server load balancing
- Processing requests on-line with Redis queue cache requests and then take seconds to kill merchandise quantity records return seconds to kill success other seconds kill failed seconds kill end or inventory to 0 stop join queue
- Does inventory accuracy require special handling (in the case of queues)?
- Current limit (random 1% requests are returned by 99% to fail) I think Xiaomi made a very good appointment. No reservations directly unable to enter the snapping system
But there are many questions about the implementation.
Like what:
What is the process of the user's request, from the request to the return result?
What are the Redis queues that solve the problem?
Load Balancer Query Redis server?
Do you need MySQL to participate in the process?
PST kill commodity data cache in Redis?
If the user is only a redis tag this person is eligible for a purchase. When entering the purchase query this qualification there is the creation of order understanding, right?
Ask the big God for doubts
Reply content:
Want to know the next second kill system design so Baidu as follows
- Access pressure even simple static page high concurrency is also a need to add machine solutions to increase server load balancing
- Processing requests on-line with Redis queue cache requests and then take seconds to kill merchandise quantity records return seconds to kill success other seconds kill failed seconds kill end or inventory to 0 stop join queue
- Does inventory accuracy require special handling (in the case of queues)?
- Current limit (random 1% requests are returned by 99% to fail) I think Xiaomi made a very good appointment. No reservations directly unable to enter the snapping system
But there are many questions about the implementation.
Like what:
What is the process of the user's request, from the request to the return result?
What are the Redis queues that solve the problem?
Load Balancer Query Redis server?
Do you need MySQL to participate in the process?
PST kill commodity data cache in Redis?
If the user is only a redis tag this person is eligible for a purchase. When entering the purchase query this qualification there is the creation of order understanding, right?
Ask the big God for doubts
User request:
The user enters the agent machine, the proxy machine distributes the request to the backend one Web server, the Web server gets the user request later through the PHP operation database or the Redis, then returns the result to the Web server, finally presents to the user.
Redis queue mainly solves the problem of large concurrency, because he is the form of the queue, a one-piece processing, will not cause the concurrent large number of people to update a data at the same time, you think, if there are hundreds of people concurrent, no use of redis, your snapping eligibility is limited, Because of the database cache or memcache for some reason, several people at the same time to find a snapping eligibility, the results are updated this data, the result may be the last person to update the data of the person to obtain a real snapping qualification, the other people were his update, But the other person's front desk returned was already robbed.
Normally, it's not MySQL, because your snapping is going to be cached in Redis to see the specific needs.
I am also a rookie, big God do not spray.
Using the idea of layer filtering to design the second kill, pre-NoSQL database filter Most users, the specific number can be enlarged 2 to 10 times times the inventory, the next into the queue, the backend consumers receive queue messages, and then operate the MySQL database to update orders, reduce inventory. Foreground poll results
Top solve
Seconds to kill the system do not drop the traffic to the background processing server, you have 200 seconds to kill the product, put the first 1000 users come over is enough (put 200w in the Why, pure tired server);
Through such a filter, there is no pressure at all;