Backend Development 17 min read

Design and Implementation of Baidu App Personal Wallet: Architecture, Data Synchronization, Multi‑Level Caching, and Configuration

This article details the end‑to‑end design of Baidu App’s personal wallet, covering background requirements, business integration, system architecture, data‑sync mechanisms, multi‑level caching, read‑write separation, data consistency, configuration management, and database sharding to achieve high availability and scalability.

Top Architect
Top Architect
Top Architect
Design and Implementation of Baidu App Personal Wallet: Architecture, Data Synchronization, Multi‑Level Caching, and Configuration

Background – Baidu App hosts billions of daily active users and a variety of asset types (cash, coupons, virtual currency) scattered across multiple business lines, making unified user‑asset visibility and recall difficult.

Business Introduction – The wallet aggregates all user asset information in a single entry within the personal center, providing four configurable “golden slots” for quick access and supporting both asset display and operational configuration.

System Business Architecture – The wallet service serves C‑end users, business partners, and operators. Front‑end uses the Talos framework. A user‑cache determines asset presence; if cached, data is returned directly, otherwise the logic layer fetches and aggregates data. Exception handling falls back to cached data when downstream services fail.

Technical Details

Asset Data Synchronization – Business lines push asset changes to the wallet, which enqueues notifications in a message queue, batches consumption, and pulls latest data via configurable adapters, reducing load and providing retry and flow‑control mechanisms.

Real‑Time Query – For services that do not push data, the wallet defines balance and paginated detail APIs. Results are cached in Redis for fallback, with asynchronous updates when downstream calls succeed.

Multi‑Level Caching – First‑level cache (bitmap‑based) quickly determines whether a user has any assets; second‑level cache stores actual asset data in Redis. RoaringBitmap sharding reduces memory usage (~500 MB for 10 M users) with an acceptable false‑positive rate.

Read‑Write Separation – Separate read and write services isolate high read traffic from write operations (data pull, message consumption). RPC connects the two layers.

Data Consistency – A push‑pull hybrid ensures that asset changes are pushed promptly and also pulled on user entry, with daily T+1 reconciliation between Redis and MySQL to fix inconsistencies.

Configuration Management – Both integration and presentation configurations are stored in Redis and mirrored to Baidu Cloud Control Platform (GCP) for fallback. Versioning, white‑list rollout, and history tracking mitigate configuration errors.

Database Design – User assets are sharded by user ID across multiple MySQL instances, enabling horizontal scaling while preserving transactional integrity within a shard.

Conclusion – The wallet successfully consolidates diverse asset information, addresses high‑QPS demands, and provides a configurable, highly available backend platform. Ongoing work focuses on expanding business integration, improving reliability, and enhancing user experience.

BackendSystem ArchitectureConfigurationcachingRead-Write Separationdata synchronization
Top Architect
Written by

Top Architect

Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.