Designing Uber's Highly Available Emergency SOS Service

Arpit Bhayani

Arpit Bhayani

Nov 28, 2022 • 9 min read

Play

Designing Uber’s Highly Available Emergency SOS Service

In a ride-hailing application like Uber, an emergency SOS button is a mission-critical safety feature. When a rider or driver taps that button during an active trip, the platform has only seconds to react. The system must capture vital trip information, stream high-frequency GPS telemetry, notify law enforcement, alert emergency contacts, and dispatch an internal safety incident team.

Designing a service where human safety is on the line requires fundamentally different architectural decisions compared to standard consumer services. Downtime cannot be tolerated, data loss is unacceptable, and the platform must function seamlessly even when critical subsystems fail.


1. What Happens When the SOS Button Is Pressed?

During an emergency, every second matters. The platform must gather both static contextual data and dynamic real-time telemetry while placing minimal cognitive load on the user.

+-------------------------------------------------------------------------+
|                        SOS Triggered on Client                          |
+-------------------------------------------------------------------------+
          |                                                |
          v                                                v
+-----------------------+                        +-----------------------+
| Static Context Data   |                        | Dynamic Telemetry     |
| - Rider & Driver Info |                        | - Current GPS Lat/Lng |
| - Vehicle Make/Model  |                        | - Continuous Stream   |
| - License Plate       |                        |   (1-2 Hz intervals)  |
| - Trip ID / Route     |                        | - Reverse-geocoded    |
+-----------------------+                        |   Human Address       |
                                                 +-----------------------+

Data Payload Requirements

  1. Static Trip and Identity Details:

    • Vehicle details: Make, model, color, and license plate number.
    • Rider and driver identities, phone numbers, and ratings.
    • Active trip ID and historical route segment.
    • Location: While server-side databases already store trip information, the client must maintain a cached copy so that even during network degradation, the app can formulate self-contained alerts locally.
  2. High-Frequency GPS Tracking:

    • When an SOS is activated, the client switches from low-frequency updates to streaming coordinates at 1 to 2 times per second (1–2 Hz).
    • Continuous tracking allows responders to follow a moving vehicle’s path in real time rather than relying on a stale snapshot.
  3. Human-Readable Context (Pre-Formatted SMS):

    • In hostile or discrete emergency situations, a rider may not be able to speak on a phone call.
    • The mobile client generates a pre-formatted SMS message populated with reverse-geocoded address information, trip details, and vehicle information, ready to be dispatched with a single tap.
  4. Tri-Directional Dispatch:

    • An SOS event must be propagated to three distinct entities simultaneously:
      • Public Safety Answering Points (PSAP) / Local Police Dispatch.
      • Internal Uber Safety Support Operations.
      • User-Defined Personal Emergency Contacts.

2. Key Architectural Decisions

A. Reverse Geocoding at the Edge

Raw GPS coordinates (e.g., 37.7749° N, 122.4194° W) are machine-friendly but practically useless for a distressed passenger trying to verbally describe their location to a 911 dispatcher.

