
Elevate modern apps with TiDB.
Flipkart, India’s largest e-commerce company, serves over 400 million users and facilitates over 10 million daily page visits. With Walmart as its majority stakeholder, Flipkart is known for its robust operations, handling over 8 million monthly shipments across 22 warehouses. During its annual shopping festival, “The Big Billion Days,” Flipkart manages billions of visits and achieves billions in gross merchandise value (GMV). Flipkart maintains an extensive MySQL fleet spanning 700 clusters to support its massive operations.
Massive applications and services generate petabytes of data in various types and formats. Flipkart’s tech stack (MySQL, Redis, and Aerospike) became ever more complex to process and store this amount and variety of data. However, as its business kept growing, the previous database solutions started to hit their limits, posing three significant challenges:
With over 400 applications and thousands of microservices, Flipkart’s MySQL setup spanned more than 700 clusters, managing petabytes of diverse data. As traffic and data loads increased, the MySQL clusters struggled to handle the continuously growing throughput. Adding more nodes or re-sharding data was time-consuming and complex, resulting in operational bottlenecks. This inability to scale efficiently became a major roadblock to business growth, especially during high-traffic events like their shopping festivals, when systems needed to accommodate massive spikes in user activity.
High reliability was critical, particularly during shopping events with billions of dollars in GMV. The MySQL fleet required constant monitoring to ensure stability across clusters. With such a complex setup, any single-node failure had the potential to impact customer experience significantly. The system’s resilience was under constant strain, requiring frequent failover coordination. However, MySQL struggled to meet the high availability demands, especially in disaster scenarios like node or region failures. A database outage could result in substantial losses and customer dissatisfaction, even for a few minutes.
Managing such a vast MySQL fleet was becoming increasingly costly and inefficient. Flipkart’s MySQL architecture comprised multiple shards, each requiring its own master, read replicas, and failover replicas, leading to operational complexity. Monitoring and maintaining the health of these shards, ensuring replication across clusters, and handling data consistency became a logistical nightmare. In addition, the rising costs associated with keeping this infrastructure were unsustainable. Flipkart needed a solution that simplified management and reduced the operational costs of handling data at such a scale.
Faced with scalability, reliability, and operational efficiency challenges, Flipkart recognized that continuing with MySQL was unsustainable as its business expanded. After a thorough evaluation, Flipkart chose TiDB for its unique ability to address these critical pain points, particularly within its Coin Manager platform.
Previously, the Coin Manager team used sharded MySQL as its database solution. Coin Manager ran in two regions. Region-1 served both read and write workloads, while Region-2 served as a failover region and could also handle some read workloads.
The team employed 5-way consistent hashing to manage the sharding. This resulted in a complex setup with five shards, each with a master, hot standby, a read replica in the active region, and a read replica and a hot standby in the passive region.
Maintaining the two clusters was a constant challenge because the team had to monitor the health of 25 nodes and 20 replication channels separately. In addition, a coordinated failover of the five shards would be required in a disaster. As the data size kept growing, the team needed to add more shards. Resharding the data was even more painful.
But TiDB’s hybrid design—combining features of traditional relational databases and NoSQL systems—provided Flipkart with a flexible, scalable, and highly available solution.
One of TiDB’s key advantages is its horizontal scalability, which allows the system to scale out by simply adding more nodes. This flexibility eliminated the need for complex and cumbersome sharding logic, which had plagued Flipkart’s MySQL setup. Previously, adding more shards or resharding data required downtime and manual intervention, making it both risky and costly, especially during peak seasons like “The Big Billion Days.”
With TiDB, Flipkart could grow its infrastructure seamlessly as data volumes increased. The system’s ability to handle millions of read and write requests with low latency (under 100 ms for writes and 20 ms for reads) made it an ideal choice for Coin Manager, which processes millions of SuperCoin transactions monthly. TiDB’s architecture ensures that new nodes can be added dynamically without interrupting operations, allowing Flipkart to keep pace with its growing customer base and increasing data demands.
Downtime during key shopping events could result in millions of dollars in losses for Flipkart. To prevent this, TiDB’s high availability features were crucial. Its built-in replication and failover mechanisms ensured that even if a node or an entire region experienced failure, the system would automatically and quickly failover to a healthy node or region without affecting the customer experience.
Previously, Flipkart’s sharded MySQL setup required manual intervention to handle failover, adding unnecessary delays and risks. In contrast, TiDB’s robust architecture leverages Placement Drivers (PD) to automatically manage data placement and ensure no single point of failure. This automation allowed Flipkart to meet its uptime requirements even during unforeseen events, significantly reducing the chances of service outages that could impact SuperCoin transactions.
Moreover, TiDB’s Kubernetes integration adds another layer of resilience. Kubernetes’ self-healing capabilities allow the system to automatically restart failed pods, ensuring that service interruptions are brief and recovery is fast. The Coin Manager’s infrastructure now runs on two TiDB clusters within a Kubernetes environment, simplifying the management of nodes and ensuring the system remains highly available at all times.
One of the most critical operational improvements Flipkart experienced after adopting TiDB was the dramatic simplification of database management. Managing Flipkart’s previous MySQL fleet involved monitoring multiple shards, replication channels, and nodes, which created a significant operational burden. TiDB allowed Flipkart to consolidate these disparate shards into a single, unified database, which significantly streamlined database operations.
Combining TiDB and TiDB Operator, an automated system for managing TiDB clusters within Kubernetes, further simplified the infrastructure. TiDB Operator automates routine maintenance tasks such as scaling, backups, and failover, allowing Flipkart’s database team to focus more on optimizing services than managing database health. This also reduces human error, one of the leading causes of downtime and data inconsistency.
For Flipkart, TiDB’s automated and self-scaling nature reduced operational complexity and led to substantial cost savings. By reducing the need for constant manual monitoring and intervention, Flipkart cut down on overhead associated with managing its previously large, fragmented MySQL fleet.
TiDB’s MySQL compatibility played a critical role in its adoption. Since most of Flipkart’s existing systems were built around MySQL, TiDB’s ability to integrate without requiring extensive changes to their existing applications made the transition smooth. This compatibility ensured that Flipkart could leverage TiDB’s features while keeping its existing tools, frameworks, and application logic intact. The seamless integration minimized time and costs, making it an efficient solution for Flipkart’s complex, high-volume environment.
By leveraging TiDB, Flipkart addressed its pressing scalability and reliability issues while achieving greater operational efficiency. TiDB’s unique architecture provided the agility and resilience Flipkart needed to keep pace with its rapid business growth, ensuring that its e-commerce operations could scale without compromise.
Having successfully integrated TiDB into critical systems like Coin Manager, Flipkart plans to extend its usage to more high-throughput, user-facing applications. TiDB’s ability to handle tens of thousands of reads and writes per second has proven valuable. Flipkart aims to apply it to applications with even higher demands, potentially reaching hundreds of thousands of transactions per second.
Additionally, Flipkart is exploring multi-region active-active architecture for greater resilience and business continuity. By running applications across multiple regions simultaneously, Flipkart aims to reduce the risk of downtime further and ensure seamless operations, even if one region experiences an outage.
Another strategic goal is to leverage TiDB’s Hybrid Transactional/Analytical Processing (HTAP) capabilities. While TiDB has primarily been used for transactional workloads, Flipkart plans to explore its real-time analytical features. This will allow Flipkart to run transactional and analytical queries on fresh data within the same system, eliminating the need for a separate analytics platform and enabling real-time insights.
Flipkart’s strategic adoption of TiDB has fundamentally transformed its database management, overcoming key scalability, reliability, and operational efficiency challenges. By switching from a complex, sharded MySQL system to TiDB’s distributed SQL architecture, Flipkart has simplified its infrastructure, improved system resilience, and gained the flexibility to scale seamlessly with its rapidly growing business.
For enterprises grappling with similar obstacles—such as the need to handle vast data volumes, maintain high availability during peak demand, and streamline operational costs—TiDB offers a robust and adaptable solution. Its ability to support large-scale transactional workloads, deliver high availability with automatic failover, and eliminate the complexities of manual sharding makes it an ideal choice for businesses with dynamic scaling requirements.
TiDB’s proven success at Flipkart demonstrates its value in enabling e-commerce platforms to deliver exceptional performance and service reliability while preparing for future growth and innovation.
Elevate modern apps with TiDB.