Practical Resources for System Design and ML interview Questions (repo+website)
Category: ml_system_design
Date: 2026-03-18
Practical Resources for System Design and ML Interview Questions
Requirements:
- Functional Requirements:
- Users can upload and store resources (e.g., PDF, image, video) on the platform.
- Users can browse and view stored resources.
- Users can search resources by keyword, category, or tags.
- Users can save and organize resources for later use.
- Admins can manage user accounts, resource categories, and tags.
- Non-Functional Requirements:
- High availability and scalability to handle a large number of users.
- Fast resource uploading, browsing, and searching.
- Secure authentication and authorization mechanisms.
- Regular backups and data durability.
High-Level Architecture:
- Frontend:
- Client-side: React.js or Angular.js for a responsive and interactive UI.
- Server-side: RESTful API using Node.js and Express.js for handling requests.
- Backend:
- Resource Storage: Distributed file system like Amazon S3 or Google Cloud Storage for storing resources.
- Database: Relational database like MySQL or PostgreSQL for storing metadata (e.g., resource title, description, tags).
- Search Engine: Elasticsearch or Apache Solr for efficient resource searching.
- Authentication and Authorization:
- OAuth 2.0 for user authentication.
- Role-Based Access Control (RBAC) for user authorization.
Database Design:
- Resource Table:
id (primary key): unique identifier for each resource.
title: resource title.
description: resource description.
tags: list of tags associated with the resource.
category_id: foreign key referencing the category table.
- Category Table:
id (primary key): unique identifier for each category.
name: category name.
- User Table:
id (primary key): unique identifier for each user.
username: username.
email: email address.
Scaling Strategy:
- Horizontal Scaling:
- Add more servers to handle increased traffic.
- Use load balancers to distribute traffic across servers.
- Vertical Scaling:
- Upgrade server hardware to handle increased traffic.
- Database Sharding:
- Split large databases into smaller, more manageable pieces.
- Use sharding keys to determine which shard to query.
Bottlenecks:
- Resource Uploading:
- High upload traffic can cause server overload.
- Solution: Use a content delivery network (CDN) to distribute upload traffic.
- Resource Searching:
- Large number of resources can slow down search queries.
- Solution: Use a search engine like Elasticsearch or Apache Solr.
Trade-offs:
- Data Consistency vs. Availability:
- Strong consistency can lead to high latency and reduced availability.
- Solution: Use eventual consistency to allow for faster writes and reads.
- Scalability vs. Complexity:
- Simple designs can be less scalable.
- Solution: Use a scalable architecture that balances simplicity and complexity.
First Principle of System Design:
The first principle of system design is to “design for the unknown.” In this case, we can use the following approach:
- Identify Uncertainties:
- What are the unknowns in this system?
- What are the potential risks and challenges?
- Anticipate and Address Uncertainties:
- Design the system to handle unexpected traffic or failures.
- Use techniques like load balancing, caching, and sharding to distribute load.
- Monitor and Adapt:
- Continuously monitor system performance and logs.
- Adapt the system design as needed to handle changing user behavior and traffic patterns.
Learning Links:
- System design principles: https://github.com/donnemartin/system-design-primer
- RESTful API design: https://restfulapi.net/
- Elasticsearch: https://www.elastic.co/elasticsearch/
- Apache Solr: https://lucene.apache.org/solr/
- Load balancing: https://en.wikipedia.org/wiki/Load_balancing
- Caching: https://en.wikipedia.org/wiki/Cache_(computing)
- Sharding: https://en.wikipedia.org/wiki/Shard_(database_architecture)