Levin: Didi's Open‑Source Solution for Fast Loading of Large Static Data
Levin, Didi’s open‑source GitHub project, uses shared‑memory containers and offline‑compiled binary layouts to mmap large, low‑frequency static datasets, cutting service cold‑start times from minutes to seconds, lowering memory overhead, simplifying version switches, and improving stability for high‑scale applications.
Levin is an open-source project released by Didi on GitHub, targeting fast loading of large-scale, low-frequency updated static data.
The background describes scenarios where services need to load tens of gigabytes of data into memory at startup, causing long start‑up times, high manpower and time costs, and stability risks during rollback or failure recovery.
Levin’s principle relies on shared memory to break process‑lifetime barriers, allowing cross‑process reuse of data objects. It further improves efficiency by offline‑compiling data objects into a binary layout that can be mmap‑ed into shared memory, eliminating per‑process construction overhead.
Key features include STL‑like shared memory containers (vector, set, map, hashset, hashmap), offline data compilation, online data loading via a single shared‑memory allocation and read, a management module for container groups, version‑switch support, and built‑in validation and cleanup utilities.
Internal practice at Didi shows cold‑start and hot‑load times reduced from minutes to seconds, memory usage optimized by separating static data from session data, and disk I/O and CPU jitter during version switches greatly alleviated.
The project is hosted at https://github.com/didi/levin with documentation at https://github.com/didi/levin/wiki.
Didi Tech
Official Didi technology account
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.