Backend Development 10 min read

Evolution and Optimization of JD Daojia's Location Service System

This article explains how JD Daojia's location system, which powers store discovery and distance calculations for its O2O platform, has evolved through multiple architectural stages, addressed precision and performance challenges, and been optimized with indexing, Mercator projection, and traffic‑shaping techniques to achieve stable, high‑availability service.

JD Tech
JD Tech
JD Tech
Evolution and Optimization of JD Daojia's Location Service System

JD Daojia relies on an efficient delivery network and numerous retail partners to offer a wide range of products with one‑hour delivery, using LBS to connect consumers with nearby stores. The article introduces the role of the location system in this process.

The typical workflow includes: (1) the app obtains the user's GPS coordinates; (2) the front‑end gateway requests address information from an address service, which returns POI data; (3) the gateway queries the location service for nearby stores and distances; (4) additional store details (rating, sales, freight) are merged and returned to the app.

Two core responsibilities are identified: distance calculation (computing straight‑line or walking distance between user and store) and store location (identifying stores whose delivery range covers the user's coordinates). Over 50 subsystems depend on this service.

Distance service evolved from simple straight‑line calculations to walking‑distance calculations using GIS, with an initialization phase that pre‑computes walking distances for recent orders and a self‑updating phase that enriches the distance cache in real time.

Location service progressed through three stages: naive matching of a few stores, minimum bounding rectangle queries stored in a database, and finally an inverted‑index approach based on Mercator projection that maps the earth to a planar grid, builds forward and reverse indexes, and enables fast store lookup.

Problems encountered include insufficient precision (displaying stores outside actual delivery zones), traffic spikes caused by large‑coverage stores overwhelming the index, and JVM memory bloat due to in‑memory inverted indexes.

Optimization strategies were applied: adding real‑time coverage checks for precision, postponing index construction and implementing traffic‑shaping, and redesigning the service architecture with dedicated service nodes and a backend web component to handle store updates and index rebuilding.

After optimization, the system achieved more stable performance, reduced memory requirements, eliminated manual GC, and kept response times within acceptable limits, thereby supporting JD Daojia's rapid business growth.

performance optimizationbackend architectureIndexingGISlocation-service
JD Tech
Written by

JD Tech

Official JD technology sharing platform. All the cutting‑edge JD tech, innovative insights, and open‑source solutions you’re looking for, all in one place.

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.