使用 TiUP bench 组件压测 TiDB

    1. Benchmark database with different workloads
    2. Usage:
    3. tiup bench [command]
    4. Available Commands:
    5. help 帮助信息
    6. tpcc TPC-C 作为 workload 压测
    7. tpch TPC-H 作为 workload 压测
    8. Flags:
    9. --count int 总执行次数, 0 表示无限次
    10. -D, --db string 被压测数据库名称 (默认为 "test")
    11. -d, --driver string 数据库驱动: mysql
    12. --dropdata prepare 之前清除历史数据
    13. -h, --help bench 命令自身的帮助信息
    14. -H, --host string 数据库的主机地址 (默认 "127.0.0.1")
    15. --isolation int 隔离级别 0: Default, 1: ReadUncommitted,
    16. 2: ReadCommitted, 3: WriteCommitted, 4: RepeatableRead,
    17. 5: Snapshot, 6: Serializable, 7: Linerizable
    18. --max-procs int runtime.GOMAXPROCS
    19. -p, --password string 数据库密码
    20. -P, --port int 数据库端口 (默认 4000)
    21. --pprof string pprof 地址
    22. --silence 压测过程中不打印错误信息
    23. --summary 只打印 Summary
    24. -T, --threads int 压测并发线程数 (默认 16)
    25. --time duration 总执行时长 (默认 2562047h47m16.854775807s)
    26. -U, --user string 压测时使用的数据库用户 (默认 "root")

    下文分别介绍如何使用 TiUP 运行 TPC-C 测试和 TPC-H 测试。

    TiUP bench 组件支持如下运行 TPC-C 测试的命令和参数:

    1. Available Commands:
    2. check 检查数据一致性
    3. cleanup 清除数据
    4. prepare 准备数据
    5. Flags:
    6. --check-all 运行所有的一致性检测
    7. -h, --help tpcc 的帮助信息
    8. --output string 准备数据时生成 csv 文件的目录
    9. --parts int 分区仓库 的数量(默认 1)
    10. --warehouses int 仓库的数量 (默认 10)
    1. 通过 HASH 使用 4 个分区创建 4 个仓库:

      1. tiup bench tpcc --warehouses 4 --parts 4 prepare
    2. 运行 TPC-C 测试:

      1. tiup bench tpcc --warehouses 4 run
    3. 检查一致性:

      1. tiup bench tpcc --warehouses 4 check
    4. 生成 CSV 文件:

      1. tiup bench tpcc --warehouses 4 prepare --output data
    5. 为指定的表生成 CSV 文件:

      1. tiup bench tpcc --warehouses 4 prepare --output data --tables history,orders
    6. 开启 pprof:

      1. tiup bench tpcc --warehouses 4 prepare --output data --pprof :10111
    1. 准备数据:

      1. tiup bench tpch --sf=1 prepare
    2. 运行 TPC-H 测试,根据是否检查结果执行相应命令:

      • 检查结果:

        1. tiup bench tpch --sf=1 --check=true run
      • 不检查结果:

        1. tiup bench tpch --sf=1 run