javaweb-How to prevent multi-users at the same time snapping up the same goods, to prevent high concurrency while the same commodity, Daniel gave you accumulated knowledge it? Ask

Source: Internet
Author: User
Keywords Javaweb PHP Update Java
Javawebphpupdatejava

Recently in the snapping system, but the headache is that in multi-user high concurrency situation often inventory problems. troubleshooting, at the same time multi-user orders cause the query and insert is not synchronized, and the query with the insertion and the time difference in the case of high concurrency caused inventory problems (my project is probably this, first for update to find the Product information table, put into the global table array, when the user debit balance successful, The Update commodity Information table subtracts the number of orders that the user has. MySQL database, query the product information table is locked, but more and more information table data when the query has a time lag, resulting in high concurrency when querying the product information table into the variable array, in the implementation of the time lag, other users in the next order, resulting in inventory problems. Now ask questions, the same product at the same time to prevent multi-user snapping, that is, in the same second in the case of high concurrency can only be a single user orders, the current idea is queued, blocking the queue. But the concrete realization idea is how or whether the Daniel has the better method, and realizes the thought is how, has the case the best. The implementation language is PHP. Ask you to solve the solution

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