Quick Summary

In this Zomato case study, we will explore Zomato’s journey to analyze how it achieved 100% uptime for Profile Store by migrating its Database to DynamoDB. We will also explore how it improved performance, scalability, and cost-effectiveness by migrating its billing system from TiDB to Amazon DynamoDB.

Table of Contents

Introduction

The food delivery and hospitality industry is a beacon of innovation and resilience. Yet, Zomato stands out as an epitome of innovation and perseverance. Since its establishment in 2008, this Indian company has transcended borders to become a front-runner with a presence spanning 24 countries and a loyal user base of 80 million individuals. A steadfast commitment to quality permeates every aspect of its operations, fueling its expansion. We want to learn from its evolution by exploring the reasons behind Zomato’s migration from TiDB to Amazon DynamoDB.

By utilizing DynamoDB’s scaling and efficient data retrieval features, Zomato ensured the uninterrupted operation of its Profile Store, offering personalized recommendations even during peak usage times. Our comprehensive Zomato case study explains how it executed a planned migration in phases to provide a shift without downtime, demonstrating dedication to uninterrupted service delivery.

About Zomato

Zomato’s journey began in Delhi, where a simple observation of a lunch queue sparked a business idea. Foodiebay, an earlier venture, paved the way for what we know today as Zomato.

Founded in 2008 by Deepinder Goyal and Pankaj Chaddah, Zomato has become a prominent player in the food delivery industry in India and across 24 countries. The platform caters to diners and restaurants, offering features like discovery, review systems, food ordering, reservations, and dine-in options. Restaurants can also use Zomato’s delivery services to connect with customers. Today, Zomato has 80 million users across 10,000 cities in 24 countries.

Financially, Zomato has seen a strong upswing. Revenue surged by 123% in 2022, reaching Rs 4,109 crore. However, a loss of Rs 346.6 crore was reported for the December quarter of February 2023. The second quarter of 2021-2022 saw a Gross Order Value (GOV) of INR 58.5 billion.

Zomato has also participated in investment, raising $2.6 billion across 22 funding rounds. They have invested in 14 companies themselves, successfully exiting from 2, and currently have a portfolio of 12. The company has garnered support from 29 investors and completed 15 acquisitions.

In essence, this particular Zomato case study of database migration is one of continuous growth and a commitment to revolutionizing the food delivery experience for diners and restaurants.

About Amazon DynamoDB

Amazon DynamoDB is a managed NoSQL service that offers performance and easy scalability. It adjusts automatically to meet your requirements, removing the hassle of provisioning and patching tasks while ensuring data security through encryption at rest. It allows you to concentrate on the core of your business — fostering growth. Explore the DynamoDB encryption at rest feature to delve deeper into data security.

Here’s how DynamoDB can assist you;

  • Flexible Scaling: The tables in DynamoDB can accommodate data and traffic loads, scaling effortlessly without compromising performance.
  • Monitoring Resource Usage: Keep track of your database’s performance and resource consumption using the AWS Management Console.
  • Backup on Demand: Create backups of your tables for long-term storage and compliance with regulations.
  • Point in Time Recovery: Safeguard your tables from data loss by restoring them to any point within 35 days.
  • Cost-Efficient Storage Management: Implement Time to Live (TTL) to automatically remove expired data, optimize storage space, and reduce costs.

Zomato's Amazon DynamoDB Migration Success - Achieved 100% Uptime for Profile Store

Picture this. You are new to Zomato, feeling hungry and unsure of what to choose. Suddenly, you come across spot-on suggestions for restaurants, dishes, and cuisines that match your taste buds perfectly. This is all thanks to Zomato Profile Store, a data repository that stores your preferences and those of millions of users. Keeping this system running 24/7 is crucial to avoid disruptions in your dining plans!

Migration to DynamoDB for Scalability and Performance

Thanks to this upgrade, Zomato now experiences uptime for its Profile Store even during busy times like Diwali and New Year’s Eve. It ensured that personalized recommendations continued to flow with the number of users searching for their next meal. Additionally, the system has effortlessly handled traffic spikes exceeding 2.5 times its capacity without needing pre-configuration or downtime.

Zomato relies on its customer base, which leads to expected surges in website traffic during meal hours. The main goal is to uphold responsive performance (latency) even when there’s a high influx of orders. Special occasions, such as holidays, bring an added layer of complexity. Ideally, Zomato wants to handle these peak times without overinvesting the resources while ensuring a user experience during quieter periods. It is where DynamoDB’s scalability truly stands out.

