In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "PHP commodity inventory oversold concurrent test case analysis". In daily operation, I believe that many people have doubts about the problem of PHP commodity inventory oversold concurrent test case analysis. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "PHP commodity inventory oversold concurrent test case analysis". Next, please follow the editor to study!
First, ordinary orders are issued
Product table id = 1 name = Daohuaxiang rice store = 15 during concurrent test
Total 30 requests 10 concurrency at a time
Ab-n 30-c 10 http://xxxxx.top/code/the_limit/add_order.php
Results:
There were 15 successful inventory reductions and negative store inventory-7 8 times it was judged that the inventory was insufficient (inventory negative is incorrect and not allowed)
II. Unsigned mode
Adjust back to product table id = 1 name = Daohuaxiang rice store = 15
Total 30 requests 10 concurrency at a time
Ab-n 30-c 10 http://xxxxx.top/code/the_limit/unsigned.php
Results:
There were 15 successful inventory reductions and negative store inventory-69 times it was judged that the inventory was insufficient (inventory negative is incorrect and not allowed)
Only adding for update locking to the query statement has little effect.
Third, the transaction of mysql, locking the line of operation
Adjust back to product table id = 1 name = Daohuaxiang rice store = 15
Total 30 requests 10 concurrency at a time
Ab-n 30-c 10 http://xxxxx.top/code/the_limit/ACID.php
Results:
There are 15 successful inventory reductions. Store inventory is not negative. 15 times it is judged to be insufficient inventory (inventory negative is incorrect and not allowed).
The effect of adding transaction is good. Ab-n 3000-c 1000 concurrency can also withstand
Fourth, non-blocking file exclusive lock
Blocking form
Non-blocking form
The effect is not negative, but in terms of performance transaction > blocking > non-blocking.
5. Redis queue
The code is slightly adjusted to the optimistic lock version.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.