Note: In this article, I am giving you my solution to this problem. It’s written in the same flow as if I am attending an real interview.
Functional Requirement
Context: Every user can post something as “status”, at any given time, one user can only have one status (vs multiple posts).
Build a search system which should enable users to search the statuses.
Other requirements
- We need to support multi-words search
- Assume we have 1B users, on average users make 5 searches per day. And every user posts 1 status update every day.
- Stretch goal? support search for friends’ statuses only.
Cut down scope
- Text only. No emojis, no images.
- We don’t need to consider ranking.
- Global search without regional gating, i.e. US customers can see EU statuses too.
- Assume only English.
- System to post status is not in scope
- Assume status does not expire (an user’s status is live in search index forever)
Non Functional Requirement
Availability:
- 99.9% + SLA.
Consistency
- In this problem, consistency means after an user updates status, can we…