System Design
Yesterday I watched a system design mock interview about designing Netflix. Key learnings:
- Start by asking clarifying questions to define the requirements and defining the scope.
- Take notes in real time on the screen in the same tool you'll use to design the system.
- Extract the concepts which will be the data model.
- Ask about the number of the users and the size and amount of data used.
- Decide to go with SQL or NoSQL. You'll use a SQL database when you'd have complex queries. You'd use NoSQL for unstructured data and when prioritizing availability over consistency. For example use PostgreSQL.
- Always discuss the trade-offs and defend your decisions.
- Always check with the interviewer making sure they are fine with the steps you take along the way.
- The design started with adding boxes for the data, i.e. BLOB file store and then databases, the API.
- Add in-memory cache for faster requests. For example use Redis.
- You'd need to make calculations on the fly for the size of the data, using units like K(3), M(6), G(9), T(12), P (15) bytes.
Like other skills, it takes daily practice to master the system design interviews.