The Design and Implementation of a Real Time Visual Search System on JD E-commerce Platform

Jie Li, Xuelong Li, Chuanghua Gui, Chen Jian-yu, Zhenyun Ni, Ning WangarXiv 2018

Abstract

We present the design and implementation of a visual search system for real time image retrieval on JD.com, the world's third largest and China's largest e-commerce site. We demonstrate that our system can support real time visual search with hundreds of billions of product images at sub-second timescales and handle frequent image updates through distributed hierarchical architecture and efficient indexing methods. We hope that sharing our practice with our real production system will inspire the middleware community's interest and appreciation for building practical large scale systems for emerging applications, such as ecommerce visual search.

1. Introduction

In the competitive landscape of modern e-commerce, "data freshness" is a critical requirement for user satisfaction and operational efficiency. Unlike general web search engines that can tolerate indexing delays of hours or days, an e-commerce platform must reflect real-time inventory changes. When a product is sold out, its price is adjusted, or a new item is listed, the visual search results must update almost instantaneously.

JD.com faces a unique dual challenge in this domain. First, the scale is immense, with a catalog exceeding 100 billion images. Second, the volatility is extreme, with the system processing approximately one billion image and product updates every 24 hours. Traditional visual search systems often struggle to maintain high-concurrency updates while performing the computationally intensive deep-learning-based retrieval required for image matching. This paper details the hierarchical middleware architecture designed to bridge this gap.

2. Hierarchical Distributed Architecture

To manage the massive computational load and ensure low-latency responses, the search system is organized into a three-tier hierarchical structure. This design allows for horizontal scaling and efficient query routing.

The hierarchical distributed architecture of the JD.com visual search system, showing the flow from Front end to Searchers.

2.1 Blenders

The Blender layer serves as the primary entry point for user queries. Upon receiving an image query, Blenders utilize deep neural networks to extract high-dimensional features. They are also responsible for merging and ranking the results returned from the lower tiers of the system.

2.2 Brokers

Brokers act as the middle management layer. They receive requests from Blenders and intelligently route them to specific subsets of Searchers. This routing is crucial for maintaining high throughput and ensuring that queries are distributed evenly across the index partitions.

2.3 Searchers

Searchers are the worker nodes that host the actual index partitions. Each Searcher is responsible for a specific slice of the 100-billion-image dataset. They perform the nearest neighbor search within their local partition and return the most relevant candidates to the Brokers.

3. Real-Time Indexing and Data Structures

The system employs a "dual-track" indexing strategy to balance long-term optimization with short-term agility. A Full Indexing process runs weekly to build a fresh, highly optimized index of the entire catalog. Simultaneously, a Real-Time Incremental Indexing system listens to a message queue of product changes (additions, deletions, and attribute updates) to modify the in-memory index instantly.

The internal data structures of the search index, including the Forward Index for attributes and the Inverted List for image features.

3.1 Smart Data Structures for Concurrency

To achieve sub-second updates without blocking search queries, the system utilizes several specialized data structures:

  • Forward Index: This custom array stores product attributes such as ID, price, and sales volume. Numeric updates are performed using atomic operations in-place, allowing search and update processes to occur concurrently without the need for expensive locks.
  • Inverted Index: This structure uses k-means clustering to group similar images, facilitating faster retrieval. When an index list reaches capacity, the system performs a "lock-free expansion" by creating a larger list in the background and copying data over, ensuring zero downtime for the search service.
  • Bitmap Validity: Physical deletions in a massive distributed index are computationally expensive. Instead, the system uses a bitmap to track the validity of each entry. Deleting a product is as simple as flipping a bit from 1 to 0, which immediately hides the item from search results while the actual data is cleaned up during the next full indexing cycle.

4. Performance Evaluation

The system was evaluated in JD.com’s live production environment. On a peak day (August 4, 2018), the system demonstrated remarkable efficiency:

  • Throughput: The system processed 977 million updates in 24 hours, with a peak hourly throughput of 80 million updates.
  • Latency: The average index update latency was recorded at 132ms. For search queries, the 99th percentile response time was 0.3 seconds, supporting a total of 1,800 queries per second (QPS).
  • Efficiency: A key insight was the value of feature reuse. Approximately 98% of "new" images were found to be products previously seen by the system. By utilizing a feature database to cache these extractions, the system significantly reduced the computational burden on the deep learning inference engines.

5. Conclusion

The JD.com visual search system represents a successful implementation of large-scale, real-time middleware. By decoupling search from updates through lock-free data structures and a hierarchical architecture, the platform maintains high data freshness across 100 billion images. Future work will involve integrating multi-modal ranking algorithms that combine text and image data to further improve the relevance of search results.

Summary updated

BibTeX
@misc{li2018design,
  author = {Jie Li and Xuelong Li and Chuanghua Gui and Chen Jian-yu and Zhenyun Ni and Ning Wang},
  title = {{The Design and Implementation of a Real Time Visual Search System on JD E-commerce Platform}},
  year = {2018},
  eprint = {1908.07389},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1908.07389},
}
Figure