Mobile Development 15 min read

How Ctrip Optimized Mobile App Network Performance: Real-World Practices and Lessons

Ctrip's wireless development director shares a comprehensive overview of the app's network architecture, common performance pitfalls, and six concrete optimization techniques that boosted service success rates above 99% and cut latency by up to 200 ms across diverse network conditions.

21CTO
21CTO
21CTO
How Ctrip Optimized Mobile App Network Performance: Real-World Practices and Lessons

Ctrip wireless development director Chen Haoran summarizes the company's practical experience in optimizing App network performance, emphasizing that client‑side network service optimization is the top priority.

Native network services

Core business modules (hotels, flights, trains, guides) run natively and communicate via TCP long‑ and short‑connection pools rather than typical RESTful HTTP APIs; only a few lightweight services use HTTP.

Hybrid network services

Hybrid modules display H5 pages in WebView, using the system WebView's HTTP requests; a small number of scenarios (encryption, payment) bridge to native TCP channels.

All network services, whether TCP or HTTP, first connect to an API Gateway. TCP services go through a TCP Gateway that forwards requests via HTTP to backend SOA interfaces; HTTP services follow a similar path. Gateways also provide flow control and circuit breaking.

Typical network service steps include DNS lookup, TCP handshake, TLS handshake (if any), and TCP/HTTP request‑response. Round‑Trip Time (RTT) is a key metric; ideal RTT is ~100 ms on 4G and ~200 ms on 3G.

Common network performance problems

Problem 1: DNS issues – DNS hijacking, slow resolution, or failure can dramatically increase first‑request latency, especially on 2G/3G networks.

Problem 2: TCP connection issues – Port blocking, overly short or long timeout settings, and frequent connection failures degrade performance.

Problem 3: Write/Read issues – Improper read/write timeout configuration leads to failures on slow networks; some hotel Wi‑Fi networks block non‑standard ports.

Problem 4: Connection migration – When users switch between Wi‑Fi/4G/3G/2G, the client IP changes, invalidating existing sockets.

Problem 5: Oversized payloads – Unoptimized data formats increase transmission time.

Problem 6: Complex domestic/international network conditions – Varying bandwidth and latency across carriers and regions affect performance.

Optimization practices

Practice 1: Optimize DNS resolution and caching – Embed a weighted Server IP list that updates on app launch; DNS runs in parallel, and the best IP is cached for future use.

Practice 2: Network quality detection – Adjust timeout parameters and concurrent connection limits based on detected network type (2G/3G/4G/Wi‑Fi) and measured RTT.

Practice 3: Service priority and dependency – Assign priorities to services; high‑priority services use long connections, low‑priority use short ones. Implement a dependency model where child services are triggered only after the parent succeeds.

Practice 4: Service retry mechanism – Automatically retry failed connections, writes, or reads; fallback from long to short connections when needed. Critical operations like order submission have a switch to disable retries.

Practice 5: Reduce payload size – Switch TCP payload serialization to Protocol Buffers with Gzip compression, cutting payload size by 15‑45 % and serialization time by 80‑90 %.

Practice 6: Optimize overseas network performance – Use CDN acceleration and separate static/dynamic resources to improve Hybrid module performance abroad.

After applying these measures, Ctrip App’s network performance improved from version V5.9 to V6.4: core service success rates exceed 99 %, average latency dropped 150‑200 ms, and payload size and serialization overhead were dramatically reduced.

Robust logging infrastructure (client telemetry, server‑side processing, analytics portal, alerts) proved essential; the team built a real‑time monitoring portal on ElasticSearch, storing metrics in Hadoop/Hive for multi‑dimensional KPI analysis.

Future directions focus on emerging protocols such as SPDY/HTTP 2.0 and QUIC, which promise lower latency, multiplexing, and better handling of connection migration.

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.

TCPProtocolsnetwork optimizationmobile performanceRTTCtrip
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.