High-Performance-TiDB-Lesson-3

环境准备

由于机器资源限制,在个人笔记本进行测试,笔记本配置为MacBook Pro(2015,4c16g)下,cpu:2.2 GHz 四核Intel Core i7,内存:16 GB 1600 MHz DDR3

使用go-tpc测试

安装go-tpc
1
2
3
git clone https://github.com/pingcap/go-tpc.git
cd go-tpc
make build
准备数据
1
2
3
4
mysql -u root -h 192.168.199.226 -P 3306 -u root
create database tpcc
cd go-tpcc/bin
./go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 prepare -T 8

image-20200831230137988.png

Profile TiDB

测试数据
1
2
## threads=16
./go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 run --time=1m --threads=16
生成Profile文件
1
2
3
4
5
6
7
mkdir profiles
curl http://192.168.199.227:10080/debug/zip?seconds=80 --output tidb-227-debug.zip
/go-tpc/bin/go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 run --time=1m --threads=16
curl http://192.168.199.228:10080/debug/zip?seconds=80 --output tidb-228-debug.zip
/go-tpc/bin/go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 run --time=1m --threads=16
curl http://192.168.199.229:10080/debug/zip?seconds=80 --output tidb-229-debug.zip
/go-tpc/bin/go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 run --time=1m --threads=16

image-20200831231720908.png

image-20200831231758463.png

image-20200831232117594.png

image-20200831232246294.png

1
2
3
4
5
6
7
8
## 下载zip文件到主机,安装graphviz,解压zip,打开profile文件
scp tidb@192.168.199.226:/home/tidb/profile/tidb-227-debug.zip .
scp tidb@192.168.199.226:/home/tidb/profile/tidb-228-debug.zip .
scp tidb@192.168.199.226:/home/tidb/profile/tidb-229-debug.zip .
brew install graphviz
go tool pprof -http=:8080 profile
go tool pprof -http=:8080 heap
go tool pprof -http=:8080 mutex

image-20200901112929026.png

192.168.199.227 Profile Flame Graph

image-20200901143624421.png

image-20200901113102712.png

image-20200901113247030

image-20200901143900081.png

问题分析

Profile TiKV

测试数据
1
2
## threads=16
./go-tpc tpcc -H 192.168.199.226 -P 3306 -D tpcc --warehouses 8 run --time=1m --threads=16
使用dashboard查看TiKV火焰图

image-20200831233712358.png

image-20200831233945410.png

image-20200901221848014.png

问题分析

last update time 2020-09-01