Backend Development 16 min read

Gaode's Go Application Migration: Architecture, Challenges, and Technical Practices

Gaode migrated its high‑traffic rendering gateway from Java to Go to halve machine usage, validate middleware stability, and prepare for cloud‑native transformation, overcoming correctness and availability challenges by creating a real‑time traffic‑comparison tool, sandbox stress tests, and a staged gray‑release, ultimately achieving about 50% cost reduction.

Amap Tech
Amap Tech
Amap Tech
Gaode's Go Application Migration: Architecture, Challenges, and Technical Practices

Gaode has been gradually building its Go business, focusing on three areas: Go application rollout, Go middleware construction, and cloud‑native adoption. This article shares the experience, challenges, and solutions encountered during the migration of the high‑traffic rendering gateway from Java to Go.

Why migrate to Go? The main motivations are reducing machine load and cost (Go is more efficient than Java at the language level), validating the stability of Go middleware, and paving the way for future cloud‑native initiatives such as large‑scale Serverless/FaaS.

High‑traffic scenario – Rendering Gateway The rendering gateway handles about half of Gaode’s total traffic, serving map tiles, 3D models, routing, and other visual data to mobile apps, car‑head units, and open platforms. The article includes several screenshots illustrating the gateway’s impact.

Refactoring difficulties Two major challenges are ensuring business correctness (due to complex legacy logic, missing documentation, and frequent personnel changes) and guaranteeing service stability (the gateway must remain highly available even when external dependencies fail). Go middleware lacks extensive validation in large‑scale traffic, requiring careful testing.

Technical solution

1. Online traffic comparison – a near‑real‑time tool was built to compare binary traffic between the old Java service and the new Go service. Existing tools could not meet the binary‑level, near‑real‑time requirements, so a custom solution was developed.

2. Simulation environment stress testing – a sandbox that mirrors production baseline, external dependencies, and traffic was created. Both normal and abnormal states (e.g., network loss, packet drops) were exercised using chaos engineering.

3. Gradual gray‑release – following Alibaba’s three release principles (canary, monitorable, rollbackable), traffic was shifted from Java to Go in stages: new Go cluster, incremental routing rules, full cut‑over, and finally decommissioning the Java cluster.

Key benefits include nearly 50% reduction in machine count (significant cost savings), validation of the jointly built Go middleware, and laying the groundwork for cloud‑native transformation of the gateway.

Technical deep dive – Traffic‑comparison tool (ln)

The tool performs traffic capture, upload/download, binary comparison, and local replay for debugging. Traffic capture uses tcpdump to obtain raw packets with minimal overhead.

Code snippets for high‑performance byte‑slice/string conversion (used in the tool) are shown below:

func Bytes2String(b []byte) string { return *(*string)(unsafe.Pointer(&b)) }

func String2Bytes(s string) []byte { x := (*[2]uintptr)(unsafe.Pointer(&s)) h := [3]uintptr{x[0], x[1], x[1]} return *(*[]byte)(unsafe.Pointer(&h)) }

Other best practices include using sync.Pool for temporary object reuse, understanding Go’s unsigned byte semantics versus Java’s signed bytes, and rewriting performance‑critical library functions (e.g., base64 encoding) to operate in‑place and reduce CPU cache pressure.

Future outlook – The next step is a full cloud‑native transformation using Service Mesh (providing Connect, Secure, Control, Observe capabilities). This will further lower machine costs, improve isolation, and enhance observability across the entire network stack.

Recruitment notice – The author’s team is hiring engineers of any tech stack. Interested candidates should send their résumé to [email protected] with the subject format: "Name‑Technical Direction‑From Gaode Tech".

BackendperformanceCloud NativemiddlewareGotraffic-comparisonservice mesh
Amap Tech
Written by

Amap Tech

Official Amap technology account showcasing all of Amap's technical innovations.

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.