The requirement is as below :-
- 10000 users are using the application at a moment.
- There are 200 employees generating coupon at a moment.
- When a user calls GetCoupon( ), a coupon is assigned to the user for 30 seconds.
- Till the timespan of 30 seconds, this coupon will not be assigned to any other user.
- If the coupon is not used by a user within 30 seconds, the coupon is marked as expired for the user and moved back to the pool so that it is available for other users for consumption.
- If a coupon is used by a user, the coupon is marked as used and is not available again for sharing.
- If all the coupons are exhausted or not available in pool for use, appropriate error messages has to be generated. This should disappear when :
a) If a new coupon is generated by an employee.
b) If an already existing coupon is not used by a user in 30 seconds.
- There should be a failover option so that if one machine crashes, the system should still work.
- The design should be horizontally scalable.
Any suggestions are appreciated.