天天看點

TiDB v4.0.12 VS v5.0.0 insert 性能對比

作者:navyaijm2017​

環境說明

叢集拓撲

  • V4.0.12的部署拓撲\

    TiDB v4.0.12 VS v5.0.0 insert 性能對比
  • v5.0.0的部署拓撲\

    TiDB v4.0.12 VS v5.0.0 insert 性能對比

配置檔案

在相同的伺服器上部署V4.0.12和V5.0.0兩個版本的叢集,部署參數兩個叢集都相同,下面參數做了調整:

server_configs:
  tidb:
    log.slow-threshold: 2000
    binlog.enable: false
    binlog.ignore-error: false
  tikv:
    storage.block-cache.capacity: "2GB"
    readpool.storage.use-unified-pool: false
    readpool.coprocessor.use-unified-pool: true
  pd:
    schedule.leader-schedule-limit: 4
    schedule.region-schedule-limit: 2048
    schedule.replica-schedule-limit: 64      

壓測

我們這邊目前線上4.0的叢集有個場景隻是單純的insert,是以我這邊先隻測下insert場景,看看5.0的異步送出能給insert場景加速多少。

使用sysbench 初始化100萬資料,對比哪個叢集寫入的快

  • sysbench配置如下:
mysql-host=xx.xx.184.43
mysql-port=4005 #5.0.0叢集
mysql-port=4000 #4.0.12叢集
mysql-user=root
mysql-password=xxx
mysql-db=sbtest
time=1200
threads=64
report-interval=10
db-driver=mysql      
  • 壓測指令
time sysbench oltp_common --config-file=config_4  --table-size=1000000 prepare
time sysbench oltp_common --config-file=config_5  --table-size=1000000 prepare      
  • 壓測說明

    因為兩個叢集是部署在相同的伺服器上,為了沒有叢集間互相影響,壓測是竄行的,即當4.0的壓測結束才會進行5.0的壓測

  • 壓測結果
版本 壓測資料量 結果 參數 輪數
V4.0.12 100w 0m52.055s tidb_dml_batch_size=20000 第一輪
V5.0.0 100w 1m8.385s 異步送出開啟,tidb_dml_batch_size=0 第一輪
V4.0.12 100w 0m52.917s tidb_dml_batch_size=20000 第二輪
V5.0.0 100w 1m7.428s 異步送出開啟,tidb_dml_batch_size=20000 第二輪
V5.0.0 100w 1m5.904s 異步送出關閉,tidb_dml_batch_size=20000 第二輪
V4.0.12 1000w 8m55.257s tidb_dml_batch_size=20000 第三輪
V5.0.0 1000w
  • 結論

    從壓測結果看無論是5.0開啟異步送出還是關閉異步送出,還有開啟批量送出,insert的性能都沒有4.0的好,感覺這個不是預期内的