Ask a typical question about time control

Source: Internet
Author: User
Ask a typical question about time control
Business on the question of a preemptive statement, assume that there are 1000 users, 5 seconds to be the first to speak, and only one person can speak; after 5 seconds, no one can speak.
Cannot use session due to customer requirements

That's what I'm dealing with.
Set up a statement in the database tablewords, if there is a first user to be early to speak, add a record, and then other users in the robbery to speak, if the table has records, then do not allow to speak;

This does not seem to be a problem, but given the concurrency situation, it is likely that more than 1000 users have performed the insert operation in the same millisecond, how do I only have one user insert?


------Solution--------------------
This worry of yours is superfluous.
Even in the same microsecond these 1000 users have made a request, and only one user's request was answered at the first moment, and the others were just queued
------Solution--------------------
Transaction file lock signal volume lock, etc., used to determine the user's speaking eligibility


Can also rely on the database unique index, the field can be by topic ID? And so on, so to be unique, obviously it fits your needs.
  • 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.