PHP second kill plugin?

Source: Internet
Author: User
PHP has a wooden seconds kill plugin can be recommended? Or a PHP second kill program implementation of the idea is what? What technology is used?

Other languages of the second kill tool can also be recommended to masturbate

Reply content:

PHP has a wooden seconds kill plugin can be recommended? Or a PHP second kill program implementation of the idea is what? What technology is used?

Other languages of the second kill tool can also be recommended to masturbate

Shunt (randomly discarded users) + multiple queues (cache)

such as 10 items, 100,000 users
1, in seconds before the number of active users in the page, according to a certain proportion, the separation of a group of users out, direct return to the second kill failed, leaving only 300 users
2, write the 300 users to the first queue, such as the list of Redis, a table in MySQL, etc.
3, get the first 10 users in the queue, for the second kill success, generate orders, other users prompt the second kill failed
4, some seconds to kill the business (such as Millet), in the third step operation, each user is prompted to succeed, but in the submission of user order information, the regeneration into a queue, according to the order of submission, take the first 10 prompt second kill success, other users prompt the second kill failed

The second kill of a single product can draw on the file system's lock mechanism while only one person/process/thread is in process/open/owned state until the release/shutdown/order expires.
The second kill of multiple commodities can draw on the mechanism of the queue, first-out/first-come first-served/deft on hand have slowed none.

Redis queue, memcache memcache::d ecrement

  • 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.