Grab

Migrating Counter Service storage: Design choices and learnings

Jul 24, 2026
Migrating Counter Service storage: Design choices and learnings
SummaryAI, from the source post

This post details the migration of Grab's Counter Service storage from a wide-column database to Aerospike. It covers the redesign of the reader service to abstract storage access using a facade with enum dispatch and configurable operating modes (Single, WithShadow, WithSplit) for gradual rollout and verification. The writer-side data model was redesigned from a row-per-bucket approach to a map-based schema within Aerospike, storing all time-series counts for a counter in a single record. This significantly reduced the record count and primary index memory. The post also discusses the use of `MapIncrementOp` and `MapRemoveByKeyRangeOp` for atomic server-side updates and TTL management, and the challenges encountered with index memory and schema design.

More from the Counter Service Storage Migration trail