Bird
Raised Fist0

To optimize performance, would you choose a centralized LoanManager or a distributed LoanManager per library branch, and why?

hard🌍 Real-world Scenario Q9 of Q15
OOP & Design Patterns - Design a Library Management System - LLD with Relationships & Edge Cases
You are designing a Library Management System for a large university with thousands of concurrent users. To optimize performance, would you choose a centralized LoanManager or a distributed LoanManager per library branch, and why?
ACentralized LoanManager to maintain a single source of truth and simplify concurrency control
BCentralized LoanManager with eventual consistency to improve scalability
CDistributed LoanManager per branch to reduce contention and localize data access
DDistributed LoanManager with no synchronization to maximize throughput
Step-by-Step Solution
Solution:
  1. Step 1: Analyze scale and concurrency requirements

    Thousands of users and multiple branches imply high contention on centralized resources.
  2. Step 2: Evaluate centralized LoanManager approach

    Centralized manager simplifies consistency but becomes a bottleneck under load.
  3. Step 3: Evaluate distributed LoanManager per branch

    Distributed managers reduce contention by localizing data and operations per branch, improving performance.
  4. Step 4: Reject no synchronization and eventual consistency options

    No synchronization risks data corruption; eventual consistency may cause stale data issues in loans.
  5. Final Answer:

    Option C -> Option C
  6. Quick Check:

    Distributed per branch reduces contention and scales better [OK]
Quick Trick: High concurrency -> distributed managers reduce bottlenecks [OK]
Common Mistakes:
MISTAKES
  • Choosing centralized for simplicity ignoring scale
  • Ignoring synchronization needs in distributed systems
  • Assuming eventual consistency is acceptable for loans
Trap Explanation:
PITFALL
  • Candidates often pick centralized for simplicity, missing scalability bottlenecks.
Interviewer Note:
CONTEXT
  • Assesses trade-offs in distributed system design and concurrency management.
Master "Design a Library Management System - LLD with Relationships & Edge Cases" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes