Questions about simultaneous access by multiple users

Source: Internet
Author: User
Questions about simultaneous access by multiple users? Thank you for your advice! Description: System structure: 1. & nbsp; interface module (php) & nbsp; -- & gt; 2. & nbsp; intermediate interface (php) & nbsp; -- & gt; & nbsp; 3. & nbsp; database (mysql) 1. & nbsp; interface module: displays the operation interface and Operation result; 2. & nbsp; intermediate interface: data help between the interface module and the database: What is the problem when multiple users access the interface at the same time?
Thank you for your advice!
The situation is described as follows:

System structure: 1. Interface Module (php) --> 2. Intermediate interface (php) --> 3. Database (mysql)
1. Interface Module: displays the operation interface and operation results;
2. Intermediate interface: responsible for data exchange between the interface module and the database, and other functions (not described for help issues );

General process: send an http request from the interface module. the request is sent to the interface module. the interface module accesses the database to obtain data and returns the data to the interface module;

Question:
The interface module has a large number of users, and these users may send the same request to the interface at the same time, for example, editing a certain data at the same time.

Q: How can this problem be avoided?

I do not know whether the description is clear. please kindly advise me. thank you!
------ Solution ----------------------
Lock

If the business allows "editing a data at the same time", the last submission prevails.
Otherwise, xxx is being edited when receiving the request.
------ Solution ----------------------
When user A successfully edited A News record, set the status field of the data to 1 to record the timestamp.
If someone wants to edit the file, status 1 is rejected.
User A's page ajax polling tells the server that the time is still being edited and refreshed every dozens of seconds.
When User A edits and submits, or User B wants to edit the status to 1, but the last ajax submission time is too different from the current one, the status is set to 0.
------ Solution ----------------------
Do you not need permissions during editing? Can I edit B sent by?
------ Solution ----------------------
Suitable for middle layer
Generally, the middle layer is the API
Adding a filter condition is relatively simple.

Of course, the interface layer can also be implemented, but the interface layer should not (cannot) directly access the data layer.
Therefore, you need to set up a cache mechanism separately. if the cache is not processed, no request will be sent to the intermediate layer.
You can use a queue that shares memory or databases or files.

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.