Benchmarking for High Throughput

Tests demonstrated that following the shift to DynamoDB, the Profile Store could manage 17.5 million requests per minute (RPM). This remarkable capability was tested on December 31st, 2020, when the system flawlessly processed 12 million RPM—the year ended on December 31st, 2021. The Zomato platform dealt with a surge of orders 50% higher than its daily volume, showcasing DynamoDB’s effectiveness in scaling during peak demand.

The Zomato case study highlights that after migration from TiDB to Amazon DynamoDB, Zomato reduced its costs by 25%. After analyzing Zomato’s monthly and peak periods, the AWS team recommended adjustments to optimize Zomato’s DynamoDB capacity and resources.

Zomato initiated the migration process in November 2020 by checking the compatibility of its APIs to ensure data input and output. A trial run was conducted with a certain amount of traffic before transitioning to identify potential issues.

The Results

By transitioning from TiDB to Amazon DynamoDB, Zomato has ensured uptime for its Profile Store during heavy traffic. This directly translates into a user experience, with tailored recommendations ultimately leading to customer satisfaction and, hopefully, many enjoyable dining experiences!

Are You Interested in Leveraging DynamoDB's Pay-as-you-go Model?

Hire AWS Developers and enjoy a dramatic 90% reduction in microservice response.

Zomato Migrated from TiDB to Amazon DynamoDB: Unlocked Performance, Scalability, and Cost Efficiency

About Zomato's Billing Platform

Behind the scenes of every Zomato order lies a complex but crucial system: the Billing Platform. It manages everything after you place your order, from online food purchases to dine-in experiences, even facilitating social initiatives like Feeding India. This platform ensures smooth financial transactions, handling payments and facilitating large-scale payouts to restaurants and delivery riders – all critical for processing daily transactions.

Zomato’s Billing Platform utilizes an asynchronous messaging approach to prioritize reliability and availability. Imagine a series of independent tasks working together – Kafka technology connects these tasks, allowing them to function independently and adapt to changing needs. The platform acts as a central hub, receiving and sending messages to process orders and generate detailed financial records for various uses.

In the past, Zomato relied on TiDB, a database known for its unique combination of scalability and reliability. This allowed Zomato to handle real-time transactions (essential for processing orders) and data analysis (crucial for financial reporting) within the same system. TiDB’s distributed architecture also offered horizontal scaling, enabling the addition of resources as needed while ensuring fault tolerance and high availability for minimal downtime.

  • TiDB Server: Provides external access through a familiar MySQL interface and scales horizontally for increased capacity.
  • Placement Driver (PD): Manages data distribution and acts as the “brain” of the cluster, optimizing storage across TiKV servers.
  • TiKV Server: Stores data in a distributed fashion and handles transactions.
  • TiFlash Server (optional): Analyzes data faster using columnar storage, which is ideal for complex queries.

Why Zomato Preferred Amazon DynamoDB Over TiDB?

The Zomato case study revealed that due to its ability to offer a blazing-fast response time and seamless scalability, they decided to go with DynamoDB, a serverless, NoSQL database service. Besides, the pay-as-you-go solution provided by DynamoDB seems to be in focus with what Zomato was expecting – focusing on application development without managing servers. Amazon DynamoDB’s functionalities empowered Zomato to scale effortlessly, streamline developer workflows, minimize repetitive tasks, and ultimately reduce their total cost of ownership (TCO).

Apart from the abovementioned reasons, Zomato relied on Amazon DynamoDB for other reasons discussed below:

  • Fast & Consistent Performance: DynamoDB scales automatically, ensuring millisecond response times regardless of data size or traffic volume.
  • Efficient Data Retrieval: Related data is stored together, enabling fast lookups and efficient queries even on a large scale. No complex query planning is needed!
  • Automatic Scaling: Scale up or down automatically based on user traffic for cost-effective handling of peak workloads.
  • Serverless Management: Skip time-consuming setup and maintenance tasks like provisioning, configuration, and backups. Amazon DynamoDB takes care of it all.

“The scalability of Amazon DynamoDB gives us a competitive edge in this increasingly crowded space, which we wouldn’t have achieved with our previous database.”

Mr. Lalit Verma, Engineering Lead, Zomato

Challenges Faced By Zomato With the Original Database Design

Zomato initially included TiDB in the original design to handle our OLTP workloads. Zomato’s engineering team decided to use TiDB due to its strong knowledge of the relational model and MySQL and its capacity to scale horizontally to meet scaling requirements.

