System-Design-Question

feat: new library System Design Interview Props

Category: system_design Date: 2026-02-13

feat: new library System Design Interview Props

Requirements:

Functional Requirements:

  1. Users can create a new library account with username, password, and email.
  2. Users can browse and search for books by title, author, or genre.
  3. Users can reserve and borrow books.
  4. Users can return borrowed books.
  5. Admins can add, update, and delete books.

Non-Functional Requirements:

  1. System should handle 1000 concurrent users.
  2. System should respond within 2 seconds for all operations.
  3. System should be highly available with 99.99% uptime.
  4. System should store at least 1 million books.

High-Level Architecture:

  1. API Gateway: Nginx or Amazon API Gateway for load balancing and routing.
  2. Load Balancer: HAProxy or Amazon ELB for distributing traffic across multiple instances.
  3. Application Server: Java or Python application server for handling business logic.
  4. Database: Relational database (e.g., MySQL or PostgreSQL) for storing books and user data.
  5. Search Index: Elasticsearch or Apache Solr for efficient book searching.
  6. Message Queue: RabbitMQ or Apache Kafka for handling reservation and return notifications.

Database Design:

  1. Books Table: Stores book metadata (title, author, genre, etc.).
  2. Users Table: Stores user data (username, email, password, etc.).
  3. Reservations Table: Stores reservation data (user_id, book_id, borrow_date, return_date).

Scaling Strategy:

  1. Horizontal Scaling: Add more application servers and database instances as needed.
  2. Vertical Scaling: Increase instance resources (CPU, memory, etc.).
  3. Caching: Implement caching for frequently accessed data (e.g., book metadata).
  4. Sharding: Partition the database to distribute data across multiple instances.

Bottlenecks:

  1. Database Contention: Multiple requests competing for database resources.
  2. Search Indexing: Slow search indexing times.
  3. Message Queue: High message queue latency.

Trade-offs:

  1. Database Choice: Relational databases may not be suitable for large-scale search queries.
  2. Caching: Implementing caching may increase complexity and maintenance costs.
  3. Sharding: Sharding may lead to complexity in maintaining data consistency.

Solution using the First Principle of System Design:

The first principle of system design is to “Keep It Simple, Stupid” (KISS). In this solution, we aim to minimize complexity by:

  1. Choosing a simple database schema: Relational databases are well-suited for storing structured data.
  2. Using a simple search index: Elasticsearch or Apache Solr provide efficient searching capabilities without excessive complexity.
  3. Opting for a simple message queue: RabbitMQ or Apache Kafka provide reliable message queuing without excessive overhead.

By following the KISS principle, we can create a scalable and maintainable system that meets the requirements of the new library system design interview props.

Learning Links:

  1. Relational Database Fundamentals
  2. Database Sharding
  3. Elasticsearch Tutorial
  4. Apache Solr Tutorial
  5. RabbitMQ Tutorial