sysbench mysql图表_sysbench_mysql

article/2025/9/27 13:32:04

ref

测试

当执行下面这个sysbench测试mysql的时候,你不知道的可能可能是:

这到底是在测试读写?还是 读? 答: 只读

--num-threads=12 啥意思? 答:就是说有12个线程在同时链接

你可以看到:这是在创建 表

Creating table 'sbtest1'...

Inserting 500000 records into 'sbtest1'

Creating table 'sbtest2'...

Inserting 500000 records into 'sbtest2'

Creating table 'sbtest3'...

..

..

..

而接下来,才是你测试的过程,你设置--max-time=120 就是说测试120s

sysbench --test=/tmp/sysbench/sysbench-0.4.12-1.1/sysbench/tests/db/oltp.lua \

--mysql-host=127.0.0.1 --mysql-port=3306 --mysql-user=root \

--mysql-db=sbtest --oltp-tables-count=10 --oltp-table-size=500000 \

--report-interval=10 --oltp-dist-type=uniform --rand-init=on --max-requests=0 \

--oltp-read-only=on --oltp-skip-trx=on \

--max-time=120 --num-threads=12 prepare

[root@jiangyi01.sqa.zmf /home/ahao.mah/ALIOS_QA/tools]

#sh sysbench/sysbench_mysql.sh -d

mysql -h127.0.0.1 -P3306 -uroot

create database sbtest

sysbench 0.5: multi-threaded system evaluation benchmark

Creating table 'sbtest1'...

Inserting 500000 records into 'sbtest1'

Creating table 'sbtest2'...

Inserting 500000 records into 'sbtest2'

Creating table 'sbtest3'...

Inserting 500000 records into 'sbtest3'

Creating table 'sbtest4'...

Inserting 500000 records into 'sbtest4'

Creating table 'sbtest5'...

Inserting 500000 records into 'sbtest5'

Creating table 'sbtest6'...

Inserting 500000 records into 'sbtest6'

Creating table 'sbtest7'...

Inserting 500000 records into 'sbtest7'

Creating table 'sbtest8'...

Inserting 500000 records into 'sbtest8'

Creating table 'sbtest9'...

Inserting 500000 records into 'sbtest9'

Creating table 'sbtest10'...

Inserting 500000 records into 'sbtest10'

sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 12

Report intermediate results every 10 second(s)

Initializing random number generator from timer.

Random number generator seed is 0 and will be ignored

Threads started!

[ 10s] threads: 12, tps: 0.00, reads/s: 50022.15, writes/s: 0.00, response time: 3.90ms (95%)

[ 20s] threads: 12, tps: 0.00, reads/s: 54988.13, writes/s: 0.00, response time: 3.74ms (95%)

[ 30s] threads: 12, tps: 0.00, reads/s: 54559.99, writes/s: 0.00, response time: 3.79ms (95%)

[ 40s] threads: 12, tps: 0.00, reads/s: 55341.59, writes/s: 0.00, response time: 3.65ms (95%)

[ 50s] threads: 12, tps: 0.00, reads/s: 55481.02, writes/s: 0.00, response time: 3.65ms (95%)

[ 60s] threads: 12, tps: 0.00, reads/s: 55929.09, writes/s: 0.00, response time: 3.56ms (95%)

[ 70s] threads: 12, tps: 0.00, reads/s: 55855.21, writes/s: 0.00, response time: 3.63ms (95%)

[ 80s] threads: 12, tps: 0.00, reads/s: 55590.89, writes/s: 0.00, response time: 3.62ms (95%)

[ 90s] threads: 12, tps: 0.00, reads/s: 55348.11, writes/s: 0.00, response time: 3.68ms (95%)

[ 100s] threads: 12, tps: 0.00, reads/s: 55783.70, writes/s: 0.00, response time: 3.62ms (95%)

[ 110s] threads: 12, tps: 0.00, reads/s: 55622.30, writes/s: 0.00, response time: 3.66ms (95%)

[ 120s] threads: 12, tps: 0.00, reads/s: 55634.92, writes/s: 0.00, response time: 3.64ms (95%)

OLTP test statistics:

queries performed:

read: 6601616

write: 0

other: 0

