Retail and Neo4j: E-Commerce Delivery Service Routing

DZone 's Guide to

Retail and Neo4j: E-Commerce Delivery Service Routing

Efficient fulfillment and delivery of items ordered via ecommerce is an ever-evolving and ever-improving area of technology, but how is it done?

· Database Zone ·
Free Resource

As a retailer, if you think keeping up with Amazon is expensive and time-consuming, consider the alternative: extinction.

When it comes to delivery and fulfillment, Amazon is the uncontested emperor of e-commerce. Yet, their efficiency in tracking and delivering orders isn’t a complete secret: graph technology.

Now that off-the-shelf graph database platforms like Neo4j are available to smaller-than-Amazon retailers, it’s time to consider one way you can take back the lead: e-commerce delivery.

In this series on Neo4j and retail, we’ll break down the various challenges facing modern retailers and how those challenges are being overcome using graph technology. In our previous posts, we’ve covered personalized promotions and product recommendation engines as well as customer experience personalization.

This week, we’ll discuss e-commerce delivery service routing.

How Neo4j Transforms E-Commerce Delivery Service Routing

Amazon has set the standard for shipping and delivery. Thanks to its free, two-day shipping for Amazon Prime members, e-commerce shoppers aren’t willing to wait any longer than two days to receive their online purchases. As a result, retailers must meet or beat the standard or risk losing customers to Amazon.

To shorten delivery times, retailers must have visibility into inventory at storefronts and distribution centers, as well as the transit network. They need to know, for example, whether a routing problem could delay a product shipped from a distribution center located closer to the customer or whether a shortage of products makes it impossible to meet a specific delivery date altogether. Identifying the fastest delivery route requires support for complex routing queries at scale with fast and consistent performance.

E-commerce delivery service routing is a natural fit for graph databases given the highly connected nature of the data. It’s not just that it requires a lot of “hops” across data points but also that there can be many different paths with any number of permutations.

Those permutations may be optimized and deemed the best path at different times of the year and for different products, even within a single order. A graph database can take these various factors into account and support complex routing queries to streamline delivery services.

Case Study: eBay

Even before its acquisition by global e-commerce leader eBay, London-based Shutl sought to give people the fastest possible delivery of their online purchases. Customers loved the one-day service and it grew quickly. However, the platform Shutl built to support same-day delivery couldn’t keep up with the exponential growth.

The service platform needed a revamp in order to support the explosive growth in data and new features. The MySQL queries being used created a code base that was too slow and too complex to maintain.

The queries used to select the best courier were simply taking too long, and Shutl needed a solution to maintain a competitive service. The development team believed a graph database could be added to the existing Service-Oriented Architecture (SOA) to solve the performance and scalability challenges.

Neo4j was selected for its flexibility, speed, and ease of use. Its property graph model harmonized with the domain being modeled, and the schema-flexible nature of the database allowed easy extensibility, speeding up development. In addition, it overcame the speed and scalability limitations of the previous solution.

“Our Neo4j solution is literally thousands of times faster than the prior MySQL solution, with queries that require 10-100 times less code. At the same time, Neo4j allowed us to add functionality that was previously not possible,” said Volker Pacher, Senior Developer for eBay.

The Cypher graph query language allowed queries to be expressed in a very compact and intuitive form, speeding development. The team was also able to take advantage of existing code, using a Ruby library for Neo4j that also supports Cypher.

Implementation was completed on schedule in just a year. Queries are now easy and fast. The result is a scalable platform that supports the expansion of the business, including the growth it is now experiencing as the platform behind eBay Now.


Effectively competing with Amazon means your solution needs to be fail-safe, flexible and future-proof. While other technology solutions have narrow use-cases or fixed schemas, Neo4j allows you to evolve your e-commerce delivery platform as variables and circumstances change.

Using the power of graph algorithms that find the shortest path between your fulfillment centers and your customers, routing e-commerce deliveries will be a snap, not a headache.

In the coming weeks, we’ll take a closer look at other ways retailers are using graph technology to create a sustainable competitive advantage, including supply chain visibility, revenue management and IT operations.

query ,cypher ,neo4j ,ecommerce ,graph database ,database

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}