tidb 版本升级后性能下降

【TiDB 使用环境】测试环境
【TiDB 版本】
7.5.3/8.5.6
【部署方式】
容器化部署,单机部署tiddb pd kv,tidb 官方镜像组件
【操作系统/CPU 架构/芯片详情】
pve 虚拟机 16c 32g almalinux

8.5.6 两种配置
store-io-pool-size = 1
batch-compression-threshold = “4KiB” (8x默认配置)

store-io-pool-size = 0
batch-compression-threshold = “8KiB” (手动配置7x相同配置)

【问题复现路径】
使用sysbench 进行压测 测试数据规模为 16 张表,每张表 100 万行;每项测试执行 3 轮,并记录 QPS/TPS、P95 延迟
结果如下

测试项 TiDB 7.5.3 调整后 TiDB 8.5.6 变化
只读 QPS 11,971.46 10,761.82 -10.10%
等值查询 QPS 17,736.36 14,618.86 -17.57%
带索引更新 TPS 3,275.79 2,958.41 -9.69%
不带索引更新 TPS 5,204.07 5,070.71 -2.56%
插入 TPS 3,854.85 3,629.99 -5.83%
删除 TPS 3,408.10 3,238.51 -4.98%
测试项 7.5.3 调整后 8.5.6 变化
只读 117.82ms 124.86ms +5.98%
等值查询 7.17ms 8.08ms +12.69%
带索引更新 29.23ms 32.15ms +10.00%
不带索引更新 18.39ms 18.39ms 基本持平
插入 23.81ms 26.20ms +10.04%
删除 29.02ms 30.08ms +3.65%

为什么看changelog 里都是性能优化,但是实际7.5.3 升级到8.5.6,在配置不变的情况下
性能反而下降了?

附上tikv 配置

# TiKV config template
#  Human-readable big numbers:
#   File size(based on byte): KB, MB, GB, TB, PB
#    e.g.: 1_048_576 = "1MB"
#   Time(based on ms): ms, s, m, h
#    e.g.: 78_000 = "1.3m"

log-level = "info"
log-rotation-size = "30MB"
log-rotation-timespan = "1h"
memory_usage_limit = "4207MB"

[readpool]

[readpool.coprocessor]
high-concurrency = 64
low-concurrency = 64
normal-concurrency = 32
use-unified-pool = true

[readpool.storage]
normal-concurrency = 10
use-unified-pool = true

[readpool.unified]
auto-adjust-pool-size = true

[pessimistic-txn]
enabled = true
pipelined = true


[server]
grpc-concurrency = 16
grpc-raft-conn-num = 16

[storage]

[storage.block-cache]
capacity = "3183MB"
shared = true

[pd]
# This section will be overwritten by command line parameters

[metric]

[raftstore]
apply-max-batch-size = 1024
raftdb-path = ""
store-max-batch-size = 1024
store-io-pool-size = 0

[raft-engine]
batch-compression-threshold = "8KiB"

[coprocessor]

[rocksdb]
max-background-flushes = 4
max-background-jobs = 16
use-direct-io-for-flush-and-compaction = true
wal-bytes-per-sync = 128

[rocksdb.defaultcf]
compression-per-level = ["lz4", "lz4", "lz4", "lz4", "zstd", "zstd", "zstd"]
level0-slowdown-writes-trigger = 64
level0-stop-writes-trigger = 64

[rocksdb.lockcf]
level0-slowdown-writes-trigger = 64
level0-stop-writes-trigger = 64

[rocksdb.writecf]
compression-per-level = ["lz4", "lz4", "lz4", "lz4", "zstd", "zstd", "zstd"]
level0-slowdown-writes-trigger = 64
level0-stop-writes-trigger = 64

[raftdb]
use-direct-io-for-flush-and-compaction = true

[raftdb.defaultcf]
compression-per-level = ["lz4", "lz4", "lz4", "lz4", "zstd", "zstd", "zstd"]

[security]

先对照8.5的release note,默认参数跟7.5差挺多

跑压力的时候看下监控对比下

先看下监控有没有明显瓶颈。或者使用 Loop 让他帮你初步分析下问题在哪

单机 16c 塞了仨组件,8.5 的后台线程和默认资源管控都比 7.5 吃资源,核不够用是主因。先对比 Grafana TiKV 的 Thread CPU,看 grpc、scheduler、rocksdb 各占多少,多半是 compaction 在抢。再查 resource control 是不是开着,sysbench 落 default group 会被 RU 限住。block-cache 显式设死,别让它按内存比例自己算。