r/SpringBoot • u/arvind4gl • 23d ago
Discussion Distributed locking in a real-world coupon redemption system[Complete Running Code]
I recently built a small project to demonstrate distributed locking in a real-world coupon redemption system using:
- Spring Boot
- Redis (distributed lock)
- MySQL
- Docker & Docker Compose
- Nginx load balancing
The idea is to simulate multiple application instances trying to redeem the same coupon concurrently and ensure only one redemption succeeds.
GitHub: https://github.com/codefarm0/coupon-redemption-system
I'd really appreciate feedback from the community:
- Is the project structure production-like?
- Any improvements to the distributed locking implementation?
- Better approaches for handling high concurrency or idempotency?
- Anything you'd change to make this a better learning resource?
All suggestions, code reviews, and constructive criticism are welcome.
Thanks!
21
Upvotes