Over time, Zomato has significantly expanded its operations, and with the inclusion of Blinkit and HyperPure, it became necessary for their billing platform to support multiple tenants. Scaling and maintaining the TiDB database presented Zomato with numerous obstacles.

As per the Zomato case study, some of the challenges it faced in managing the TiDB database are as follows,

  • Performance Issues: Scaling became difficult with large tables and complex queries, leading to slowdowns.
  • Increased Complexity: Managing a distributed database like TiDB was more complex than single-node options.
  • Overprovisioning: Manually scaling infrastructure during peak times increased costs (TCO) and limited scalability.
  • Operational Overhead: Managing a self-hosted database required significant effort for backups, monitoring, and upgrades.
  • Delayed Backups: Large data volumes resulted in longer backup times, impacting SLAs.

Zomato Case Study: Migrating its Rational Database From TiDB to Amazon DynamoDB

Zomato initially opted for TiDB, a familiar relational database, for its billing platform. This choice leveraged the team’s expertise in MySQL and TiDB’s horizontal scaling capabilities to handle growth. However, as Zomato expanded with Blinkit and HyperPure, managing a multi-tenant TiDB database grew complex.

Single Table Design

Inspired by successful deployments of Amazon DynamoDB in other microservices, Zomato decided to streamline its approach. They migrated to a unified Amazon DynamoDB table designed using the adjacency list pattern. This consolidated all business and entity data into one location, eliminating the need for scattered data retrieval and boosting performance. It significantly reduced costs, particularly for read operations, as a single query could retrieve all necessary data. This migration leveraged the power of DynamoDB’s serverless architecture and pay-per-use model, leading to a more efficient and cost-effective solution for Zomato’s billing platform.

Designing Partition Keys

Zomato’s billing system deals with massive amounts of data, requiring a database designed for fast access. The DynamoDB’s approach of dividing data into manageable partitions with a designated “partition key” for access proved valuable, significantly improving query performance and overall scalability. This streamlined structure replaced Zomato’s prior complex system with a single Amazon DynamoDB table.

However, choosing the right partition key is critical. Zomato uses a “composite” key combining factors like merchant ID and business type to distribute data evenly across partitions, preventing overloaded sections and optimizing performance. Additionally, Zomato utilizes a “global secondary index” (GSI) to efficiently query complex data relationships, ensuring smooth operation for their large-scale billing system.

The Well-Planned Migration Approach

To ensure a seamless migration from TiDB to Amazon DynamoDB with zero downtime and uninterrupted service, Zomato implemented a meticulously planned, phased approach. It involved writing data simultaneously to both databases (dual write) for consistency, establishing replication to keep data synchronized, performing data synchronization to eliminate discrepancies before the final switch, and deploying robust failover mechanisms to guarantee continuous availability throughout the entire process.

We created this Zomato case study to understand the intricate details of each phase and how they achieved it,

The Well-Planned Migration Approach

Phase 1: Testing the Waters (Dual Write and Verify)

  • Business as usual: The application continues to interact with TiDB for reading and writing.
  • Safety first: Any data written to TiDB is simultaneously copied to DynamoDB, ensuring data consistency throughout the migration.
  • Evaluation time: Zomato takes this opportunity to assess DynamoDB’s performance and fine-tune its operations for optimal efficiency.

Phase 2: Gradual Shift (Cutover with Fallback)

  • New beginnings: The application starts writing new data directly to DynamoDB.
  • Preserving the past: Historical data remains accessible through TiDB for read operations.
  • Controlled rollout: Zomato initiates a small-scale cutover from TiDB to Amazon DynamoDB (e.g., starting in a single city) and gradually expands its reach across locations to minimize disruption.

Phase 3: Filling the Gaps (Backfilling Historical Data)

  • Moving forward: The application continues to write new data for DynamoDB.
  • Bridging the gap: Zomato migrates all historical records from TiDB to Amazon DynamoDB, creating a complete data set within the new database.
  • Letting go of the past: Once all historical data is transferred, the application stops relying on TiDB for any reads.

Phase 4: Going All-In (Full Cutover and Decommissioning)

  • Single source of truth: The application reads and writes all data (new and historical) solely from Amazon DynamoDB.
  • Severing ties: The connection between the application and TiDB is terminated to eliminate any dependence on the old database.
  • Farewell, TiDB: Zomato decommissions the TiDB infrastructure, marking the completion of the migration process.
