Uber Cuts Translation Cache Memory 90%, Holds P99 Latency Under 1ms — Uber redesigned its Go-based translation cache with a hybrid memory-disk architecture, cut
    ← News
    ShareXWhatsApp
    Developer Tools

    Uber Cuts Translation Cache Memory 90%, Holds P99 Latency Under 1ms

    By Twin·@TwinTowerCity·21 November 2026
    This article was produced with AI assistance and reviewed for accuracy.

    Uber redesigned its Go-based translation cache with a hybrid memory-disk architecture, cutting footprint over 90% while holding p99 latency below 1ms.

    Key Takeaways

    • Uber cut its Go translation cache's initial memory footprint by more than 90% while keeping p99 cache miss latency below 1 millisecond.
    • Garbage collection consumed over 20% of CPU in some services, with translations making up about 70% of allocated objects.
    • Switching from sync.Map to a map[string]string with an RWMutex improved CPU utilization by more than 30% in the affected service.
    • One dataset fell from about 800 MB in memory to 80–120 MB in typical use; another workload's memory dropped from 2.7 GB to 750 MB.
    • The hybrid design uses 256 shards, six-byte hash keys and a time-based LRU while preserving the existing Get()/Put() API.

    Uber has redesigned the translation cache used by its Go services, cutting the cache's initial memory footprint by more than 90% while keeping p99 cache miss latency below one millisecond, according to InfoQ. The new hybrid architecture keeps translation keys and frequently accessed values in memory and stores the remaining values on disk. InfoQ reports that the system serves millions of translations per second and maintains a cache hit rate above 99.9%.

    What Happened

    The work began with memory profiling across Uber's Go services, which surfaced two problems. Garbage collection (GC) was consuming more than 20% of CPU utilization in some services, and translations accounted for approximately 70% of allocated objects. As Uber Engineering put it, "At Uber's scale, even small inefficiencies in memory management can add up."

    The first optimization replaced Go's sync.Map with a conventional map[string]string protected by a read-write mutex (RWMutex). InfoQ explains that the workload was predominantly read-heavy, with infrequent updates and no individual deletions. The previous implementation created multiple objects and pointers for each translation entry, which increased the work the garbage collector had to do. Moving to a value-based map reduced object allocations and improved CPU utilization by more than 30% in the affected service.

    Fewer allocations did not fix overall memory consumption, however. Translation datasets could contain two to three million keys, even though individual services typically accessed only a small subset of them. Cache refreshes added a second problem: the service built a replacement cache in the background and then atomically swapped it with the existing one. Both copies therefore occupied memory at the same time, and some services ran out of memory during refreshes.

    Uber considered two alternatives: an external cache, and generating service-specific subsets of the translation data. According to InfoQ, both introduced additional operational or maintenance costs. The team instead adopted a hybrid storage design that preserves the cache's existing Get() and Put() API. All keys remain available in memory for fast lookups, while translation values are stored in disk-backed files.

    How the Hybrid Cache Works

    The implementation splits the cache into 256 shards. Each shard has its own read-write mutex, its own in-memory entries and its own disk file. Six-byte hash-based keys reduce the metadata overhead of holding every key in memory, with a fallback to the original key format to handle hash collisions.

    A time-based global least recently used (LRU) policy decides which values stay in memory. To avoid the cold-cache problem that would otherwise follow a refresh, the system uses access history to preload translations that were accessed within the previous 15 minutes before the new cache is swapped in.

    The Reported Results

    InfoQ cites two examples from Uber. In the first, a translation dataset that previously consumed approximately 800 MB in memory required around 40 MB for metadata after the redesign. With a configured limit of 50,000 in-memory entries, actual memory consumption typically ranged between 80 MB and 120 MB.

    In the second workload, approximately 30,000 of more than four million entries were loaded in memory, while the cache hit rate remained above 99.9%. The p99 latency for disk-backed cache misses stayed below 100 microseconds, and overall memory usage in that case fell from approximately 2.7 GB to 750 MB.

    Why It Matters

    InfoQ frames the project as a lesson in the cost of in-memory caching at scale. The original design held entire translation datasets in memory for every service, even though each service used only a small part of them, and it briefly doubled that footprint whenever the cache was refreshed. The redesign changed where the values live without changing how callers request them.

    Uber's team drew two recommendations from the work, as summarized by InfoQ: minimize object references to reduce GC overhead, and measure how frequently cached values are actually accessed. When only a small proportion of cached data is in active use, a hybrid approach can keep frequently accessed values in memory while moving the rest to disk. Uber's numbers show that trade-off working in practice: in the larger workload, fewer than 1% of entries were held in memory while the hit rate stayed above 99.9%.

    Background

    The project followed a familiar sequence for performance work. The first fix targeted CPU, by reducing the number of objects the garbage collector had to track. The second targeted memory, by recognizing that most of the cached data was rarely read. The two changes addressed different symptoms: the switch away from sync.Map cut allocation overhead, while the disk-backed design tackled the size of the datasets and the double-memory spike during refreshes.

    What to Watch

    The InfoQ report covers per-service examples rather than fleet-wide totals. Watch for any further detail from Uber Engineering on how many services have adopted the hybrid cache and how memory and CPU use have changed across them. Also watch how the design behaves as translation datasets grow beyond the four-million-entry workload described so far.

    Key Facts
    • Initial memory footprint fell by more than 90%, with p99 cache miss latency kept below one millisecond.
    • In one dataset, memory fell from about 800 MB to around 40 MB of metadata, with actual use typically 80–120 MB at a 50,000-entry in-memory limit.
    • In a workload of more than four million entries, about 30,000 were held in memory; overall memory use fell from about 2.7 GB to 750 MB.
    • Cache hit rate stayed above 99.9%, and p99 latency for disk-backed misses stayed below 100 microseconds.
    • The design uses 256 shards, six-byte hash keys and a time-based LRU, and preserves the existing Get()/Put() API.

    Further reading and context

    Frequently Asked Questions

    What problem was Uber's translation cache redesign solving?

    According to InfoQ, garbage collection was consuming more than 20% of CPU in some Uber Go services, with translations accounting for about 70% of allocated objects. Cache refreshes also caused some services to run out of memory because the old and new copies of the cache existed at the same time.

    How much memory did Uber save with the new cache design?

    Uber cut the initial memory footprint by more than 90%. In one dataset, about 800 MB of memory became around 40 MB of metadata, with actual use typically 80–120 MB; in another workload, overall memory fell from about 2.7 GB to 750 MB, per InfoQ.

    Did Uber change its cache's API when redesigning the backend?

    No. InfoQ reports that the hybrid design preserves the existing Get() and Put() API, even though translation values moved from memory to disk-backed files.

    What latency did Uber achieve with the hybrid disk-backed cache?

    p99 cache miss latency stayed below one millisecond, p99 latency for disk-backed cache misses stayed below 100 microseconds, and the cache hit rate remained above 99.9%.

    How does the hybrid cache handle large translation datasets?

    It uses 256 shards, each with its own mutex, in-memory entries and disk file; six-byte hash-based keys to cut metadata overhead; and a time-based global LRU policy. Before a refresh swap, it preloads translations accessed in the previous 15 minutes to avoid a cold cache.

    ShareXWhatsApp

    Get MachineHours in your inbox

    AI compute and the machine economy in your inbox.