I am building a mid-sized E-commerce web application using Spring Boot, Spring Data JPA (MySQL), and Redis. I need to handle concurrent order creations and prevent overselling (race conditions) when multiple users try to buy the same product at the exact same time. Currently, I am considering using Redisson Distributed Lock with a fail-fast approach (tryLock) wrapping the database transaction. Here is the simplified architecture of my...
Originally asked by Nguyễn Trung Nghĩa on Stack Exchange (stackoverflow) (CC BY-SA 4.0).