Pike 2.0: Meituan's Bidirectional Message Delivery Service Architecture and Features
Meituan’s Pike 2.0 replaces the Shark‑dependent Pike 1.0 with a four‑layer, TunnelKit‑based bidirectional messaging service that offers shared or independent channels, heartbeat‑driven keep‑alive, aggregated high‑QPS delivery, ordering guarantees, extensive monitoring, and plans for IoT and QUIC enhancements, achieving over 5 billion daily messages with sub‑220 ms latency.
Pike 2.0 is Meituan's bidirectional message delivery service designed to provide easy integration, high reliability, and high performance for mobile and other client platforms.
The article first reviews Pike 1.0, which was built on Shark long‑connection channels, highlighting its advantages (low latency, DNS hijacking prevention, good security, better overseas experience) and pain points such as tight coupling with Shark code, fragmented account systems across apps, and unstable push connections.
To overcome these issues, Pike 2.0 introduces a clean architecture based on the TunnelKit long‑connection core and the TNTunnel generic channel layer, completely decoupling from Shark while reusing its proven transport and security capabilities.
The overall architecture consists of four layers: Pike interface layer (providing Android, iOS, MRN SDKs and two client types for different QPS), Pike channel layer (implementing features like heartbeat detection, reconnection, alias mechanism, bidirectional messaging, message grouping/aggregation, ordering, independent channels, and channel keep‑alive), TNTunnel layer (handling protocol encapsulation, encryption, and state management), and TunnelKit layer (managing socket connections and heart‑beat).
PikeClient lifecycle is managed by a state machine (onStart, onStop, running, onReceive, onSendSuccess/Failure). Two working modes are offered: shared channel mode (default, multiple clients share a single channel with customizable identifiers) and independent channel mode (dedicated channel for high‑throughput or low‑latency scenarios). The keep‑alive mechanism combines heartbeat probing, Fibonacci‑backoff reconnection, and channel patrol to detect and recover from failures.
New features include aggregated messaging for high‑QPS live‑streaming scenarios (using ring‑queue, priority filtering, client‑side pull) and message ordering (sticky sessions and in‑order delivery via server‑side queue caching).
Stability is ensured through a Raptor‑based monitoring system that tracks SLA metrics such as uplink/downlink success rates, latency, channel setup time, and daily message volume, with alerting on significant deviations. Individual connection tracing is available via a unique Token and the management platform's 'connection sniffing' module.
By mid‑2021 Pike 2.0 served over 200 businesses, handling >5 billion messages per day with a delivery rate above 99.5 % (0.4 % improvement over Pike 1.0) and average end‑to‑end latency under 220 ms (≈37 % reduction). Example use cases include live‑streaming interaction, feed pre‑load, IoT device access (e.g., take‑away lockers), and mini‑game messaging.
Future work focuses on expanding Pike’s universal capabilities (optimizing ordering, providing dedicated channels, refining protocols), building an IoT access layer supporting HTTP/MQTT/CoAP, and enhancing weak‑network performance through QUIC‑based transports and WebTransport.
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.
Meituan Technology Team
Over 10,000 engineers powering China’s leading lifestyle services e‑commerce platform. Supporting hundreds of millions of consumers, millions of merchants across 2,000+ industries. This is the public channel for the tech teams behind Meituan, Dianping, Meituan Waimai, Meituan Select, and related services.
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.
