Redis PHP PST Kill

Source: Internet
Author: User
Tags redis server
Want to know the next second kill system design so Baidu as follows

    1. Access pressure even simple static page high concurrency is also a need to add machine solutions to increase server load balancing
    2. 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
    3. Does inventory accuracy require special handling (in the case of queues)?
    4. 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

    1. Access pressure even simple static page high concurrency is also a need to add machine solutions to increase server load balancing
    2. 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
    3. Does inventory accuracy require special handling (in the case of queues)?
    4. 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;

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.