How Dgraph Helps Delhivery Get More Packages to Doorsteps in Less Time
“Dgraph makes queries optimal for businesses that need a graph database. – Komal Agarwal, Technical Lead”
Summary
Executive Summary
When the largest last-mile delivery company in India wanted to launch a new project, they knew they needed a graph database. Delhivery compared Dgraph with AWS Neptune and was impressed by Dgraph’s performance. In the year it’s been used in their production environment, the Delhivery team has experienced consistently fast query response times, even as the dataset has continually grown.
Dgraph makes queries optimal for businesses that need a graph database.
— Komal Agarwal, Technical Lead
Problem
Delhivery, the largest last-mile delivery company in India, needed to launch a new project that would give precise longitudinal and latitudinal coordinates for any address in India. The company is highly backed by tech and built to scale with more countries and clients coming online on a regular basis.
With over 50,000 customers, including Amazon, Flipkart, Club Factory, and SnapD, Delhivery delivers 1.2 million packages per day across India, Bangladesh, and China. The technical team at Delhivery has 250 employees but only 15 people dedicated to DevOps. As a result, the technical team needed a solution that was production-ready, easy to manage, could handle the scale of the project, and grow alongside the business.
Approach
Delhivery needed a database that could readily capture the evolving aspects of a logistics oriented service, including iterative data modeling, low-latency queries, and lower cost of maintenance. The team quickly realized that they would need an intuitive, easy-to-operate NoSQL backend that easily fit into their use case, like a graph database.
Dgraph allows the exchange of data using non-proprietary and open JSON/RDF formats via files as well as APIs. Delhivery was able to map their use cases with Dgraph with relative ease and focus on business-facing aspects such as performance and scalability.
To do their due diligence, Delhivery compared Dgraph with AWS Neptune. During testing, they ran into caching issues with AWS Neptune; the RAM usage would continually increase until the queries started timing out. If they had gone live with that solution, it would have stopped giving the address details needed with each query, bringing business grinding to a half.
Dgraph’s unique approach to storing graphs involves sharding, or breaking apart of data, by predicates and distributing these over several machines. Additionally, Dgraph query engines execute requests in a highly parallelized manner and take full advantage of the distributed nature of its storage. This feature supports a lower cost of scaling, especially since Dgraph can run over commodity hardware. Delhivery was able to leverage these features effectively and achieved predictable and stable performance across their use cases.
Outcome
Following a seven-day setup period, Dgraph has been used in production at Delhivery for well over a year on the AWS cloud. Delhivery uses five clusters for 86GB of data that is expected to grow to 120GB in the coming six months. With 2K requests per minute, Dgraph has never had any downtime or issues.
As a result of using Dgraph, Delhivery has improved productivity. Using latitude and longitude means that drivers can optimize their delivery routes.
Compared with managed versions of MongoDB, Postgres, and ElasticSearch, which is used in other parts of the business, Delhivery found that Dgraph was easier to set up and use, even in the self-managed solution. It was just a few simple steps to get instances up and running with Dgraph.
Conclusion
Thanks to launching their service with Dgraph, Delhivery was able to improve productivity. The project has been live in production for over a year with zero downtime, delivering consistently excellent query response speeds even as the company and data grows. The company already serves logistics needs in Bangladesh and China, and this precise location project is expected to scale in those countries in the future.