Mobile Development Network Performance Optimization Practices at Ctrip
The article details Ctrip's mobile app network architecture, common performance bottlenecks such as DNS, TCP, and payload issues, and presents six practical optimization techniques—including DNS caching, network‑quality detection, service prioritization, retry mechanisms, payload compression, and overseas CDN improvements—that collectively reduced latency by 150‑200 ms and raised service success rates above 99 %.
At the QCon Global Software Development Conference (Beijing) in April, Ctrip's Wireless Development Director Chen Haoran presented "Mobile Development Network Performance Optimization Practices," sharing the company's experience in optimizing App network performance.
Native Network Services
Core business modules are implemented as native components using long‑plus‑short TCP connections rather than typical HTTP REST APIs; payloads use a custom serialization protocol, while HTTP services use JSON.
Hybrid Network Services
Hybrid modules run in WebView and issue HTTP requests through the system WebView; a small number of services use TCP via a hybrid interface. All services first connect to a Gateway server, which forwards TCP or HTTP requests to backend SOA services.
The typical network request flow includes DNS lookup, TCP handshake, optional TLS handshake, and then request/response transmission. Round‑Trip Time (RTT) is a key metric, with typical limits of ~100 ms on 4G and ~200 ms on 3G.
Common Performance Problems
Problem 1: DNS Issues – DNS hijacking, slow or failing DNS resolution (e.g., unreliable Chinese carrier DNS) can dramatically increase latency and failure rates.
Problem 2: TCP Connection Issues – Port blocking, inappropriate timeout settings, and connection failures affect performance, especially on unstable mobile networks.
Problem 3: Read/Write Issues – Improper read/write timeout configuration and network restrictions on non‑standard ports cause request failures.
Problem 4: Large Payloads – Unoptimized payload size leads to excessive transmission time.
Problem 5: Complex Domestic/International Network Conditions – Varying bandwidth and latency across carriers and regions impact user experience.
Optimization Practice 1: DNS Resolution and Caching
Implemented a server‑IP list with weighted dynamic updates; DNS resolution runs in parallel with TCP connection attempts, and successful IPs are cached for future use.
Optimization Practice 2: Network Quality Detection
Adjusted timeout parameters and concurrent connection limits based on detected network type (2G/3G/4G/Wi‑Fi) and are working toward RTT‑based tuning.
Optimization Practice 3: Service Priority and Dependency
Introduced priority levels for services (high‑priority uses long connections) and a dependency mechanism where child services are only triggered after successful parent services.
Optimization Practice 4: Service Retry Mechanism
Automatic retry on connection, request, or response failures, with fallback from long to short connections; critical services can disable retries to avoid duplicate actions.
Optimization Practice 5: Reducing Data Transfer
Switched TCP payload serialization to Protocol Buffers with Gzip compression, reducing payload size by 15‑45 % and serialization time by 80‑90 %.
Optimization Practice 6: Overseas Network Optimization
Invested in CDN acceleration and bandwidth upgrades to improve overseas performance, especially for Hybrid modules.
These optimizations raised the app's network success rate to over 99 % (client‑side perception) and cut average service latency by 150‑200 ms, aiming for three‑nine availability on all networks except 2G.
Comprehensive logging and monitoring infrastructure (ElasticSearch‑based portal) enables real‑time KPI analysis across dimensions such as city, network type, and connection method.
Future directions include evaluating HTTP/2.0 for multiplexing, header compression, and server push.
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.
Ctrip Technology
Official Ctrip Technology account, sharing and discussing growth.
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.
