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