All right. thank you!
How does the mall flash sales work?
All right. thank you!
Reply content:
All right. thank you!
Optimistic queue lock pessimistic lock
Set the maximum number of seckilling tasks. All requests that exceed the limit are blocked.
The specific quantity of the second kill limit, which requires stress testing.
The IP address of the malicious request, which is directly blocked.
Ajax sends a request to the backend, and the backend uses the queue to request the database.
At the same time, ajax always requests the backend at the front end, and the backend returns a second kill success or failure.
You can use the redis queue to lock the inventory and generate orders. for example, if there are 100 inventories, you can calculate whether the queue length is greater than 100 every time you add them to the shopping cart.
How is the second kill in the mall achieved? For more information, see The PHP Chinese website (www.php1.cn )!