A little bit of doubt about NetEase's 1-dollar treasure

Source: Internet
Author: User
Tags mysql update
How does one handle the remaining 138 concurrent operations of the current product? for example, if 100 people simultaneously end the remaining number of times at the same time, isn't the number overflow? How do I create a data table and control concurrent operations? if the number of times required for a product is full, how can I enable it automatically...

How does one handle the remaining 138 concurrent operations of the current product? for example, if 100 people simultaneously end the remaining number of times at the same time, isn't the number overflow? Generally, how does one create a data table and control concurrent operations? if the number of times required for a product is full, how does one automatically start a new phase?

I have never had a good idea.

Reply content:

How does one handle the remaining 138 concurrent operations of the current product? for example, if 100 people simultaneously end the remaining number of times at the same time, isn't the number overflow? Generally, how does one create a data table and control concurrent operations? if the number of times required for a product is full, how does one automatically start a new phase?

I have never had a good idea.

I told you that there is no need to strictly lock this thing in terms of business. for example, what if 5000 people win the treasure and 6000 people send money?
Do you know the number of participants? I don't know. you don't know either. only NetEase knows.
The number of front-ends is only one count.

Https://segmentfault.com/q/1010000004102176/a-1020000004102233

Database lock, file lock

It mainly uses the automatic lock function during mysql update execution.
When there are 138 requests on the page, the SQL statement is as follows:

Update tabl_x set xxx = 139 where xxx = 138;

This statementOnly onceWhen other requests are executed, 'XXX' is no longer 138, so all requests fail.

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.