Thinking about the design of second-kill program

Source: Internet
Author: User
About the second-kill program
The current idea is this:

When the user participates in the second kill and then inserts all the users into the database, and then polls the time by polling until the timer is zero, which is the second kill,
Polling time is one second, the problem is that if there is a second time to the last second to kill the user, then to let the counter overtime, and then continue polling,
Don't know why not reasonable!!!

Please, everyone, for your sake! Thank you

Share to:


------Solution--------------------
No, to the time, lock live not on the line, but also let the inquiry what ah!
------Solution--------------------
Yes, when the time is up, the lock table is banned.

Then the stack of ideas, the last one inserted for the winning bidder.

If the last-minute bidder has more than one person, the poll
(In fact, personally, the poll is not, direct ORDER by DESC to the MySQL processing query)
------Solution--------------------
Listen to your second kill, seemingly only a second out of one?

If so, I must have a start time countdown, when the time to allow the purchase, when the purchase of storage when the query has been bought by someone, one but the first person to place a single, then stop buying.

Isn't that okay?
------Solution--------------------
citation:
Wow, that makes sense, but I don't think it's fair enough.
Pay attention to fairness and justice

Last-minute buy without concurrency, only one person wins the bid, the fairest.

Have concurrent many people win the bid, can not say fair, you say to who bid good? Not one of Rand's random ones, which is not fair to anyone else. This is more than a Rand process, rather than direct order by, let MySQL decide.
------Solution--------------------
and by setting the insertion time to microseconds (1 seconds = 1 million microseconds), I don't believe I can have concurrency.

If there is still concurrency, your station has been very NB, it is impossible to come here to ask, around already have a large number of engineers.
------Solution--------------------
Reference:
also set the insertion time to microseconds (1 seconds = 1 million microseconds), I do not believe there can be concurrency.

If there is still concurrency, your station has been very NB, it is impossible to come here to ask, around already have a large number of engineers.


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