Backend Development 10 min read

Evolution and Architecture of JD Daojia Location Service

This article explains how JD Daojia’s location system has evolved from simple distance calculations to a high‑performance, index‑driven backend service, detailing its core responsibilities, architectural stages, challenges, and the optimizations that improved accuracy, scalability, and resource usage.

Dada Group Technology
Dada Group Technology
Dada Group Technology
Evolution and Architecture of JD Daojia Location Service

JD Daojia provides a one‑hour delivery service by linking consumers with nearby merchants using a location system that powers the "Nearby" module in the app, showing POI names, store information, and distances.

The basic workflow involves the app obtaining GPS coordinates, the gateway requesting POI data from an address service, then querying the location service for nearby stores and distances, and finally enriching store details before returning them to the client.

The system’s core duties are distance calculation between user and store coordinates and locating stores within a user’s delivery range.

Initially, distance service used straight‑line (spherical) calculations, which proved inaccurate for real walking distances, prompting a shift to walking distance computed via GIS services. To meet performance needs, a two‑stage approach was adopted: an initialization phase populating a distance information store from historic orders, and a self‑updating phase that estimates distances for new users and continuously enriches the store with actual GIS results.

Location service evolved through three stages: naive matching of listed stores, using minimum bounding rectangles stored in a database, and finally a Mercator‑projection based inverted index that maps grid cells to covering stores. This involved building forward (store‑to‑grid) and inverted (grid‑to‑store) indexes, enabling fast lookup of stores covering a user’s coordinate.

The service architecture stores the full inverted index and basic store info in memory on each service node, while a backend web component processes store change messages to rebuild forward indexes and generate update tasks for the nodes.

Operational issues that emerged included insufficient location precision, traffic spikes from large delivery ranges causing node performance fluctuations, and excessive JVM memory usage (over 22 GB) leading to long GC pauses.

Optimizations implemented were: adding real‑time coverage checks to improve precision, moving indexing to a post‑processing step with traffic shaping, and redesigning the service architecture to reduce memory pressure and stabilize response times.

After these improvements, the service’s average latency stabilized around 4 ms, memory requirements dropped, manual GC became unnecessary, and overall performance became more predictable, supporting the rapid growth of JD Daojia’s business.

In summary, the JD Daojia location system is a foundational backend service that has continuously evolved to provide reliable, high‑availability positioning and distance capabilities essential for the platform’s O2O e‑commerce operations.

performance optimizationbackend architectureinverted-indexGISDistance Calculationlocation-service
Dada Group Technology
Written by

Dada Group Technology

Sharing insights and experiences from Dada Group's R&D department on product refinement and technology advancement, connecting with fellow geeks to exchange ideas and grow together.

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.