About the second-kill program

Source: Internet
Author: User
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


Reply to discussion (solution)

No, to the time, lock live not on the line, but also let the inquiry what ah!

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)

Wow, that makes sense, but I don't think it's reasonable.
Pay attention to fairness and justice

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?

Wow, that makes sense, but I don't think it's reasonable.
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.

I know
In fact, the principle of the second kill is the same.

Is the last one to win the bid!

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.

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.

Hahaha ...

Oh, I have solved the problem in the process is different browser Ajax request time is not the same

。。。
Think it would be inappropriate to show the time directly to the client.

The last is to use the locking table method to engage in ...

Reluctantly can be used, thank you!!

Want to ask everyone a question, I am not learning computer, so a lot of things do not understand, if I want to get a like the second kill the same program, is to specify a time automatically refresh click, how to do it!

Oh, I have solved the problem in the process is different browser Ajax request time is not the same

。。。
Think it would be inappropriate to show the time directly to the client.

The last is to use the locking table method to engage in ...

Reluctantly can be used, thank you!!


Landlord, may I ask you to develop a set of such procedures? I want to buy, my QQ 63566536 phone 13283250777

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