Bugpit

System design interview questions

Design search for a shop

"Design the search box for an online shop." You ask questions and learn: 10,000 req/s, and 4 in 100 are searches, 400 a second. Results must come back in a fraction of a second, and a new product should be searchable soon after it's added.

Practise this round

Part of Bugpit Pro. A 30 minute timed round in your browser: draw the design, run it against the traffic, then see the interviewer's checklist.

The question

10,000 requests a second at the peak, 4% of them writes. You have 30 minutes and every part on offer: servers, load balancers, caches, databases, queues and more.

How the round works

Like a real interview, the canvas starts empty and the checklist stays hidden until you submit. Bugpit then sends the traffic at your design, crashes a machine, and marks what held up, what fell over and what it would cost each month.

What a strong answer covers

Show it (try the round first)

A normal database reads row after row to find a word inside text. 400 of those a second will bury it, and a bigger machine barely helps.

Give search its own index, built for finding words. It answers in milliseconds, and your database goes back to its own job.

The index is a second copy of the data, so decide how it's kept fresh. Send each write down a stream, and let one worker save it to the database while another adds it to the index.

Say what that costs: new products appear in search a moment late. For a shop that's fine. Name a case where it wouldn't be.

The point: Search is a second system with its own copy of the data. The marks are for how you keep the copy fresh, and for admitting it lags.

Try it against the clock

More system design interview questions