TiDB Adoption at Pinterest

Pinterest Engineering
19 min readadvanced
--
View Original

Overview

The article discusses Pinterest's adoption of TiDB as a replacement for HBase, detailing the motivations, selection methodology, and the journey of integrating TiDB into their infrastructure. It highlights the performance improvements, cost reductions, and lessons learned during the transition.

What You'll Learn

1

How to evaluate datastore technologies based on specific business needs

2

Why TiDB was chosen over other database technologies for scalability and performance

3

How to implement effective disaster recovery strategies using TiDB

Prerequisites & Requirements

  • Understanding of distributed databases and their functionalities
  • Familiarity with AWS and Kubernetes for deployment(optional)

Key Questions Answered

What were the main reasons for Pinterest to replace HBase?
Pinterest replaced HBase due to its inadequacy in meeting evolving business needs, including performance limitations and operational challenges. The search for a next-generation storage technology led to the evaluation of various options, ultimately resulting in the adoption of TiDB.
How did Pinterest select TiDB as their new datastore?
Pinterest employed a rigorous selection methodology that included matrix analysis, public benchmarks, and internal testing with shadow traffic. This process helped identify TiDB as the most reliable and performant option among several candidates.
What are the key benefits of using TiDB at Pinterest?
The adoption of TiDB has led to significant improvements in developer velocity, system complexity reduction, performance enhancements, and cost savings, with reductions in infrastructure costs by approximately 50% compared to HBase.
What challenges did Pinterest face during the TiDB adoption?
Challenges included managing migration efforts from HBase, ensuring sustained performance under production workloads, and addressing throughput limitations in TiDB's Change Data Capture (CDC) framework. These issues were mitigated through collaboration with PingCap.

Key Statistics & Figures

Infrastructure cost reduction
approximately 50%
This reduction was achieved by decreasing the number of replicas from six to three during the migration from HBase to TiDB.
Performance improvement
2–10x
Pinterest observed significant latency improvements when migrating use cases from HBase to TiDB.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Key Actionable Insights

1
Evaluate datastore technologies through a structured methodology that includes both theoretical analysis and practical testing.
This approach ensures that the selected technology aligns with specific business requirements and can handle production workloads effectively.
2
Implement robust disaster recovery strategies, including regular backups and Point In Time Recovery (PITR), to safeguard against data loss.
Such strategies are essential for maintaining business continuity and minimizing downtime during outages.
3
Leverage the built-in functionalities of modern databases like TiDB to reduce system complexity and maintenance overhead.
This can lead to significant operational efficiencies and allow teams to focus on developing new features rather than managing legacy systems.

Common Pitfalls

1
Underestimating the complexity of migrating from one datastore to another can lead to significant operational challenges.
This often occurs when organizations do not fully assess the differences in functionality and performance between the old and new systems, resulting in unexpected issues during the transition.
2
Failing to conduct thorough performance testing under real-world workloads can lead to poor system reliability.
Without proper testing, organizations may overlook critical performance bottlenecks that only manifest under production conditions, leading to outages or degraded service.

Related Concepts

Distributed Databases
Data Migration Strategies
Disaster Recovery Planning
Performance Benchmarking