Layer 3 · Go deeper · 12 min
Go deeper
Size it, build it, then make the calls an interviewer will push you on.
Back of the envelope
Size it up
Tap through each step of the arithmetic.
How many holds and night-row updates a second at peak?
Who writes more night rows, guests or hosts?
How big is a year of calendar for every unit?
Can every search node hold the whole catalogue’s availability in memory?
Build-up · 5 steps
Build the high-level design
One functional requirement at a time, ending with a marketplace that is correct on an ordinary day.
Step 1 of 5
Search by place and dates
A geocoder turns “Goa” into a box, and the index matches place, party size, filters and free nights. It’s a copy fed by change data capture, so it may trail the truth by seconds.
6 interview moments
You’re the candidate
The interviewer pushes on the hard parts. Pick an approach and see how it holds up.
Deep dive 1 of 6
Interviewer
“Priya books the Candolim villa for 29 Dec–2 Jan; a second later Arjun tries 31 Dec–3 Jan. How do you let exactly one win?”
And at the Jaipur hotel, the 41st guest wanting a Deluxe King on New Year’s Eve must be refused.
Your move. Pick an approach:
Deep dive 2 of 6
Interviewer
“Say 6,000 listings in the Goa box sleep four. How do you find the ones free on all four nights, 3,500 times a second?”
Your move. Pick an approach:
Deep dive 3 of 6
Interviewer
“A guest types a 3-D Secure OTP while their phone retries on a patchy network. How do you hold the nights without charging twice?”
Your move. Pick an approach:
Deep dive 4 of 6
Interviewer
“The Candolim villa is also on Booking.com and the host’s own website. How do you stop the same nights selling twice?”
Your move. Pick an approach:
Deep dive 5 of 6
Interviewer
“The guest saw ₹59,400 for four nights. How do you make sure that is exactly what they pay?”
Your move. Pick an approach:
Deep dive 6 of 6
Interviewer
“In the week before New Year, Goa searches run 20× normal, 700 a second, mostly for the same few nights. What do you change?”
Your move. Pick an approach:
Build-up · 8 steps
Follow one New Year booking through it
Discovery reads copies that may be seconds stale. Every change to a night is one conditional transaction on the property’s shard. Every copy is refreshed from the change stream.
Step 1 of 8
Search
“Goa, 29 Dec–2 Jan, four guests” is served from the page cache, or the index filters by box and party size. In-memory bitmaps drop listings not free all four nights; the ranker keeps the best 50.