Need to keep track of each user transaction, at least transaction count - increase points for it. Need storage for reward details. 1M transaction per day
Write request per ssec = 1M/10^5 = 10 RPS
Storage 1M * 100 bytes = 100 MB per day
3GB per month
Lists all the rewards/points earned
List the history of transactions which shows rewards earned and redeemed
Rewards
Activity_tracker
User_wallet
Reward Management Service:
Food order S$40-60 - 4
>S$60 - 6
Taxi order $S20-50 - 3
Order Reward Manager:
After successful transaction, the transaction details are passed to this service, which talks to rule engine, calculates the points earned and logs an entry in activity tracker. In case of redemption, that transaction is also logged.
Reward Wallet Service:
Updates the wallet with most recent value based on activity.
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
We can increase latency by - caching the rewards rules and accessing from cache.
We can even write the rewards earned to cache and then update in DB.
Try to discuss as many failure scenarios/bottlenecks as possible.