sysbench版本信息:
$ sysbench --version
sysbench 1.0.9
CPU相关信息
# 总核数 = 物理CPU个数 X 每颗物理CPU的核数
# 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
# 查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
# 查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l
# 查看CPU信息(型号)
cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
一般来说,物理CPU个数×每颗核数就应该等于逻辑CPU的个数,如果不相等的话,则表示服务器的CPU支持超线程技术
查看存储相关信息
# lsblk -d -o name,rota
NAME ROTA
sda 1
sr0 1
nvme0n1 0
nvme1n1 0
rota值如果返回1则表示磁盘可旋转,那么就是HDD了;反之,如果返回0,则表示磁盘不可以旋转,那么就有可能是SSD了
查看具体磁盘的大小
# df -h|grep nvme
/dev/nvme0n1 3.6T 11G 3.4T 1% /data
/dev/nvme1n1 3.6T 11G 3.4T 1% /data2
查看内存相关信息
# free -m
total used free shared buff/cache available
Mem: 193163 7369 154988 474 30805 184382
Swap: 0 0 0
Total表示物理机器内存总大小
网卡相关信息
命令格式: ethtool 网络接口名
# ethtool em1
Settings for em1:
Supported ports: [ FIBRE ]
Supported link modes: 1000baseT/Full
10000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: Not reported
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 10000Mb/s
Duplex: Full
Port: FIBRE
PHYAD: 1
Transceiver: internal
Auto-negotiation: off
Supports Wake-on: g
Wake-on: d
Current message level: 0x00000000 (0)
Link detected: yes
Speed: 10000Mb/s 指表示万兆网卡
TiDB集群机器CPU相关信息(CPU配置一样)
# cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
2
# cat /proc/cpuinfo |grep "cores"|uniq
cpu cores : 10
# cat /proc/cpuinfo |grep "processor"|wc -l
40
# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
40 Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz
服务器的CPU支持超线程技术
TiDB集群机器相关信息
| OS Version | CPU | Memory | Storage | Network |
|---|---|---|---|---|
| CentOS Linux release 7.5.1804 (Core) | 40C | 194G | 4T NVME SSD | 万兆网卡 |
TiDB集群部署方案以及配置参数
| Package | hostname | note |
|---|---|---|
| pd | ip-172-16-30-86、ip-172-16-30-87、ip-172-16-30-88 | |
| tidb | ip-172-16-30-86、ip-172-16-30-89 | |
| tikv | ip-172-16-30-87、ip-172-16-30-88、ip-172-16-30-89 | 每个 tikv 主机双实例 |
// TiDB 部署方案
172-16-30-86 1*tidb 1*pd 1*sysbench 1*haproxy
172-16-30-89 1*tidb 2*tikv 1*sysbench
// 每个物理节点只规划deploy_dir同一个目录,都只有一块盘:
data:NVME SSD (pd、tikv、tidb)
// TiKV 参数配置以及说明
# true (default value) for high reliability, this can prevent data loss when power failure.
sync-log = true
# size of thread pool for grpc server
grpc-concurrency = 4
# The number of connections with each tikv server to send raft messages.
grpc-raft-conn-num = 24
# block-cache used to cache uncompressed blocks, big block-cache can speed up read.in
# normal cases should tune to 30%-50% system's total memory.
[defaultcf]
block-cache-size = "5GB"
# in normal cases should tune to 10%-30% system's total memory.
[writecf]
block-cache-size: "8000MB"
# should tune to 256MB~2GB.
[raftdb.defaultcf]
block-cache-size: "256MB"
# set store capacity, if no set, use disk capacity.
capacity: 0
readpool:
storage:
# size of thread pool for high-priority read operations
# high-concurrency: 4
# size of thread pool for normal-priority read operations
# normal-concurrency: 4
# size of thread pool for low-priority read operations
# low-concurrency: 4
coprocessor:
# Notice: if CPU_NUM > 8, default thread pool size for coprocessors
# will be set to CPU_NUM * 0.8.
high-concurrency: 4
normal-concurrency: 4
low-concurrency: 4
sysbench压测结果参数解析
测试结果分析:
SQL statistics:
##queries performed: #性能统计
read:1994860 #总 select 数量
write: 0 #总update、insert、delete语句数量
other: 284980 #commit、unlock tables以及其他mutex的数量
total: 2279840 #总的执行语句数
transactions:142490 (1186.20 per sec.) #总的事物数(每秒处理事物数)|通常需要关注的数字(TPS)
queries: 2279840 (18979.13 per sec.) #读写请求次数(每秒的读写次数)|通常需要关注的数字(QPS)
other operations: 9375 (156.13 per sec.)#其它操作的每秒执行数
ignored errors:0(0.00 per sec.) #忽略的错误数
reconnects:0(0.00 per sec.)
##General statistics:
total time:120.1216s #即time指定的压测总时间
total number of events:142490 #总的事件数,一般与transactions相同
total time taken by event execution: 600.0783s #所有事务耗时相加(不考虑并行因素)
##response time: //应答时间
min:8.52
avg:107.84
max:480.08
95th percentile:170.48 #95%的语句的平均响应时间
sum:15365843.76
##Threads fairness:
events (avg/stddev): 1113.2031/14.76
execution time (avg/stddev): 120.0457/0.04
我们一般关注的指标主要有:
response time avg: 平均响应时间。(后面的95%的大小可以通过–percentile=98的方式去更改)
transactions: 精确的说是这一项后面的TPS 。但如果使用了-skip-trx=on,这项事务数恒为0,需要用total number of events 去除以总时间,得到tps(其实还可以分为读tps和写tps)
queries: 用它除以总时间,得到吞吐量QPS
版权声明:本文为博主原创文章,未经博主允许不得转载。
- 上一篇:TiDB HAProxy负载均衡
- 下一篇:TiDB 导出用户信息