flowchart LR
    GPS[Raw Lat / Long] --> RGeo[Reverse Geocoding Engine] 
    RGeo --> Addr["Street: 4th & Market St
City: San Francisco, CA
Zip: 94103"]
    Addr --> UI[Rendered on Client UI]
    Addr --> SMS[Pre-populated Emergency SMS]
    Addr --> Dispatch[Dispatched to PSAP Dispatcher]
  • Mechanism: When the SOS signal is triggered, the platform’s location service immediately performs reverse geocoding, translating coordinates into a structured, localized address (street name, cross streets, neighborhood, city).
  • Client-Side Rendering: The reverse-geocoded address is immediately sent back to the rider’s phone so they can read their exact location aloud if connected to emergency dispatch.
  • Breadcrumb Trail: Every high-frequency location update is enriched with geocoded metadata, enabling safety teams to trace the route taken through specific intersections and neighborhoods.

B. Integration with RapidSOS

Building dedicated, proprietary integrations with thousands of municipal 911 dispatch centers and local police departments across multiple countries is practically impossible for a single software company.

  • RapidSOS as an Emergency Gateway: Uber offloads the local dispatch integration to RapidSOS, an emergency response data platform.
  • Data Standardization: RapidSOS exposes standardized APIs that accept real-time location feeds, passenger details, and vehicle telematics. RapidSOS securely routes this payload into the local emergency dispatch software (PSAP/Computer-Aided Dispatch systems) nearest to the vehicle’s coordinates.

C. Parallel Dispatch Pattern (No Sequential Cascading)

When dispatching emergency alerts across external vendors (RapidSOS), telephony providers (SMS/Voice gateways), and internal support systems, network calls must be executed in parallel rather than sequentially.

flowchart TD
    SOS[Emergency Event Initiated] --> Fork{Parallel Dispatcher}
    
    Fork -->|Thread / Worker 1| Rapid[RapidSOS API Call]
    Fork -->|Thread / Worker 2| Internal[Internal Safety Operations]
    Fork -->|Thread / Worker 3| Notif[SMS / Emergency Contacts]
    
    Rapid -.->|Fails| Cont1[Does NOT block others]
    Internal --> Succ1[Incident Logged]
    Notif --> Succ2[SMS Dispatched]

If calls were executed sequentially:

  1. A timeout or failure on the first endpoint (e.g., RapidSOS API experiencing high latency) would delay or completely block critical alerts to personal emergency contacts and internal operations.
  2. By utilizing asynchronous fan-out (multi-threaded workers or parallel execution promises), failures are isolated: an outage in one notification channel does not prevent the others from firing immediately.

3. High Availability and Failure Handling

Because the Emergency SOS service cannot tolerate downtime, its messaging and network topologies must be resilient against partial or total infrastructure outages.

Apache Kafka for Resilient Event Streaming

  • Decoupling and Persistence: SOS alerts and location streams are published to an Apache Kafka event bus. Kafka ensures that even if downstream consumer microservices (such as internal ticket generation or reporting) temporarily crash or restart, events remain durably persisted on disk.
  • At-Least-Once Delivery: Kafka consumers process emergency events under an at-least-once delivery guarantee. Receiving duplicate location points or multiple alerts is entirely acceptable in an emergency, whereas dropping a single event can be catastrophic.

Dual-Path Reliability: Falling Back to Synchronous APIs

What happens if the Kafka cluster itself becomes degraded, experiences network partitions, or goes down for maintenance?

flowchart TD
    Client[API Gateway] --> ES[Emergency Service]
    ES --> Check{Kafka Cluster Available?}
    Check -->|Yes| Kafka[Publish to Kafka Bus]
    Kafka --> Workers[Async Consumers]
    
    Check -->|No / Timeout| Direct[Fallback: Synchronous Direct RPC]
    Direct --> Rapid[Direct Call: RapidSOS]
    Direct --> DB[(Write Direct to Relational DB)]
    Direct --> SMS[Direct Call: Notification Gateway]
  • Standard enterprise applications log an error and throw a 503 when message queues fail. The Emergency SOS service cannot do this.
  • Synchronous Fallback Path: If publishing to Kafka fails or exceeds a tight timeout threshold, the Emergency Service immediately falls back to direct, synchronous RPC/HTTP calls to the respective downstream services (RapidSOS API, Notification Gateway, and primary database).
  • This introduces dual-path redundancy: asynchronous pub-sub is preferred for throughput and decoupling, but synchronous execution serves as an automated fallback.

4. End-to-End System Architecture

The following architecture shows how client telemetry flows through the gateway, services, data streams, and external responder integrations:

flowchart TD
    subgraph Mobile Client
        UserApp[Rider / Driver App]
    end

    subgraph Edge Layer
        GW[API Gateway / Load Balancer]
    end

    subgraph Core Microservices
        LocSvc[Location Service & Reverse Geocoding]
        EmergSvc[Emergency Service]
    end

    subgraph Event & Storage Tier
        KafkaBus[Kafka Event Bus]
        EmergDB[(Emergency Store / DB)]
    end

    subgraph External & Downstream Responders
        RapidAPI[RapidSOS Integration]
        NotifSvc[Notification Service]
        SupportUI[Internal Safety Support Console]
    end

    UserApp -->|1. Trigger SOS / 1-2 Hz GPS Stream| GW
    
    GW -->|Sync Route: Initial SOS| EmergSvc
    GW -->|Sync Route: Streaming Coordinates| LocSvc

    LocSvc -->|Resolve Lat/Long to Address| LocSvc
    LocSvc -.->|Return Geocoded Address| UserApp
    
    LocSvc -->|Publish GPS Breadcrumbs| KafkaBus
    EmergSvc -->|Register Incident| EmergDB
    EmergSvc -->|Publish Emergency Event| KafkaBus
    
    KafkaBus -->|Consume GPS Updates| EmergSvc
    EmergSvc -->|Update Real-Time Trail| EmergDB
    
    KafkaBus -->|Trigger Alerts| RapidAPI
    KafkaBus -->|Fan-Out Alerts| NotifSvc
    
    EmergDB -->|Real-Time Telemetry| SupportUI
    RapidAPI -->|Forward Event & Route| PSAP[Local Police / 911 Dispatch]
    NotifSvc -->|Send SMS / Voice Alerts| Contacts[Emergency Contacts]

End-to-End Execution Flow

  1. Initialization:

    • The user presses the SOS button. The mobile client sends a high-priority POST request to /api/v1/emergency/create via the API Gateway.
    • The client simultaneously initiates continuous telemetry pings (/api/v1/location/stream) transmitting raw coordinates every 500ms to 1000ms.
  2. Location Resolution:

    • The Location Service intercepts the coordinates, resolves them against reverse-geocoding indices, and responds with the current address string, which the client displays on-screen.
    • The Location Service emits the breadcrumb coordinates onto a Kafka topic dedicated to active emergency tracking.
  3. Incident Creation & Breadcrumb Tracking:

    • The Emergency Service persists the incident record into an ACID-compliant primary datastore.
    • The service consumes streaming breadcrumbs from Kafka and updates the incident’s active route in the database, allowing internal incident handlers to visualize the vehicle’s movement live.
  4. Responder Dispatch:

    • The Emergency Service pushes an event onto the alert distribution bus.
    • In parallel:
      • RapidSOS receives the payload containing vehicle make/model, license plate, rider name, phone number, and real-time location stream, relaying it directly to the local PSAP.
      • The Notification Service dispatches SMS messages to personal emergency contacts.
      • The Internal Safety Support Console alerts an Uber agent to monitor the event, attempt direct contact with the rider, and escalate if necessary.

5. Architectural Trade-offs & Failure Modes

Design DimensionSelected ApproachTrade-off / Why it Matters
Location RepresentationReverse Geocoded Address + Raw CoordinatesReverse geocoding adds slight processing overhead and requires geocoding cache lookups, but makes location immediately actionable for dispatchers and callers.
Downstream Fan-outParallel Non-blocking InvocationsRequires thread management, concurrency controls, and independent error handling, but prevents cascading failures across notification pathways.
Delivery SemanticsAt-least-once Delivery (via Kafka)Downstream notification workers may process duplicate events, necessitating idempotent handling, but guarantees zero dropped safety messages.
Availability vs ComplexityKafka with Direct Synchronous FallbackIntroduces code duplication (maintaining both an event-driven worker pipeline and synchronous client calls), but ensures survivability during queue outages.
Partner IntegrationThird-party aggregation (RapidSOS)Relies on an external SaaS platform for municipal routing, but provides instant compatibility with thousands of disparate local emergency dispatch systems.

6. Summary

Designing emergency services in distributed systems shifts the architectural focus from throughput and latency optimization to extreme availability and fault isolation:

  • Systems must be dual-path resilient: primary asynchronous channels via durable message brokers backed by automatic fallback to direct synchronous RPCs.
  • Contextual data must be human-centric: converting raw coordinates into human-readable locations via reverse geocoding directly at the point of need.
  • Alert dispatching must prioritize isolated parallelism: failure to reach an external vendor must never block alerts to safety agents or family members.
  • Real-time breadcrumb streaming provides ongoing visibility, turning a single point-in-time notification into an active, actionable incident tracking pipeline.
Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses