# How We Prevented App Performance Degradation from Sudden Ride Demand Spikes

[Grab](https://yomu.fyi/company/grab) · Corey Scott · Jan 8, 2020

**Type:** Problem & solution

## Summary

Grab experienced severe system strain when sudden localized spikes in ride demand, triggered by events like heavy rain or concert dismissals, coincided with driver shortages. These localized bursts overloaded the platform and degraded the experience for users outside the affected areas. To mitigate this, engineers created the Spampede filter, a circuit-breaker mechanism placed at the start of the booking pipeline. The filter converts pickup locations into Geohash Integer buckets and partitions time using Unix timestamps, tracking unfulfilled requests in Redis with atomic increments and time-to-live expirations. When unallocated requests exceed configured thresholds within a specific bucket, the system immediately short-circuits new incoming bookings to protect overall platform stability.

## Context

Localised ride demand spikes caused by events such as rainstorms, public transit failures, and concert exits overwhelmed Grab's system and degraded performance for users outside those specific areas due to regional driver shortages.

## Approach / What changed

Building the Spampede circuit-breaker filter, which maps pickup coordinates to reduced-precision Geohash buckets and time intervals in Redis to short-circuit and drop incoming booking processing before making downstream calls whenever unallocated booking thresholds are exceeded.

## Takeaways

- Geographic areas are bucketed efficiently without external network calls by converting pickup coordinates with the Geohash Integer algorithm and reducing precision.
- Tracking time in discrete buckets derived from the Unix timestamp avoids the higher CPU and memory overhead of sliding window calculations.
- Calling Redis INCR directly and executing EXPIRE only when the returned count is 1 minimizes commands compared to a standard load-check-store workflow.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Performance](https://yomu.fyi/topic/performance), [Redis](https://yomu.fyi/topic/redis), [Reliability](https://yomu.fyi/topic/reliability), [Scalability](https://yomu.fyi/topic/scalability)

[Read original post](https://engineering.grab.com/preventing-app-performance-degradation-due-to-sudden-ride-demand-spikes)
