课程名称:课程版本(101)+ 1.6 TiDB 的读写流程 & 1.7 TiDB 典型应用场景及用户案例
学习时长:
2小时
课程收获:
TiDB 的读写流程
TiDB 典型应用场景及用户案例
课程内容:
[TOC]
Before we begin
- Context
- Goal
- Have a certain understanding of TiDB’s overall architecture
- Understand TiDB’s general processing flow for read and write requests
- Outline
- Introduction of TiDB Platform
- Read Request in TiDB
- Write Request in TiDB
Introduction of TiDB Platform
TiDB Overview
Intorduction of TiDB
Subtopic: TiKV
- Introduction of TiKV
- Distributed Key-Value storage engine
- Snapshot isolation
- Raft protocol
- Not dependent on distributed file system
Subtopic: PD
Read Request in TiDB
SQL Processing Flow
Read request in TiDB
- The client establish connections to TiDB and send a request to TiDB
- TiDB gets SQL from the request
- TiDB parses and compiles the SQL, make and optimize the query plan
- TiDB gets start_ts from PD
- TiDB gets the metadata of table and transfers the query plan to series of executor
- TiDB sends the coprocessor request to TiKV through gRPC
- TiKV receives the request,searches for the data,and sends the result to TiDB
- TiDB receives all the data from TiKV and handles the result
- TiDB sends the result to the client
Write request in TiDB
- The client establish connection to TiDB and send a request to TiDB
- TiDB gets SQL from the request
- TiDB parses and compiles the SQL, make and optimize the query plan
- TiDB gets start_ts from PD
- TiDB gets the metadata of table and transfers the query plan to series of executor
- TiDB make a commit request
- TiKV commit the data using two-phase commit(prewrite/commit) according to the percolator,TiDB will gets commit_ts at commit phase(2PC)
- TiKV send the result to TiDB
- TiDB send the result to client
[TOC]
TiDB feature overview
- Scalcbility
- High Availability
- Distributed Transaction
- Read-time HTAP
- …
Suitable case for TiDB
海量数据、高并发场景
- Scalability & Distributed Transaction
- very large data,such as billions of records
- high concurrency applications
- MySQL protocol applications
- elastic calcuation or storage request
高可用
- HA
- Important business cases
- Multi-active architecture cases
实时 HTAP
- Real-time HTAP
- HTAP cases
- use TiSpark in BI cases
- use TiFlash in AP cases
Use cases introduction
知乎
- The largest production TiDB cluster,more than 250 TiKV nodes & 20 TiDB nodes
- About 2 trillion rows of data which stores posts users have already read
- 100 billion rows of data accruing each month and growing
- Milliseconds of response time
北京银行
- Multi-active,geo-distributed architecture with three data centers in two cities
- Payment businesss
- Running stable in product environment for 2 years
- Scale out and scale in,upgrade online
- Withstand hardware damage and network failure for several times
PayPay
- The largest mobile payment company in Japan
- Payment business in TiDB,which was run in Aurora before
- About 100 TB data
中通快递
- Use TiDB for express query in all branches
- Use TiSpark for buesiness
- Scale out before double eleven (Chinese Black Friday) and scale in afer double eleven
Quiz
- Could we use TiDB for BI business?
可以的
- Is there any TiDB case running in the Bank’s important business?
有的