Mobile Development 10 min read

How Ctrip Scaled Its Travel App with Mobile Architecture and Backend Gateway

This article details how Ctrip transformed its travel app by consolidating product versions, redesigning the wireless backend with a Zuul‑based gateway, decoupling the app engineering into independent modules, implementing extensive performance monitoring, and adopting native plugin and hot‑fix solutions to boost stability and user experience.

21CTO
21CTO
21CTO
How Ctrip Scaled Its Travel App with Mobile Architecture and Backend Gateway

Product

Ctrip's travel app, the core entry for all travel products, was streamlined from five platform-specific versions (iPhone, iPad, Android Phone, Android Pad, Windows Phone) into two universal versions—Universal iOS and Universal Android—to focus development and market resources.

Wireless Backend Service Architecture

The original wireless architecture bundled all services into a single module exposing all client APIs.

When the module grew, several problems emerged: DLL‑based APIs could crash due to version mismatches, full regression testing slowed releases, and low‑priority APIs could destabilize the entire process. Additional issues included lack of load balancing, monitoring, and circuit breaking.

Each API was a .NET DLL; differing interface versions caused runtime crashes. Large releases required exhaustive regression testing, coupling development and testing schedules. Low‑priority APIs could affect overall service stability.

To address these, Ctrip adopted a new gateway architecture based on Netflix's open‑source Zuul.

The gateway receives all API requests, routes them to appropriate backend services, and provides rate limiting, isolation, and circuit breaking, ensuring long‑term stability and reducing operational overhead. It also offers multi‑dimensional monitoring integrated with alerting for automated operations.

App Engineering Architecture

Initially, each product was built as a separate monolithic app, causing heavy code coupling. Ctrip decoupled the app engineering into independent modules (see Figures 3 and 4).

After decoupling, each product's code is completely independent, with navigation handled via data or URL buses. Packaging resources are customized using Run Script (iOS) and Gradle (Android).

Does the development framework meet product needs? Do performance and quality meet user‑experience requirements?

To answer the first question, core functionalities such as communication, location, hybrid framework, database, login, sharing, and basic libraries were turned into SDKs for reuse across apps, and common components like maps, calendars, city data, images, and contacts were unified.

For performance, Ctrip built its own logging pipeline: the app logs via a custom SDK, sends data to a log service, streams through Kafka into HDFS (RCFile), and queries via Hive. Metrics are collected across OS, app version, network condition, and location, covering network success rate, latency, positioning accuracy, startup time, memory, and traffic.

A dedicated portal displays these metrics; the screenshot below shows network performance updated hourly.

Based on the data, Ctrip applied several network optimizations:

Use TCP long connections to reduce connection time. Adjust parameters for 2G/3G/4G/Wi‑Fi conditions. Implement retry mechanisms for different connection phases. Maintain an IP list to avoid DNS failures or hijacking. Select server IPs based on latency (Ping). Compress payloads with Protocol Buffer + Gzip.

These changes raised the end‑to‑end network success rate from 95.32% to 99.87%, noticeably improving user experience.

The hybrid framework evolved to support powerful plugins, using offline packages to bundle hybrid pages within the app, reducing load time. Incremental updates are compressed with 7z, achieving about 30% size reduction compared to zip.

Native Plugin and HotFix

On iOS, Ctrip uses the open‑source JSPatch solution; on Android, it employs a custom DynamicAPK approach, allowing resource and code updates without modifying existing activity/fragment code, thus improving startup time.

Additional optimizations target specific scenarios, such as hybrid maps for overseas use, TCP acceleration for overseas networks, WebP image format to cut image size by 30‑40%, and image chunked uploads.

Ctrip continues to explore new technologies like React Native (used in account pages), SPDY/HTTP‑2.0, and watch‑app extensions for Apple, Huawei, and Samsung, aiming to further enhance product quality.

In summary, Ctrip’s ongoing architectural refinements focus on development efficiency, performance, quality, and emerging technologies, with the goal of sharing more insights with the industry.

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.

Mobile DevelopmentPerformance OptimizationBackend ArchitectureplugingatewayHotfix
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.