0
0
LLDsystem_design~20 mins

Why booking tests availability and concurrency in LLD - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Booking Availability Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is concurrency control important in booking systems?

Imagine a popular online booking system where many users try to book the same slot simultaneously. Why is concurrency control crucial in this scenario?

ATo prevent race conditions that could lead to double booking of the same slot.
BTo allow users to book slots even if they are already taken, increasing sales.
CTo slow down the booking process so users wait longer and reduce server load.
DTo ensure that multiple users can book the same slot at the same time without any restrictions.
Attempts:
2 left
💡 Hint

Think about what happens if two people book the same slot at the exact same time.

Architecture
intermediate
2:00remaining
Which component is essential to handle availability in a booking system?

In a booking system, which component is primarily responsible for managing the availability of slots and preventing conflicts?

ADatabase with locking or transactional support to manage slot availability.
BUser Interface that shows available slots.
CNotification service to alert users about bookings.
DLogging service to record booking attempts.
Attempts:
2 left
💡 Hint

Think about where the actual data about slot availability is stored and controlled.

scaling
advanced
3:00remaining
How to scale a booking system to handle high concurrency without losing availability accuracy?

You need to design a booking system that can handle thousands of concurrent booking requests per second without double booking. Which approach best supports this requirement?

AAllow eventual consistency and resolve conflicts manually after bookings are made.
BUse a single database instance with no caching and rely on simple queries.
CImplement distributed locking or use a centralized coordination service like ZooKeeper to manage slot locks.
DDisable concurrency controls to improve speed and fix errors later.
Attempts:
2 left
💡 Hint

Think about how to coordinate access to shared resources across many servers.

tradeoff
advanced
2:30remaining
What is the tradeoff when using pessimistic locking for booking availability?

Pessimistic locking locks a slot during booking to prevent others from booking it simultaneously. What is a key tradeoff of this approach?

AIt improves system throughput by allowing many users to book simultaneously.
BIt allows users to book slots even if they are already locked.
CIt eliminates the need for any database transactions.
DIt can cause delays or reduced system responsiveness due to waiting for locks to release.
Attempts:
2 left
💡 Hint

Consider what happens when many users try to book the same slot and have to wait.

estimation
expert
3:00remaining
Estimate the maximum concurrent booking requests a system can handle with optimistic concurrency control

A booking system uses optimistic concurrency control with version checks on each slot record. If the system can process 500 booking requests per second and the average retry rate due to conflicts is 20%, what is the maximum number of concurrent booking requests the system can handle without significant delays?

AExactly 500 concurrent requests, since retries do not affect throughput.
BApproximately 400 concurrent requests, accounting for retries.
CMore than 600 concurrent requests, because retries improve throughput.
DLess than 300 concurrent requests, due to high retry overhead.
Attempts:
2 left
💡 Hint

Calculate effective throughput after accounting for retries.