Overview of Alipay System Architecture and the Metamorphosis Distributed Message Middleware
This article presents a detailed overview of Alipay's system architecture—including its processing flow, fund handling platform, accounting, settlement, and transaction modules—and introduces Metamorphosis, an open‑source high‑performance distributed messaging middleware developed by Alibaba, highlighting its features, design motivations, and suitable use cases.
Alipay System Architecture Overview
The diagram above illustrates the overall architecture of Alipay's payment system.
Typical Processing Flow
This flow shows the default processing steps for a payment transaction.
Fund Handling Platform
The platform manages the movement of funds between accounts.
Financial Accounting
Accounting modules record all financial activities.
Payment Settlement
Settlement processes finalize the transfer of money to the intended recipients.
Accounting Center
The accounting center consolidates and reconciles all transaction data.
Transaction
Core transaction processing ensures correctness and durability.
Flexible Transactions
Various images illustrate the flexible transaction mechanisms employed by Alipay.
Metamorphosis (MetaQ) – Alibaba's Open‑Source Distributed Message Middleware
Metamorphosis (MetaQ) is a high‑performance, highly available, and scalable distributed messaging system similar to LinkedIn's Kafka. It provides sequential message storage, high throughput, support for both local and XA transactions, and is widely used in both Taobao and Alipay.
Metamorphosis originated from the author's study of LinkedIn's open‑source MQ and Apache Kafka. Unlike the typical push model, MetaQ uses a pull mechanism and heavily relies on ZooKeeper for service discovery and offset storage.
Reasons for Re‑implementing Meta (Compared to Kafka)
Kafka is written in Scala, which the author is not familiar with, and its community development is perceived as slow.
Kafka lacks several features required by the author, such as full transaction support, multiple offset storage options, and advanced high‑availability (HA) solutions.
Meta offers unique capabilities not present in Kafka.
Transparent text‑based protocol, similar to memcached stats, for broker monitoring.
Pure Java implementation covering communication, storage, client, and server.
Transaction support, including local and XA distributed transactions.
HA replication with both asynchronous and synchronous modes to ensure message reliability.
Asynchronous message sending.
Local recovery on consumer failure.
Multiple offset storage back‑ends (database, disk, ZooKeeper) with customizable implementations and group commit support.
Message broadcast mode.
Complementary projects such as a Python client, a Twitter Storm spout, and Tail4j.
Meta processes an enormous volume of messages daily—approximately 12 billion messages routed through Meta in Alipay and hundreds of millions in Taobao.
Suitable Applications for Meta
High‑throughput log transport.
Message broadcasting, e.g., cache invalidation notifications.
Ordered data synchronization, such as MySQL binlog replication.
Message routing in fully clustered broker/producer/consumer environments where order and reliability are critical.
General purpose MQ use cases.
© The content is sourced from the web; all rights belong to the original author. If any infringement is identified, please notify us for prompt removal.
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.
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.
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.
