How Baidu Built a Scalable Asset Wallet for 100M+ Users: Architecture & Lessons
This article details the end‑to‑end design and implementation of Baidu App’s personal wallet, covering background, business flow, system architecture, data synchronization, multi‑level caching, read‑write separation, consistency mechanisms, configuration management, and database sharding to achieve high availability for billions of users.
Background
Baidu App has over 200 million daily active users and stores various asset types (cash, activity, virtual) across multiple business lines, making it difficult for users to view all assets and for the app to provide a unified asset view.
Business Introduction
The “My Wallet” feature in the personal center aggregates all user assets, providing a unified management and display interface, with four configurable entry points for quick access and asset visibility.
System Business Architecture
The wallet serves C‑end users, business partners, and operators. Users access the wallet via a personal‑center entry or the wallet homepage, built with the Talos front‑end framework. Data is cached, with fallback mechanisms for service exceptions.
Technical Details
1. Asset Data Synchronization
Business lines push asset changes to the wallet, which queues notifications, pulls latest data via a message queue, and updates storage, employing retries and flow control to protect downstream services.
2. Real‑time Query
For lines that do not push data, the wallet defines balance and paginated detail APIs, caches balances in Redis for fallback, and aggregates monthly summaries to reduce calls.
3. Multi‑level Caching
A two‑layer cache determines whether a user has assets (first layer) and stores asset data (second layer). RoaringBitmap sharding was chosen for its low memory footprint and acceptable false‑positive rate.
4. Read‑Write Separation
Read traffic (user requests) and write traffic (data pulls, pushes) are handled by separate services communicating via RPC, ensuring write failures do not affect user reads.
5. Data Consistency
A push‑pull hybrid ensures timely asset updates; periodic reconciliation compares Redis and DB data, correcting inconsistencies with a T+1 audit.
6. Configuration Management
Both integration and presentation configurations are stored in Redis, versioned, and synchronized to Baidu Cloud Control (GCP) for fallback, supporting rapid business onboarding.
7. Database Design
Due to massive user volume, data is sharded by user ID across multiple MySQL instances, enabling horizontal scaling and transactional consistency per user.
Summary
The wallet project tackled challenges of high availability, stability, and fast business integration, employing modular architecture, caching strategies, and robust configuration to deliver a seamless asset management experience for billions of users.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
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.
