Customer Stories / Transport & Logistics / Latin America

2020
Rappi logo

Rappi Improves Efficiency, Stability, and Speed with Amazon DocumentDB (with MongoDB compatibility)

App-based marketplace startup Rappi migrated its databases to Amazon DocumentDB, increasing service performance.  

Zero

dropped outages

100

MongoDB databases migrated to DocumentDB in 3 months

Decreased latency

from up to 500 ms to 80 ms on average for the restaurants ranking query

More than 50%

decreased management/operational overhead  

Achieved greater stability

with less code

Overview

In the best of times, a service that helps people complete daily tasks more efficiently—from shopping for clothes to getting dinner—can quickly become an integral part of life. But in a scenario like the 2020 COVID-19 pandemic, that service—such as the one offered by Rappi, a Colombia-based startup—becomes indispensable.

In 2015, Rappi landed a $2 million investment for an innovative idea: become a “delivery of everything” leader by providing an app-based marketplace for the exchange of goods ranging from to-go orders and groceries to clothes. By 2018, Rappi had earned the title of unicorn startup, with an additional $200 million investment and a valuation of $1 billion, even as it continued to add to its offerings things that made its customers’ lives easier, including insurance and financial services. By 2020, Rappi had successfully expanded into nine Latin American countries with nine lines of business and had garnered an additional $1 billion in investments, growing its valuation to $5.2 billion.

In its early days, Rappi built a monolithic application with traditional architectural design patterns.  

Rappi

Although the monolithic infrastructure served the company well initially, it wasn’t long before Rappi engineers determined it needed a database platform that could support a more flexible, microservices-driven approach and facilitate the pace of innovation required to compete in the on-demand delivery business. After trying other database solutions, Rappi turned to Amazon Web Services (AWS), addressing its performance, efficiency, and scalability problems with Amazon DocumentDB (with MongoDB compatibility).  

Opportunity | Searching for a Database Solution

Rappi’s microservices architecture required multiple databases suited for different jobs. The company turned to Elasticsearch for catalog and search and set up a series of microservices organized by business unit and by country, with each country supported by one Elasticsearch cluster. But because every microservice within a country was using the same cluster, if something went wrong with any single microservice—if it established too many connections to the database or wrong index usage, for example—the resulting blast radius could create performance issues ranging from service degradation to a complete outage of every other microservice in that country. Further, because Rappi was deploying one Elasticsearch cluster per country to cover all nine lines of business in that country, the model used up to 100 nodes per cluster, which drove up the price tag, slowed down performance, and required constant maintenance. In other words, the model simply did not scale the way Rappi needed it to. “We were using really huge instances, and we weren’t getting the performance we wanted,” says Marcelo Soto, Rappi head of data platform.

These early scaling and performance problems generated frequent outages for one of the most profitable services at Rappi: its restaurant deliveries. The most egregious of these was a 3- to 4-hour outage during peak service time caused by increased requests on the Elasticsearch cluster. Meanwhile, the ranking query could take up to 500 ms, a latency that slowed down performance and affected the experience of thousands of users.

kr_quotemark

We had to make changes to transition to Amazon DocumentDB, but after we did, we found that with a lot less code, we could accomplish the same tasks with a lot more stability.”  

Marcelo Soto
Head of Data Platform, Rappi  

Solution | Finding the Right Database on AWS

As it searched for a new database solution with the goal of drastically improving performance, Rappi’s engineers determined that part of its microservices workload needed to be supported by a document store. Rappi had already taken a first step by moving these workloads from Elasticsearch into document store solutions and was working on upgrading its small MongoDB platform. Now, the Rappi team needed to eliminate the undifferentiated heavy lifting of maintaining infrastructure for so many MongoDB clusters. Compatibility with MongoDB was a factor. “Compatibility was crucial because we needed to move microservices that were already working,” says Soto. “We had to be able to move to a different database without changing much code.” Rappi found the solution it was looking for in a fully managed document database service from AWS that provided the MongoDB compatibility it needed: Amazon DocumentDB (with MongoDB compatibility), a nonrelational database designed to give customers the performance, scalability, and availability needed to operate mission critical MongoDB workloads at scale.

Now, with the migration to Amazon DocumentDB complete, “we have 2,000 different databases in production, with DocumentDB being the second most prominent,” says Soto. Rappi’s new model allots one Amazon DocumentDB cluster per each of its nine lines of business per country, and it can manage the exponential increase in clusters with just two engineers. “We had to make small adjustments to transition from MongoDB to Amazon DocumentDB, but after we did, we found that with a lot less code, we could accomplish the same tasks with a lot more stability,” continues Soto. Rappi’s largest Amazon DocumentDB cluster of five instances, which took 2 weeks to migrate, resulted in a significant improvement in performance and efficiency. In fact, Rappi has not experienced any Amazon DocumentDB–related outages, and ranking-query latency has dropped to 80 ms in the 99th percentile. “Now,” says Soto, “engineers have maybe 5 percent of the problems they had before, and if they have problems, it’s a problem with the logic or on the application side, not because Amazon DocumentDB is doing something wrong.” Along with providing better performance, the managed Amazon DocumentDB database requires substantially less maintenance and firefighting, which frees up Rappi’s data platform team to focus on value-adding activities that help move the app forward.  

Outcome | Delivering Stability in Uncertain Times

These beneficial changes to Rappi’s backend infrastructure came right when customers needed Rappi the most: during the COVID-19 pandemic. Fortunately, Rappi was positioned to handle the surge in orders and deliveries. Amazon DocumentDB also has operated as normal despite the change in volume. “With all the changes we had to do everywhere to cope with the new world reality, I don’t remember touching anything on the Amazon DocumentDB side. It really coped with the change to the load without any problem, requiring almost no work from our side,” says Soto.

Rappi’s increased stability, performance, and lower maintenance needs have given it room to focus even more on its future. With the current and future implementations of AWS services, Rappi is one step closer to delivering everything its customers need—on time, on demand, and at scale.

About Rappi

Founded in 2015, Rappi is Colombia’s first tech startup to be valued at over $5.2 billion. It offers on-demand, last-mile delivery for almost anything—from food and clothing to insurance and financial services—in nine Latin American countries.

AWS Service Used

Amazon DocumentDB

Amazon DocumentDB (with MongoDB compatibility) is a fast, scalable, highly available, and fully managed document database service that supports MongoDB workloads. 

Learn more »

More Transport & Logistics Customer Stories

no items found 

1

Get Started

Organizations of all sizes across all industries are transforming their businesses and delivering on their missions every day using AWS. Contact our experts and start your own AWS journey today.