total: 6601616

transactions: 0 (0.00 per sec.)

deadlocks: 0 (0.00 per sec.)

read/write requests: 6601616 (55012.22 per sec.)

other operations: 0 (0.00 per sec.)

General statistics:

total time: 120.0027s

total number of events: 471544

total time taken by event execution: 1439.0586s

response time:

min: 2.20ms

avg: 3.05ms

max: 260.74ms

approx. 95 percentile: 3.69ms

Threads fairness:

events (avg/stddev): 39295.3333/1154.93

execution time (avg/stddev): 119.9215/0.00

[root@jiangyi01.sqa.zmf /home/ahao.mah]

#top -Hp 3997

6d22ed1979c6d441a6d8b34d6e5815e9.png

混合读写

读写测试还是用oltp.lua,只需把--oltp-read-only等于off。

只更新

如果基准测试的时候,你只想比较两个项目的update(或insert)效率,那可以不使用oltp脚本,而直接改用update_index.lua:

./bin/sysbench --test=./share/tests/db/update_index.lua \

--mysql-host=10.0.201.36 --mysql-port=8066 --mysql-user=ecuser --mysql-password=ecuser \

--mysql-db=dbtest1a --oltp-tables-count=10 --oltp-table-size=500000 \

--report-interval=10 --rand-init=on --max-requests=0 \

--oltp-read-only=off --max-time=120 --num-threads=128 \

[ prepare | run | cleanup ]

此时像oltp-read-only=off许多参数都失效了。需要说明的是这里 (非)索引更新,不是where条件根据索引去查找更新,而是更新索引列上的值。

结果解读

sysbench 0.5: multi-threaded system evaluation benchmark

Running the test with following options:

Number of threads: 128

Report intermediate results every 20 second(s)

Initializing random number generator from timer.

Random number generator seed is 0 and will be ignored

Initializing worker threads...

Threads started!

[ 20s] threads: 128, tps: 2354.54, reads: 33035.89, writes: 9423.39, response time: 66.80ms (95%), errors: 0.00, reconnects: 0.00

[ 40s] threads: 128, tps: 2377.75, reads: 33274.26, writes: 9507.55, response time: 66.88ms (95%), errors: 0.00, reconnects: 0.00

[ 60s] threads: 128, tps: 2401.35, reads: 33615.30, writes: 9607.40, response time: 66.40ms (95%), errors: 0.00, reconnects: 0.00

[ 80s] threads: 128, tps: 2381.20, reads: 33331.50, writes: 9522.55, response time: 67.30ms (95%), errors: 0.00, reconnects: 0.00

[ 100s] threads: 128, tps: 2388.85, reads: 33446.10, writes: 9556.35, response time: 67.00ms (95%), errors: 0.00, reconnects: 0.00

[ 120s] threads: 128, tps: 2386.40, reads: 33421.35, writes: 9545.35, response time: 66.94ms (95%), errors: 0.00, reconnects: 0.00

OLTP test statistics:

queries performed:

read: 4003048 //总select数量

write: 1143728 //总update、insert、delete语句数量

other: 571864 //commit、unlock tables以及其他mutex的数量

total: 5718640

transactions: 285932 (2382.10 per sec.) //通常需要关注的数字(TPS)

read/write requests: 5146776 (42877.85 per sec.)

other operations: 571864 (4764.21 per sec.)

ignored errors: 0 (0.00 per sec.) //忽略的错误数

reconnects: 0 (0.00 per sec.)

General statistics:

total time: 120.0334s //即max-time指定的压测实际

total number of events: 285932 //总的事件数,一般与transactions相同

total time taken by event execution: 15362.6623s

response time:

min: 17.60ms

avg: 53.73ms //95%的语句的平均响应时间

max: 252.90ms

approx. 95 percentile: 66.88ms

Threads fairness:

events (avg/stddev): 2233.8438/9.04

execution time (avg/stddev): 120.0208/0.01

我们一般关注的用于绘图的指标主要有:

response time avg: 平均响应时间。(后面的95%的大小可以通过--percentile=98的方式去更改)

transactions: 精确的说是这一项后面的TPS 。但如果使用了-oltp-skip-trx=on,这项事务数恒为0,需要用total number of events 去除以总时间,得到tps(其实还可以分为读tps和写tps)

