Start with functional requirements with constraint
User login/registration/manage profiles
user should be able to search the product based on product name
user should be able to view the details of products
user should be able to add product to cart
user should be able to do the checkout and payment
System should notify user once order is placed
user should be able to track the order status
manage purchase of item having limited stock
Non functional requirements
Per day order processing 100K
Platform should be highly available during increased workload
Platform should ensure consistency and prevent duplicate order/ payment.
Make security a first-class requirement
Prevent bot/ DDoS attack on the platform
Only registered/ logged in user can place order
Calculate transaction per second(TPS) roughly
Its’s critical metric in system design, impacting decisions about server capacity, database design, network infrastructure, and more.
A purchase flow typically triggers many more reads (catalog read, inventory check, pricing, user profile, coupon validation) needs to be considered for TPS calculations but can be descoped during interview discussion.
Non functional requirement
10M monthly active user
system should be highly available with respect to searching and viewing the products
and highly consistent with respect to placing the order and payment
latency ~200ms
Calculating TPS
10M daily active users
1 order per user/ daily
Transactions per Purchase: Each purchase involves 3 transactions (item selection, payment processing, order confirmation).
1,000,0000 users × 1 purchases/user/day × 3 transactions/purchase = 30 million transactions/day.
Converting to TPS:
There are 86,400 seconds in a day.
TPS = Total daily transactions / Seconds in a day.
TPS= 30 * 10 power 6 / 10 power 5 = 300 TPS
I'm approximating 86,400 seconds/day as 100k for mental calculation.
Design the architecture to satisfy these constraints

Top comments (0)