Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38

MyDBOPS 19 views 46 slides Mar 04, 2025
Slide 1
Slide 1 of 46
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46

About This Presentation

Migration Journey To TiDB - Kabilesh PR - Mydbops MyWebinar 38

Youtube video link: https://youtu.be/_WgXm1Ykj8c

What You Will Learn
* Data Migration Strategies – Understand the best approaches for transferring data to TiDB with minimal disruption.
* Seamless Replication – Learn how to maintai...


Slide Content

Migration Journey To TiDB

Empowering Scalability, Performance & Simplicity
Kabilesh PR
Founding Partner, Mydbops LLP
38
th
MyWebinar - Mydbops

About Me
Kabilesh PR
❏Interested in Open Source DB technologies
❏Keen Interest in MySQL, TiDB & Distributed SQL’s
❏Active Tech Speaker/Blogger
❏Pingcap Certified TiDB Professional
❏AWS Database Speciality
❏Founding Partner, Mydbops

Focus on MySQL, MongoDB, PostgreSQL, TiDB, Cassandra
Consulting
Services
Consulting
Services
Managed
Services
24*7
DBA Team
Targeted
Engagement
Mydbops Services

❏Introduction

❏Why Migration ?

❏Migration Methods

❏Challenges & Solutions

Agenda

Introduction

TiDB is an Open Source , Distributed HTAP database compatible with MySQL Protocol.
Introduction
2

Understanding TiDB Architecture

MySQL compatible, the TiDB SQL Layer
separates compute from storage to make
scaling simpler,

The Placement Driver functions as a
orchestrator. Responsible for TSO,
scheduling, shard maintenance,
metadata and much more

Tikv is ROW based, Transactional
storage, Offers high-availability, strong
consistency that can auto-scale to
hundreds of node with petabyte data
scale

Why Migration ?

MySQL limitations

are usually experienced with growth in business!!

Scalability High Availability
Real-Time Analytics

Advantages of TiDB
Open Source
No Vendor lock-in with a
database that’s 100% open source.
Horizontal Scaling
Grants total transparency into data workloads without
manual sharding.

Horizontal Scaling
Grants total transparency into
data workloads with automatic sharding.
High Availability
Guarantees auto-failover and self-healing for
continuous data access.
MySQL Compatibility
Enjoy the most MySQL compatible
distributed SQL database on the planet.

Multi-Cloud
Deploy database clusters
anywhere in the world.

Mixed Workloads
Streamlined tech stack makes it
easier to produce real-time analytics.
Robust Security
Protect data with enterprise-grade
encryption both in-flight and at-rest.

Global client-Base TiDB

Journey of Migration

Assessment

❏Primary key for all tables
❏Foreign-keys (experimental)
❏Serializable isolation
❏Triggers
❏Auto-increment
❏Full-text index
❏Triggers
❏Stored procs
❏User Defined functions

Migration Process

❏Migration tool provided by TiDB which directly integrates with MySQL.
❏Its highly Available, can handle data from multiple sources.

DM - Data Migration

Aspect Physical Import Mode Logical Import Mode
Backend Local TiBD
Import Speed
Fast (approximately 100–500
GiB/hour)
Slower (approximately 10–50
GiB/hour)
Resource usage High Low
Network Usage High Low
ACID Compliance No Yes
Target Tables Must be Empty Can contain existing data
TiDB Cluster VersionRequires version 4.0.0 or later Compatible with all versions
Service Availability Limited service availability Full service availability

Task mode Description Use Case
Full Migrates the entire existing data from
the source database to TiDB.
Ideal for initial data migration when
setting up TiDB with existing datasets.
Incremental

Continuously replicates new changes
(binlog events) from the source to TiDB.
Suitable for keeping TiDB synchronized
with the source database in real-time.
All Combines both full data migration and
incremental replication.
Best for scenarios requiring a complete
data transfer followed by ongoing
synchronization

Validation

Data Validation

❏Dm supports validating data between source and
destination via checksum
❏Sync-diff-inspector compares dataset for inconsistencies
❏Manual validation.
❏Data validation time varies based on dataset size.

❏Functional: Confirm that queries return identical result in both DB
❏Performance: compare query execution time to capture any
regressions
❏Read traffic: Transfer some live read traffic with proxysql or dual
reads from application
Query Validation

Switch over

Rollback

Challenges & Solutions

❏Auto-increment: ID is batched by default per TiDB.
Solution : Enable auto_id_cache per table while Table creation to
have MySQL compatibility.
Bug : https://github.com/pingcap/tidb/issues/56814

Work around:
Alter table messages FORCE AUTO_INCREMENT=1304776036;

Wrote python script to fix the discrepant records
Thanks !! Max Liu, CEO and Founder at Pingcap. The bug was located and fixed in 3
days and patch was released

❏Query Regression: Some of the queries had regression in terms of
exec time.
Solution : Queries we rewritten, ie., changing the joining
condition, where clause
❏Descending Index: Not supported.
Solution : Queries needs to be rewritten with range and sorted.
❏Full text index : Not Supported.
Solution : Integrate with external services like sphinx, elastic
search, Apache solr etc.

Case Study

Mydbops Empowers
Yulu's Urban Mobility with Scalable TiDB

Yulu's Challenges
Yulu's data size exceeded 18
TB, causing storage issues and
high costs.
Unmanageable
Data Growth
MySQL writes were
bottlenecked, impacting
application performance.
Performance
Bottlenecks
Large dataset size led
to slow DDL
operations.
Slow DDL
Operations

Single MySQL master resulted in
downtime during maintenance.
Limited Availability
Vertical scaling with cloud instances
increased database costs
Costly
Scaling
Yulu's Challenges

•Horizontal scaling for growing datasets
without performance impact.
•Automatic data sharding for efficient
workload distribution.
Scalability
How TiDB Benefits Yulu
•Distributed architecture for high
performance and low latency.
•Optimized storage engine for efficient
write handling.
Performance
•Resource efficiency reduces the need for
expensive hardware upgrades.
•Data compression from 18TB to 3.4TB for
significant storage cost savings.
Cost-Effectiveness
•High availability with automatic failover
ensures continuous operation.
•Strong data consistency guarantees data
accuracy and integrity.
Reliability

Percentage Reduction in
Storage Size - 72%
Benefits

Deployment and
configuration of TiDB
based on workload
requirements.
TiDB Services Offered By Mydbops
Data migration
assessments to ensure
seamless transition to
TiDB.
Live data
synchronization from
MySQL to TiDB for
continuous operations.
Best practices guidance
to optimize TiDB
performance and
efficiency.

Any Questions?

Consulting
Services
Consulting
Services
Connect with us !
[email protected] +91-9962288131 www.mydbops.com

Thank You