Backend Development 20 min read

System Slimming Practices at Qunar: Service and Code Reduction Strategies

This article presents Qunar's comprehensive system slimming initiative, detailing the background of growing code bloat, the challenges of reducing millions of lines across thousands of services, the two‑phase plan for service and code pruning, the use of SA and other tooling to identify and safely delete unused resources, and the measurable outcomes such as nearly 50% code reduction, improved development speed, and future directions for further optimization.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
System Slimming Practices at Qunar: Service and Code Reduction Strategies

Author Introduction Ma Yangyang, senior development engineer in Qunar's infrastructure team and cloud‑native SIG member, focuses on cloud‑native performance, responsible for component marketplace, test environment governance platform Noah, and code slimming platform.

Background Qunar's backend systems have accumulated over a decade, leading to massive code growth and maintenance burden. Short‑term business features (e.g., holiday activities) are added and removed quickly, causing code to only increase while system complexity rises, slowing new development.

Challenges

Delete tens of millions of lines of code within a year.

Coordinate across dozens of teams and thousands of online services with low risk.

Lack of reference cases requiring strong creativity and technical capability.

Two‑Phase Planning

May–June: service slimming (which also reduces code).

July–November: code slimming.

Establish a virtual "Slimming Support Team" to provide common tools and technical assistance.

Service Slimming Practice

Identify service candidates by analyzing common characteristics for merging or deletion. Merging criteria include business domain, workflow, importance, and quality aspects. Deletion criteria focus on services with no traffic, no recent iteration, or already offline. Two tools are built: one to "find" candidates and another to "delete well" automatically.

Code Slimming Practice

Analyze code characteristics to find removable code, using static analysis, refactoring, and detection of long‑unused code. Evaluate methods based on "quantity" (lines removable) and "generality" (automation potential). Three solution options were considered: AOP, bytecode agent, and Serviceability Agent (SA). SA was chosen for zero performance impact and low complexity.

SA Solution Details

SA observes JVM method counters without affecting running services. A "run‑numbers" process selects a random instance, takes it offline, collects method execution counts, then brings it back online. Multiple runs over time produce a comprehensive set of used methods; the complement yields the "removable method set".

To avoid missing methods, additional instrumentation points are added to the source code and validated after deployment.

Overall Workflow

Scheduled task triggers the slimming service.

Random instance is taken offline.

SA runs on the offline instance and reports results.

Results are stored; source code is cloned to obtain the full method list.

Instrumentation data is merged with SA data to compute the final removable method set.

Deletion is performed via fully automated or semi‑automated pipelines, with manual code review (CR) and extensive testing before production release.

Results

Successfully reduced code by 49.87% (over ten million lines), decreasing development estimation time by ~10.9% and improving release efficiency by ~9.5%.

Future Outlook

Fine‑grained line‑level code slimming.

Handling long‑cycle rarely‑executed code.

Dependency and configuration slimming.

Automated service merging.

Further details will be shared in the upcoming article on system anti‑corrosion governance.

backend engineeringcloud-nativeService Optimizationcode reductionsystem slimming
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login 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.