Design and Implementation of Baidu App’s Personal Wallet: Architecture, Data Synchronization, Caching, and High‑Availability Strategies

This article presents a comprehensive case study of Baidu App’s personal wallet, detailing its background, business goals, system architecture, data‑synchronization mechanisms, multi‑level caching, read‑write separation, consistency guarantees, configuration management, and database sharding to achieve high availability and scalable performance.

Architecture Digest
Architecture Digest
Architecture Digest
Design and Implementation of Baidu App’s Personal Wallet: Architecture, Data Synchronization, Caching, and High‑Availability Strategies

1. Background

Baidu App serves over 200 million daily active users and generates a large amount of user asset information (cash, activity, virtual assets) across many business lines, making it difficult for users to locate and understand their overall asset status. A unified wallet was needed to aggregate all asset data, provide a single entry for asset review, and improve user experience.

2. Business Introduction

The "My Wallet" feature in the personal center collects users’ asset information from various business lines, offers a unified display, and provides quick access to cash balance, activity withdrawals, coupons, virtual coins, and other assets. Four configurable shortcut slots are exposed on the personal center, allowing operations to adjust displayed business services and data according to marketing needs.

3. System Business Architecture

The wallet serves three main parties: end users, business‑line integrators, and operations staff. Users access the wallet via the personal‑center entry or the wallet homepage, which is built with the Talos front‑end framework. A user‑asset cache determines whether a user has assets; if cached, data is returned directly. Routing adapters select appropriate data‑loading rules for each module, and a fallback mechanism provides cached data when downstream services fail.

4. Technical Details

1. Asset Data Synchronization

Because asset data is scattered across heterogeneous business lines, requiring each line to expose high‑QPS, low‑latency APIs is impractical. The wallet therefore defines three integration principles: mandatory data sync for displayed services, optional sync for homepage data, and real‑time queries for detailed pages.

1.1 Data Synchronization

Only the latest asset data is stored; historical snapshots are omitted. Business lines push change notifications, which the wallet enqueues into a message queue. The wallet server consumes the queue, pulls the latest data from the business line, and updates its storage. Batch processing and retry logic reduce load on downstream services.

1.2 Real‑time Query

For services that do not push data, the wallet defines balance and paginated detail APIs. Balance responses are cached in Redis for fallback. Detail pages combine paginated detail and monthly summary interfaces, minimizing the number of calls to downstream services by aggregating data when possible.

2. Multi‑Level Cache

Given the massive user base (hundreds of millions) and expected QPS in the tens of thousands, the wallet employs a two‑layer cache. The first layer quickly determines whether a user has any assets; the second layer stores the actual asset data. RoaringBitmap sharding is used to keep the first‑layer memory footprint low while maintaining an acceptable false‑positive rate.

3. Read‑Write Separation

Read‑heavy traffic (user‑facing) and write‑heavy traffic (data ingestion, configuration updates) are split into separate services. The read service serves cached data to users, while the write service handles data pulls, message‑queue consumption, and configuration changes, communicating via RPC.

4. Data Consistency

A push‑pull hybrid model ensures consistency: business lines push updates when assets change, and the wallet pulls the latest data when a user enters the personal center. Daily reconciliation jobs compare Redis and DB records, pulling missing updates to achieve T+1 consistency.

5. Configuration Management

The wallet supports both integration and presentation configuration. Core settings (name, link, icon, etc.) are stored in Redis, while extended attributes handle business‑specific needs. Versioning with whitelist rollout mitigates risk during configuration changes, and all configs are mirrored to Baidu Cloud Control Platform for failover.

6. Database Design

To handle the large data volume, the wallet uses sharding based on user ID, distributing tables across multiple MySQL instances. This enables horizontal scaling and maintains transactional integrity within a shard.

5. Conclusion

The article outlines the end‑to‑end technical solution for Baidu App’s personal wallet, highlighting challenges such as high availability, scalability, and rapid business integration. By simplifying architecture, employing multi‑level caching, read‑write separation, and robust configuration, the system achieves a stable, extensible platform for future asset services.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendSystem Architecturehigh availabilityConfigurationcachingdata synchronization
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

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.