read/write requests: 用它除以总时间,得到吞吐量QPS

当然还有一些系统层面的cpu,io,mem相关指标

sysbench还可以对文件系统IO测试,CPU性能测试,以及内存分配与传输速度测试,这里就不介绍了。

总结起来sysbench的缺点就是,模拟的表结构太简单,不像tpcc-mysql那样完整的事务系统。但对于性能压测对比还是很有用的,因为sysbench使用的环境参数限制是一样的。


http://chatgpt.dhexx.cn/article/ulilLmaC.shtml

相关文章

性能测试之sysbench

本期是写的测试mysql的性能测试,本人也是第一次接触mysql的性能,拿到这个任务时也是多方1查询资料, sysbench压力测试工具简介: sysbench是一个开源的、模块化的、跨平台的多线程性能测试工具,可以用来进行CPU、内存…

sysbench数据库压测工具详解与实战

sysbench是一个基于LuaJIT脚本的多线程基准测试工具。2004年由Peter Zaitsev(Percona公司创始人)开发,在其0.5版本中可以使用Lua脚本实现OLTP测试。2016年重构了sysbench代码,并在2017年2月针对新的硬件环境发布了1.0版本&#xf…

sysbench 介绍

sysbench介绍 参考博客: sysbench - 老僧观天下 - 博客园 sysbench 压测 详解_俗人linux_51CTO博客 sysbench工具使用 - ZhenXing_Yu - 博客园 |QQ:327488733qq.com sysbench使用指南 - AhaoMu - 博客园 MySql性能测试工具-sysbench_oahz4699092zhao的专栏-CS…

Linux性能优化(二)——sysbench压力测试工具

一、sysbench简介 1、sysbench简介 sysBench是一个模块化的、跨平台、多线程基准测试工具,主要用于评估测试各种不同系统参数下的数据库负载情况。sysbench提供如下测试: (1)CPU性能 (2)磁盘IO性能 &…

CScope for programmer

http://bbs.sjtu.edu.cn/bbs0an,path,%2Fgroups%2FGROUP_3%2FGNULinux%2FSoftware%2FD95E89182%2FD5277E56B.html8、Cscope 的使用这下更厉害了, 用Cscope自己的话说 - "你可以把它当做是超过频的ctags", 其功能和强大程度可见一斑吧, 关于它的介绍我就不详细说了, …

CSP安全策略

介绍 内容安全策略 (CSP) 是一个附加的安全层&#xff0c;用于帮助检测和缓解某些类型的攻击&#xff0c;包括跨站脚本 (XSS) 和数据注入等攻击。 这些攻击可用于实现从数据窃取到网站破坏或作为恶意软件分发版本等用途。 启动方式 1. 浏览器客户端启动 <meta http-equi…

seccompptcl(pwn出题)

详细细节看这篇 https://www.anquanke.com/post/id/208364#h2-2 沙箱可以禁用一些系统调用&#xff0c;还是比较常见的感觉。 seccomp 下面这段代码用seccomp沙箱来禁用 安装相应库 sudo apt-get install libseccomp-dev具体参数啥的就不多讲了。。。看大佬的博客就行。 …

CSplitterWnd

MFC支持两种类型的拆分窗口&#xff1a;静态的和动态的。 静态拆分窗口的行列数在拆分窗口被创建时就设置好了&#xff0c;用户不能更改。但是用户可以缩放各行各列。一个静态拆分窗口最多可以包含16行16列。 要找一个使用了静态拆分窗口的应用程序&#xff0c;只要看一下windo…

【UNIX网络编程】|【07】SCTP协议探究

文章目录 1、概述2、接口模型2.1 一到一形式2.2 一到多形式 3、sctp_bindx函数4、sctp_connectx函数5、sctp_getpaddrs函数6、sctp_freepaddrs函数7、sctp_getladdrs函数8、sctp_freelpaddrs9、sctp_sendmsg10、sctp_recvmsg11、sctp_opt_info12、sctp_peeloff函数13、shudown1…

C++网络编程-tcpip协议

