I am using an ecommerce system where you use MySQL Transactions to maintain data integrity , for example in the simultaneous purchase of several customers of the same product where the system needs to decrease inventory and prevent it from being negative.
Technically, how does MySQL control to prevent a user's query from appearing to conflict with that of another user (s) and thus maintaining that integrity?
What is the best practice to test this integrity? Maybe use some HTTP client to generate multiple HTTP requests on which to simulate purchases?
Is there a number of concurrent queries where using Transactions turns out to be unnecessary? If so, from how many concurrent users do we have to worry about integrity using MySQL Transactions?