Big Data 11 min read

Redesign and Optimization of the WeChat Pay Transaction Record System

This article presents a comprehensive case study of how WeChat Pay rebuilt its transaction record storage system to handle massive data volumes, improve performance, ensure data completeness, support flexible queries, and strengthen security through distributed key‑value storage, data partitioning, and operational safeguards.

Architecture Digest
Architecture Digest
Architecture Digest
Redesign and Optimization of the WeChat Pay Transaction Record System

Background : Since the launch of WeChat Red Packets in 2013, the rapid growth of social payments caused daily transaction records to reach billions by 2015, overwhelming the original key/value storage system which could not scale beyond a 20 MB value limit.

Problems with the old system : The monolithic value per user caused write failures as data grew, transaction logging was on the payment critical path, record types were incomplete, and query mechanisms were limited to simple chronological scrolling.

Technical solution : The new architecture replaces the single large value with a distributed KV platform (tssd) that manages user data in multiple values organized as a hierarchical tree. A root node stores metadata and each child node holds a segment of the user's transaction data, enabling fast page‑wise access and binary‑search lookup (O(log n)). Data is partitioned by time, and root nodes themselves are sharded when they exceed size thresholds.

Classification and statistics : To meet user needs for categorization and monthly summaries, the system traverses time‑range data (average 800 records per user per month) for classification, and caches monthly statistics while computing current‑month metrics in real time.

Online operation challenges : Migrating 72.3 billion historical records from multiple sources required six months of cleaning and validation. Data anomalies caused by storage timeouts were mitigated by a full‑link queuing mechanism that forces requests to the same server/process, preventing overwrite. Holiday traffic spikes (up to 10× normal) are softened by buffering excess requests on gateway disks and replaying them later, applied selectively to red‑packet traffic.

Data security : The system enforces strict access control with user tickets, encrypts and masks sensitive fields, and implements personnel policies such as least‑privilege access, centralized permission management, and comprehensive operation logging for audit.

Results : After reconstruction, user complaint rates dropped 67 %, daily transaction records now approach tens of billions, total stored data exceeds one trillion records, and query experience has markedly improved while adhering to industry security standards.

Conclusion : The redesigned transaction record system, built for massive scale, high reliability, and strong security, positions WeChat Pay to support future diversified payment scenarios and continuously evolve its storage and query capabilities.

big datascalable architecturesecurityWeChat PayData PartitioningTransaction Storage
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

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.