Inside Alipay’s Metamorphosis: Java Message Middleware Powering Billions Daily

The article details Alipay’s system architecture and introduces Metamorphosis (MetaQ), an open‑source Java‑based distributed message middleware that powers billions of daily transactions, highlighting its design, features, and ideal use cases for high‑throughput, reliable, and ordered messaging in large‑scale financial services.

21CTO
21CTO
21CTO
Inside Alipay’s Metamorphosis: Java Message Middleware Powering Billions Daily

Alipay System Architecture Overview

Alipay’s platform consists of multiple subsystems such as fund processing, financial accounting, payment settlement, accounting center, transaction handling, and flexible transaction management, each illustrated with architecture diagrams.

Metamorphosis (MetaQ) – Open‑Source Distributed Message Middleware

Metamorphosis (MetaQ) is a high‑performance, highly available, scalable Java‑based distributed message middleware, similar to LinkedIn’s Kafka, offering sequential write storage, high throughput, and support for local and XA transactions. It is widely used in Alibaba’s Taobao and Alipay platforms and has been open‑sourced.

The system adopts a pull‑based model and heavily utilizes ZooKeeper for service discovery and offset storage.

Why MetaQ Was Developed

Kafka is written in Scala, which the team was unfamiliar with, and its community development was perceived as slow.

Required features missing in Kafka, such as transaction support, multiple offset storage options, and high‑availability (HA) solutions.

MetaQ provides unique capabilities:

Transparent text protocol allowing monitoring similar to memcached stats.

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 message consumption failure.

Multiple offset storage options (database, disk, ZooKeeper) with customizable group commit for improved reliability and throughput.

Message broadcast mode.

Complementary projects such as a Python client, Twitter Storm spout, and tail4j.

MetaQ processes over 120 billion messages daily in Alipay and billions in Taobao.

Suitable Applications for MetaQ

High‑throughput log transport.

Message broadcasting, e.g., cache invalidation.

Ordered data synchronization such as MySQL binlog replication.

Message routing in distributed environments requiring strict order and reliability.

General purpose MQ use cases.

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.

JavamiddlewareAlipayMetamorphosis
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

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.