TiDB on Kubernetes
Huang Dongxu
CTO, PingCAP
About Me
● Huang Dongxu (黄东旭)
● CTO, Co-founder of PingCAP
● Infrastructure Engineer / Open-source advocator
● Co-author of Codis / TiDB / TiKV
● MSRA => Netease => WandouLabs => PingCAP
● h@pingcap.com
Agenda
● TiDB introduction
○ TiDB architecture
○ TiDB ecosystem
● Why combine TiDB & Kubernetes
○ Cloud vendor agnostic
○ Automation
● How we make it possible
○ TiDB Operator architecture & features
○ How we manage state
○ How we schedule stateful app
Part I - Intro to TiDB
Why we want to build a NewSQL Database
From the beginning
●
● What’s wrong with the existing DBs?
RDBMS
○
○ NoSQL & Middleware
● NewSQL: F1 & Spanner
RDBMS
NoSQL
NewSQL
1970s
2010
2015
Present
MySQL
PostgreSQL
Oracle
DB2...
Redis
HBase
Cassandra
MongoDB
Google
Spanner
Google F1
TiDB
PingCAP.com
TiDB architecture
TSO/Data location
DistSQL API
TiDB
TiDB
TiDB
TiDB
TiDB
...
PD
PD
PD
PD Cluster
Metadata
TiKV
TiKV
TiKV
TiKV
TiKV
TiKV
...
TiDB Cluster
TiKV Cluster (Storage)
Data location
DistSQL API
Spark
Driver
Job
Worker
Worker
Worker
...
Spark Cluster
TiSpark
MySQL Clients
Syncer
TiDB: Computing
●
Stateless SQL layer
○
○
Client can connect to any
existing tidb-server instance
TiDB *will not* re-shuffle the
data across different
tidb-servers
●
Full-featured SQL Layer
○
Speak MySQL wire protocol
■ Why not reusing MySQL?
○ Homemade parser & lexer
○
○
○ DML & DDL
RBO & CBO
Secondary index support
SQL
AST
Logical
Plan
Optimized
Logical Plan
Statistics
Cost Model
tidb-server
Selected
Physical Plan
TiKV
TiKV
TiKV
TiKV
TiKV
TiKV
TiKV Cluster