Ready to Experience the Power of Amazon DynamoDB?

Get Started with Our Expert AWS Managed Services.

What Did Zomato Achieve with Successful Migration from TiDB to Amazon DynamoDB?

Performance

The primary motivation for migrating from TiDB to Amazon DynamoDB was a two-fold advantage: improved application performance and reduced operational complexity. This shift paid off in a big way, as illustrated in the figure below. Microservice response times saw a dramatic 90% decrease on average. Even more impressive, these response times remain consistently low (around 75 milliseconds) regardless of traffic fluctuations.

Scalability

The original database architecture presented a significant bottleneck. The figure shows that the microservice could only handle up to 2,000 requests per minute. This limitation in database throughput could have improved the overall performance and scalability of the microservice, hindering Zomato’s growth potential. Addressing this issue has become crucial to meeting future demands.

Migrating from TiDB to Amazon DynamoDB significantly improved database performance, eliminating the previous bottleneck. As a result, the microservice throughput skyrocketed to a whopping 8,000 requests per minute (RPM) at our current scale! This translates to Zomato handling four times the traffic compared to the old design. This enhanced throughput eliminated lag and enabled near-real-time billing, improving service level agreements (SLAs).

Scalability

Cost

A significant advantage of opting for Amazon DynamoDB is its pay-as-you-go system. In contrast to our method with TiDB, where we had to allocate more resources than needed for sudden traffic increases, DynamoDB enables us to pay solely for the resources we utilize. This shift has a significant 50% reduction in our monthly billing system expenses.

Also Read: Netflix’s AWS Migration Case Study – The Journey To Become a Streaming Giant

Lessons Learned

When migrating your database to DynamoDB, you can learn many lessons from our Zomato case study. By successfully migrating its billing system from TiDB to Amazon DynamoDB, Zomato ensured a smooth transition with zero downtime and no disruption to its customers. This move empowered them to handle their growing user base more efficiently.

Here’s how DynamoDB is making a difference:

  • Handling the Rush: Zomato can now process four times more transactions, ensuring smooth operation even during peak periods.
  • Speeding Things Up: Latency has dramatically reduced by nearly 90%, leading to a faster and more responsive billing experience.
  • Cost Optimization: Zomato achieved a 50% cost reduction on their database thanks to DynamoDB’s pay-as-you-go model.
  • Data-Driven Decisions: Improved reporting times allow for better decision-making, optimizing our billing operations.
  • Enhanced User Experience: Faster response times for merchant statements of accounts translate to a smoother experience for both Zomato merchants and customers, improving overall service level agreements (SLAs).

Even you can enjoy increased database throughput by 4x, reduced latency by 90%, and lowered costs by 50%. Leverage our AWS migration services to access the exceptional DynamoDB expertise of our Certified AWS developers.

Frequently Asked Questions (FAQs)

Zomato migrated from TiDB to Amazon DynamoDB to improve application performance, reduce operational complexity, and achieve scalability and cost efficiency.

Zomato ensured zero downtime during the migration process by implementing a meticulously planned, phased approach, including dual writes for data consistency, replication for synchronization, and robust failover mechanisms.

The key benefits Zomato experienced after migrating to DynamoDB included improved application performance, reduced operational complexity, enhanced scalability, and significant cost savings.

Zomato addressed the scaling and performance challenges with TiDB by adopting a unified DynamoDB table design, optimizing partition keys, and leveraging global secondary indexes for efficient queries.

Zomato was drawn to Amazon DynamoDB for features such as flexible scaling, efficient data retrieval, automatic scaling, serverless management, and fast, consistent performance, which aligned with its requirements for handling massive data loads and ensuring high availability for its billing platform.

Yes, we can assist you in migrating to Amazon DynamoDB from your existing database. Our team has extensive experience in database migration, and we follow a carefully planned approach to ensure a smooth transition with minimal downtime.

We will assess your current database setup, plan the migration process, handle data replication and synchronization, and provide support throughout the migration to ensure everything runs seamlessly. We aim to help you leverage the benefits of Amazon DynamoDB, such as improved performance, scalability, and cost efficiency while minimizing any disruption to your operations.

Get Started With DynamoDB!

Optimize your business operations by elevating your cloud database.

GET IN TOUCH NOW!

Build Your Agile Team

Hire Skilled Developer From Us

[email protected]

Your Success Is Guaranteed !

We accelerate the release of digital product and guaranteed their success

We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.

How Can We Help You?