FluffyBoba
FluffyBoba

Flash sale | System Design

Just curious if we have to design some sort of flash sale. For example: let's say 100 iPhones at discounted price for window or may be booking tatkal on irctc.

Will it be good Design to serve the read from the replicas and during the payments may be queue the requests, throttle and add let the db process sequential?

26mo ago
Talking product sense with Ridhi
9 min AI interview5 questions
Round 1 by Grapevine
SwirlyHamster
SwirlyHamster

The replicas won’t be good as they have an eventual consistency. So what we can do is use Cache prolly Redis or Aerospike with Optimistic or Pessimistic Locking so it can power the transactions and Locking would make sure only one checkout happens successfully at a time.

FluffyBoba
FluffyBoba

Too much contention. Locking is not the right approach. Replicas cause no one cares what is shown. The real stuff is your checkout. That should throttle request. Probably that's why irctc gets stuck everytime while we move to the next step.

FluffyBoba
FluffyBoba

Also we just need to ensure the eventual of consistency is not uncertain. So yes may be an asynchronous update on the cache too. Or may be quorum based reads.

Discover more
Curated from across
Software Engineers
by WobblyLlamaSoftware Developer

Use of design patterns

Do we use design patterns in the backend excessively in good companies like Phonepe, flipkart, Myntra, Amazon ... Or do we focus on readability of the code vs the performance of the code.

Software Engineers
by GoofyBagelWalmart

How do you solve for peak concurrency? >10,000 users at one point?

Just how do you scale? Do you use AWS auto-scaler for that?

Top comments
user

Seems like you are early in your DevOps/BE journey. The way you do it is: 1. Build performant APIs. <300ms is good a...

user

https://www.youtube.com/watch?v=9b7HNzBB3OQ This is the best video on an Indian company handling insane concurrency,...

user

From what I remember hotstar used an in-house tooling that scales infra based on request rate and concurrent users pe...