Design a distributed system for managing equipment reservations at a university, with priorities and offline operation.
Asked at
AI answer
Architecture and model
Clients call the API, and the booking service uses PostgreSQL as the source of truth; separate modules handle the equipment catalog, access permissions, notifications, and reports. Core entities: Equipment, Location, Booking, User, PriorityPolicy, BookingEvent. Store the history of status transitions and priority decisions for auditing.
Booking and priorities
Confirming a booking for a single resource must be atomic: a transaction checks for overlapping time intervals and creates the booking. Use a constraint on non-overlapping intervals (for example, an exclusion constraint in PostgreSQL) or lock the equipment row and check again. Statuses distinguish a draft, a pending request, a confirmed booking, a cancellation, and a completed booking.
Set priorities using a transparent policy: role/course, learning objective, request time, and usage limits. Sort the request queue according to the policy, but never silently displace a confirmed booking. If displacement of lower-priority requests is allowed, it must be explicitly stated, communicated, and recorded in the audit log. Do not hold a database lock while requests are being coordinated or external systems are being called.
Offline mode
The client can cache the catalog and schedule with a timestamp, create drafts, and add requests to a local queue. An offline request is not a confirmed booking: the server makes the final decision during synchronization, since another device may have taken the resource. Show an “awaiting synchronization” status and the outcome of any conflict; support resubmission with an idempotency key. For extended network outages, local administrators can be given a limited offline mode with resources allocated in advance and reconciled later.
Reliability and operations
Use university account authentication, role-based authorization, audit logging, and backups. A notification queue and transactional outbox prevent alerts from being lost. Metrics: booking conflicts, synchronization errors, cancellation rate, and response time; regularly test recovery from backups.
Also asked at IBS
- Suppose a virtual machine has no CPU load and no RAM pressure, but its load average is huge and the server is really lagging. Where would you look, and what might be the problem?
- How do you perform a forensic analysis of a compromised container that was deleted but whose Linux audit logs were retained?
- How do you use SELinux or AppArmor for container profiles in a production environment to restrict access to the host file system?
- What is the difference between bridging, masquerading, and routing in the context of Docker/Kubernetes networking?
- Which TCP parameters (sysctl) do you change for low-latency, high-load HTTP services?
Similar questions
- Design a distributed system for managing dry-cleaning orders, with offline terminals and disputes.
- Design a distributed system for processing orders in an online store, including inventory reservation, payment, delivery, and returns.
- Design a distributed system for processing book printing orders, including layout versions, payments, and logistics.
- Design a distributed system for managing medical prescriptions with versioning, reminders, and offline mode.
- Design a distributed system for managing access to parking facilities with subscriptions, one-time visits, and offline terminals.