Design a natural-disaster notification system
ExpediaSoftware Engineer · OnsiteLast updated
This problem tests your ability to design a high-throughput, geo-aware notification system that must deliver time-sensitive alerts to users based on their current or planned location during natural disasters.
Design a Natural-Disaster Notification System
Design a scalable system that notifies Expedia users when they are located within or traveling to a region affected by a natural disaster (e.g., hurricane, earthquake). The system must ingest disaster event feeds from government APIs, identify affected users, and dispatch notifications via push, email, or SMS.
Functional Requirements
- Ingest disaster polygons from external providers (e.g., USGS).
- Notify users currently in the impact zone.
- Notify users with upcoming bookings in the impact zone within the next 48 hours.
- Allow users to opt-out or manage notification preferences.
Non-Functional Requirements
- Low Latency: Alerts should reach users within 2 minutes of disaster ingestion.
- Scale: Support up to 50 million active users globally.
- Reliability: Ensure high delivery rates; minimize false positives.
- Consistency: Handle high-volume spikes during large-scale disasters.
Deliverables
- High-level architecture diagram (described in text).
- Choice of database schema and geospatial indexing strategy (e.g., Quadtree, S2, H3).
- Strategy for mapping user location (real-time vs. itinerary-based) to disaster impact zones.
- Design for ensuring notification idempotency to prevent duplicate alerts.
Hints
Hint 1
Consider how to efficiently store and query moving users versus static itinerary data using spatial partitioning.
Hint 2
Think about using a message queue or streaming platform to decouple disaster ingestion from the user notification pipeline.
Hint 3
Address how you would handle the 'thundering herd' problem if a major disaster impacts a high-density travel hub.
Follow-up questions
- How would you modify your design to handle a multi-region disaster scenario where the alert footprint changes hourly?
- What observability metrics would you track to ensure the system is meeting the 2-minute latency SLO?
- If the notification provider API experiences a partial outage, how would you prioritize the delivery of messages?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.