AsyncStorage served us well, but at scale it becomes a bottleneck. MMKV — backed by memory-mapped files — is orders of magnitude faster.
For MedGulf's insurance app, offline capability isn't a nice-to-have. Field agents operate in areas with spotty connectivity, and claims need to be filed regardless.
Our architecture:
- MMKV as the local truth store
- A write-ahead log for mutations
- Background sync queue that retries with exponential backoff
- Conflict resolution using last-write-wins with server timestamps
The key insight: treat local storage as the primary database, and the server as a sync target. This inverts the typical client-server relationship.
Performance numbers:
- Read: 0.01ms (vs 6ms AsyncStorage)
- Write: 0.02ms (vs 15ms AsyncStorage)
- Batch 1000 items: 2ms (vs 800ms AsyncStorage)
The result: the app feels instant, even when the network doesn't cooperate.