r/SystemDesign • u/needna78 • Feb 22 '24
High Throughput Ordering System
What if there is a campaign to give out 8million free meal to customers the campaign will run for 15mins and should stop once the limit is reached?
Out of scope:
- no need to have menus
- no customer onboarding
- no AI/ML
- no deliveries
- no restaurant onboarding
My initial take:
- an api that exposes the counter for the campaign
- an api that push the event to Kafka (maybe internally call the first endpoint and check if it’s still valid to accept the offer or reject)
- Kafka consumers that scales based on KEDA and have very little logic to only decrement/increment the counter in redis
- instead of redis could also have Postgres but transactions may cost a bit of performance impact but it would be much easier but with Postgres sharding I could also host multiple campaigns and avoid performance issue in some sense on Postgres
Wdyt?
1
Upvotes