[ 60s ] thds: 4 tps: 331.99 qps: 6640.98 (r/w/o: 4648.78/1328.16/664.04) lat (ms,95%): 33.72 err/s: 0.00 reconn/s: 0.00代表什么
时间: 2024-01-22 19:04:25 浏览: 27
这是一个针对MySQL数据库的性能指标输出,具体解释如下:
- `thds: 4`:当前MySQL服务器的线程数为4个。
- `tps: 331.99`:每秒钟处理的事务数为331.99个。这里的事务是指对数据库的读写操作。
- `qps: 6640.98`:每秒钟处理的查询数为6640.98个。
- `(r/w/o: 4648.78/1328.16/664.04)`:每秒钟读取、写入和其它操作的次数分别为4648.78、1328.16和664.04。
- `lat (ms,95%): 33.72`:95%的查询响应时间在33.72毫秒以内。
- `err/s: 0.00`:每秒钟出现的语法错误和其他错误数为0个。
- `reconn/s: 0.00`:每秒钟重新连接到MySQL服务器的次数为0次。
这些指标可以帮助性能工程师和开发人员评估MySQL服务器的性能和稳定性,以及诊断潜在的问题。例如,如果`tps`和`qps`很高,而`lat`也很高,说明MySQL服务器的处理能力正在接近极限,可能需要优化查询语句或增加服务器硬件资源来提高性能。
相关问题
在ubuntu20.04.6下,使用 sysbench 跑 tpcc 测试,500仓,记录测试结果 tpmC
好的,可以使用以下命令在 Ubuntu 20.04.6 下安装 sysbench:
```
sudo apt-get install sysbench
```
然后,使用以下命令运行 tpcc 测试:
```
sysbench --db-driver=mysql --mysql-host=<MySQL主机地址> --mysql-port=<MySQL端口> --mysql-user=<MySQL用户名> --mysql-password=<MySQL密码> --mysql-db=<MySQL数据库名> --table-size=100000 --tables=10 --threads=64 --time=600 --report-interval=10 /usr/share/sysbench/tpcc.lua run
```
其中,`<MySQL主机地址>`、`<MySQL端口>`、`<MySQL用户名>`、`<MySQL密码>`、`<MySQL数据库名>`需要替换为你的 MySQL 数据库相关信息,`--table-size` 参数指定每张表的数据行数,`--tables` 参数指定表的数量,`--threads` 参数指定并发线程数,`--time` 参数指定测试运行时间,`--report-interval` 参数指定测试结果输出间隔。
测试完成后,会输出类似以下的结果:
```
[ 10s ] thds: 64 tps: 393.72 qps: 6299.07 (r/w/o: 4486.39/1121.56/691.12) lat (ms,95%): 40.88 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 64 tps: 399.77 qps: 6396.33 (r/w/o: 4562.42/1140.12/693.80) lat (ms,95%): 40.56 err/s: 0.00 reconn/s: 0.00
...
[ 590s ] thds: 64 tps: 393.50 qps: 6292.06 (r/w/o: 4483.39/1120.56/688.11) lat (ms,95%): 41.96 err/s: 0.00 reconn/s: 0.00
[ 600s ] thds: 64 tps: 394.59 qps: 6309.39 (r/w/o: 4498.49/1121.56/689.34) lat (ms,95%): 42.24 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read: 905259
write: 226310
other: 138810
total: 1275379
transactions: 70395 (117.32 per sec.)
queries: 1275379 (2125.62 per sec.)
ignored errors: 0 (0.00 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 600.0013s
total number of events: 70395
Latency (ms):
min: 26.75
avg: 54.20
max: 1609.28
95th percentile: 98.12
sum: 3812399.19
Threads fairness:
events (avg/stddev): 1099.9219/10.29
execution time (avg/stddev): 5.9556/0.00
```
其中,`tps` 表示每秒事务数,`qps` 表示每秒查询数,可以根据这两个指标计算出 tpmC(每分钟完成的交易数)。
例如,如果 `tps` 为 393.50,那么每分钟完成的交易数为 `393.50 * 60 = 23610`,即 tpmC 为 23610。
在Ubuntu20.04如何使用sysbench对mysql进行压测,记录TPMC值
首先需要安装sysbench和mysql客户端:
```
sudo apt-get update
sudo apt-get install sysbench mysql-client-core-8.0
```
然后创建一个测试数据库:
```
mysql -u root -p
CREATE DATABASE test;
```
接着创建一个测试表:
```
USE test;
CREATE TABLE sbtest (id INT PRIMARY KEY, k INT, c CHAR(120), pad CHAR(60));
```
运行sysbench进行压测:
```
sysbench oltp_read_write --db-driver=mysql --mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root --mysql-password=password --mysql-db=test --table-size=1000000 --threads=64 --time=300 --report-interval=10 --max-requests=0 run
```
其中,--threads表示并发线程数,--time表示测试时间,--report-interval表示测试结果输出间隔,--max-requests表示最大请求数。运行结束后,会输出TPS和QPS值。
例如:
```
[ 10s ] thds: 64 tps: 3248.28 qps: 51988.22 (r/w/o: 36390.75/12987.02/25910.44) lat (ms,95%): 16.65 err/s: 0.00 reconn/s: 0.00
```