目录 1 tcp/ip协议族 1.1 体系结构以及主要协议 1.2 封装 1.3 分用 1.4 测试网络 1.5 arp协议工作原理 1.6 dns工作原理 1.7 socket和tcp/ip协议族的关系 2 ip协议详解 2.1 ip服务特点 2.2 ipv4头部结构 2.3 ip分片 2.4 ip路由 3 tcp协议详解 3.1 tcp服务的特点…

CSP绕过

01 比赛中常见的绕过CSP csp例子&#xff1a; <meta http-equiv"Content-Security-Policy" content"script-src self; object-src none; style-src cdn.example.org third-party.org; child-src https:">目前在比赛中常见的绕过 CSP 一般是: scri…

CS的使用

1&#xff09;首先创建服务端 命令&#xff1a;teamserver 192.168.71.130(主机IP) 123456&#xff08;随便设&#xff09; teamserver 192.168.71.130 123456 >/dev/null 2>&1 & (命令隐藏后台&#xff0c;jobs查看后台&#xff0c;客户端同理&#xff0c;在st…

C/C++Unix网络编程-IPC简介

IPC是进程间通信的简称。 进程、线程与信息共享 Unix进程间的信息共享的方式&#xff1a; (1) 左边的两个进程共享存留于文件系统中某个文件上的某些信息。为访问这些信息、每个进程都得穿越内核(例如read、write、lseek等)。当一个文件有待更新时&#xff0c;某种形式的同步…

CTP For Python

GitHub地址&#xff1a;https://github.com/shizhuolin/PyCTP 这是程序化期货交易上期ctp接口版本.将其包装为python版本. 支持python3 编译需求:vs2010/gcc 编译方法 python setup.py build PyCTP 编译方法 开发环境&#xff1a;windows 10 64bit, python 3.4.3 32bit, Visu…

CSP-S 2021

[CSP-S 2021] 括号序列 题目描述 小 w 在赛场上遇到了这样一个题&#xff1a;一个长度为 n n n 且符合规范的括号序列&#xff0c;其有些位置已经确定了&#xff0c;有些位置尚未确定&#xff0c;求这样的括号序列一共有多少个。 身经百战的小 w 当然一眼就秒了这题&#x…

CyberSploit:1

一、环境搭建 靶机下载地址&#xff1a;https://www.vulnhub.com/entry/cybersploit-1,506/ 二、漏洞复现 探测靶机ip地址&#xff0c;得到靶机IP地址 nmap扫描服务以及端口&#xff0c;发现80和22端口 访问80端口&#xff0c;看到一个页面&#xff0c;查看源码未发现东西 …

[网络安全]dSploit-Android系统下的网络分析和渗透套件的使用

一、准备工作 一台已经获得root权限的安卓手机&#xff0c;并且安卓系统版本在 2.3 以上 busyBox 安装软件 下载地址 BusyBox 是一个集成了一百多个最常用linux命令和工具的软件。&#xff3b;百度百科&#xff3d; 安装这个软件主要是为dsploit软件的运行提供 linux 中…

记一次无线渗透

用到的工具 一台root的安卓手机&#xff08;我这台手机刷了miui9&#xff09; Csploit 安卓渗透神器 下载地址&#xff1a;https://github.com/cSploit/android/releases Kali meterpreter 当然你有Kali的Nethunter设备更好 开始测试 利用万能钥匙找一波wifi&#xff0c;运气好…

为网络安全红队方向提供的资源,工具大合集(渗透测试)

这是一份必备的资源大合集&#xff0c;收录了最优秀的网络安全红队方向&#xff08;渗透测试&#xff09;的资源和工具。 &#xff08;文末领取读者福利&#xff09; 无论您是初学者还是专业人士&#xff0c;都能从中获得所需的技能和知识。 在这个信息化时代&#xff0c;网络…

如何在网站中插入视频

&#xfeff;&#xfeff; 很多新手站长在往自己网站里&#xff0c;添加土豆优酷等视频网站里的视频时&#xff0c;会遇到一些麻烦,珊珊在这里向大家介绍一种简单方法. 1.首先要找到要插入的视频&#xff0c;如下图点击分享给朋友右侧的小按钮. 2.点击按钮后弹出一个窗口点击复…