sysbench高并发压力测试试怎么看并发数

sysbench-系统、数据库压力测试工具
时间: 17:34:29
&&&& 阅读:32
&&&& 评论:
&&&& 收藏:0
标签:sysbench是一款简单易用的压力测试工具,可以测试cpu,memory,fileio,mysql数据库; sysbench安装方法:&&&&默认的epel源中的sysbench是0.4版本的,现在已经到1.x版本,本主采用1.x版本&&&&github--&&&&&centos安装方法:&&&&#curl&-s&https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh&|&sudo&bash
&&&&#sudo&yum&-y&install&sysbench安装完成后重要的文件:&&&&对数据库压力测试的文件:&&&&/usr/share/sysbench/bulk_insert.lua&&&&/usr/share/sysbench/oltp_common.lua&&&&/usr/share/sysbench/oltp_delete.lua&&& #数据库删除测试文件&&&&/usr/share/sysbench/oltp_insert.lua&&&& #数据库插入测试文件&&&&/usr/share/sysbench/oltp_point_select.lua&&&&/usr/share/sysbench/oltp_read_only.lua #数据库读测试文件&&&&/usr/share/sysbench/oltp_read_write.lua#数据库读写测试文件&&& /usr/share/sysbench/oltp_update_index.lua&&&&/usr/share/sysbench/oltp_update_non_index.lua&&&&/usr/share/sysbench/oltp_write_only.lua #数据库写测试文件&&&&/usr/share/sysbench/select_random_points.lua&&&&/usr/share/sysbench/select_random_ranges.lua开始数据库测试:&&&&数据库测试分为3步:prepare(准备测试数据),run(开始测试),cleanup(清除测试数据)&&&&用到的相关参数:&&&&&&&&--db-driver=mysql &&&&&&&&--mysql-host=localhost &&&&&&&&--mysql-port=3306 &&&&&&&&--mysql-socket=/tmp/mysql.sock &&&&&&&&--mysql-user=root &&&&&&&&--mysql-password=123456&&&&&&&&--mysql-db=sysbench &&&&&&&&--tables=10 &&&&&&&&--table-size=500000 &&&&&&&&--report-interval=10 &&&&&&&&&--time=120 &&&&&&&&--threads=50 &&&&参数解析:&&&&&&&&--db-driver:用到的数据库类型&&&&&&&&--mysql-host:数据库的IP&&&&&&&&--mysql-port:数据库的端口&&&&&&&&--mysql-socket:socket的路径&&&&&&&&--mysql-user:数据库用户名&&&&&&&&--mysql-password:用户密码&&&&&&&&--mysql-db:数据库名字,默认为sysbench,需要提前创建创好&&&&&&&&--tables:生成表的个数&&&&&&&&--table-size:每个表的行数&&&&&&&&--report-interval:每隔多久在屏幕打印一次信息&&&&&&&&--time:压测时间&&&&&&&&--threads:启动多少个线程,即模拟多少个用户准备测试数据:&&&sysbench&/usr/share/sysbench/oltp_read_only.lua&--db-driver=mysql&--mysql-host=localhost&--mysql-port=3306&--mysql-socket=/tmp/mysql.sock&--mysql-user=root&--mysql-password=123456&--mysql-db=sysbench&--tables=10&--table-size=500000&--report-interval=10&&--time=120&--threads=50&prepare压测数据库:#读测试
sysbench&/usr/share/sysbench/oltp_read_only.lua&--db-driver=mysql&--mysql-host=localhost&--mysql-port=3306&--mysql-socket=/tmp/mysql.sock&--mysql-user=root&--mysql-password=123456&--mysql-db=sysbench&--tables=10&--table-size=500000&--report-interval=10&&--time=120&--threads=50&run
sysbench&/usr/share/sysbench/oltp_read_write.lua&--db-driver=mysql&--mysql-host=localhost&--mysql-port=3306&--mysql-socket=/tmp/mysql.sock&--mysql-user=root&--mysql-password=123456&--mysql-db=sysbench&--tables=10&--table-size=500000&--report-interval=10&&--time=120&--threads=50&run
#其它诊次类推
#读测试结果,模拟320个用户
[&11s&]&thds:&320&tps:&242.69&qps:&4209.17&(r/w/o:&.00/514.83)&lat&(ms,95%):&1678.14&err/s:&0.00&reconn/s:&0.00
[&21s&]&thds:&320&tps:&187.49&qps:&2996.82&(r/w/o:&.00/375.38)&lat&(ms,95%):&2120.76&err/s:&0.00&reconn/s:&0.00
[&31s&]&thds:&320&tps:&229.77&qps:&3649.12&(r/w/o:&.00/458.94)&lat&(ms,95%):&2159.29&err/s:&0.00&reconn/s:&0.00
[&41s&]&thds:&320&tps:&259.54&qps:&4175.73&(r/w/o:&.00/518.98)&lat&(ms,95%):&1803.47&err/s:&0.00&reconn/s:&0.00
[&51s&]&thds:&320&tps:&276.39&qps:&4406.96&(r/w/o:&.00/553.28)&lat&(ms,95%):&1589.90&err/s:&0.00&reconn/s:&0.00
[&61s&]&thds:&320&tps:&281.21&qps:&4496.82&(r/w/o:&.00/562.53)&lat&(ms,95%):&1561.52&err/s:&0.00&reconn/s:&0.00
[&71s&]&thds:&320&tps:&276.10&qps:&4435.70&(r/w/o:&.00/551.90)&lat&(ms,95%):&1648.20&err/s:&0.00&reconn/s:&0.00
[&81s&]&thds:&320&tps:&275.19&qps:&4392.43&(r/w/o:&.00/550.58)&lat&(ms,95%):&1618.78&err/s:&0.00&reconn/s:&0.00
[&91s&]&thds:&320&tps:&280.39&qps:&4491.68&(r/w/o:&.00/560.48)&lat&(ms,95%):&1589.90&err/s:&0.00&reconn/s:&0.00
[&101s&]&thds:&320&tps:&270.71&qps:&4334.41&(r/w/o:&.00/541.83)&lat&(ms,95%):&1678.14&err/s:&0.00&reconn/s:&0.00
[&111s&]&thds:&320&tps:&256.68&qps:&4100.25&(r/w/o:&.00/513.07)&lat&(ms,95%):&1771.29&err/s:&0.00&reconn/s:&0.00
[&121s&]&thds:&320&tps:&261.12&qps:&4087.48&(r/w/o:&.00/509.25)&lat&(ms,95%):&1708.63&err/s:&0.00&reconn/s:&0.00
SQL&statistics:
&&&&queries&performed:
&&&&&&&&read:&&&&&&&&&&&&&&&&&&&&&&&&&&&&438242
&&&&&&&&write:&&&&&&&&&&&&&&&&&&&&&&&&&&&0
&&&&&&&&other:&&&&&&&&&&&&&&&&&&&&&&&&&&&62606
&&&&&&&&total:&&&&&&&&&&&&&&&&&&&&&&&&&&&500848
&&&&transactions:&&&&&&&&&&&&&&&&&&&&&&&&31303&&(258.37&per&sec.)
&&&&queries:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&33.87&per&sec.)
&&&&ignored&errors:&&&&&&&&&&&&&&&&&&&&&&0&&&&&&(0.00&per&sec.)
&&&&reconnects:&&&&&&&&&&&&&&&&&&&&&&&&&&0&&&&&&(0.00&per&sec.)
General&statistics:
&&&&total&time:&&&&&&&&&&&&&&&&&&&&&&&&&&121.1541s
&&&&total&number&of&events:&&&&&&&&&&&&&&31303
Latency&(ms):
&&&&&&&&&min:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&124.29
&&&&&&&&&avg:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&1232.39
&&&&&&&&&max:&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&3681.62
&&&&&&&&&95th&percentile:&&&&&&&&&&&&&&&&&&&1836.24
&&&&&&&&&sum:&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Threads&fairness:
&&&&events&(avg/stddev):&&&&&&&&&&&97.
&&&&execution&time&(avg/stddev):&&&120.删除测试数据:sysbench&/usr/share/sysbench/oltp_read_write.lua&--db-driver=mysql&--mysql-host=localhost&--mysql-port=3306&--mysql-socket=/tmp/mysql.sock&--mysql-user=root&--mysql-password=123456&--mysql-db=sysbench&--tables=10&--table-size=500000&--report-interval=10&&--time=120&--threads=50&cleanup&&&&&&&&本文出自 “” 博客,请务必保留此出处标签:原文:http://liuzhengwei521./3795
教程昨日排行
&&国之画&&&& &&&&&&
&& &&&&&&&&&&&&&&
鲁ICP备号-4
打开技术之扣,分享程序人生!Nginx压力测试工具之WebBench_服务器应用_Linux公社-Linux系统门户网站
你好,游客
Nginx压力测试工具之WebBench
来源:Linux社区&
作者:tongcheng
在Apache中有自带的ab命令可以测试服务的压力,而nginx没有自带的命令,必须要采用第三方软件来测试,今天就简单介绍一下webbench对nginx的压力测试,压力测试是对系统管理员和运维人员必须的,可以很清晰地看清服务器能接受多大压力.注:本人是在虚拟机上做测试。
1.下载webbench软件和安装
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
tar xvf webbench-1.5.tar.gz& -C /usr/local/
cd /usr/local/webbench-1.5/
make install&
2.命令详解
[root@179min webbench-1.5]# ./webbench -help& & & & & & & & & & & & & & & & & &
webbench [option]... URL& -f|--force& & & & & & &
Don't wait for reply from server.& -r|--reload& & & & & & & Send reload request - Pragma: no-cache.& -t|--time &sec&& & & & & Run benchmark for &sec& seconds. Default 30.& -p|--proxy &server:port& Use proxy server for request.& -c|--clients &n&& & & &
Run &n& HTTP clients at once. Default one.& -9|--http09& & & & & & & Use HTTP/0.9 style requests.& -1|--http10& & & & & & & Use HTTP/1.0 protocol.& -2|--http11& & & & & & & Use HTTP/1.1 protocol.& --get& & & & & & & & & & Use GET request method.& --head& & & & & & & & &
Use HEAD request method.& --options& & & & & & & & Use OPTIONS request method.& --trace& & & & & & & & & Use TRACE request method.& -?|-h|--help& & & & & &
This information.& -V|--version& & & & & &
Display program version.[root@centos179min webbench-1.5]#&
3.测试网站压力
[root@centos179min webbench-1.5]# ./webbench -c 200 -t 10 http://192.168.1.179/test.phpWebbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar , GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php200 clients, running 10 sec.
Speed=58386 pages/min,
bytes/sec.& & --每秒钟响应请求数:Speed=58386 pages/min,每秒钟传输数据量: bytes/sec
Requests: 9731 susceed, 0 failed.& & & & & & & & & & & --10秒200个客户端请求没有失败
[root@centos179min webbench-1.5]# ./webbench -c 1000 -t 10 http://192.168.1.179/test.phpWebbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar , GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php1000 clients, running 10 sec.
Speed=47916 pages/min,
bytes/sec.Requests: 7986 susceed, 0 failed.& & & & & & & & &
--10秒1000个客户端请求也没有失败
[root@centos179min webbench-1.5]# ./webbench -c 2000 -t 10 http://192.168.1.179/test.phpWebbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar , GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php2000 clients, running 10 sec.
Speed=50394 pages/min,
bytes/sec.Requests: 8399 susceed, 0 failed.& & & & & & & & & & --10秒中内发2000个请求也没有失败
[root@centos179min webbench-1.5]# ./webbench -c 4000 -t 10 http://192.168.1.179/test.phpWebbench - Simple Web Benchmark 1.5Copyright (c) Radim Kolar , GPL Open Source Software.
Benchmarking: GET http://192.168.1.179/test.php4000 clients, running 10 sec.
Speed=46644 pages/min,
bytes/sec.Requests: 7749 susceed, 25 failed.& & & & & & &
--10秒内4000客户端发送请求就有25个失败,证明10秒并发不超过4000,注nginx没有做过忧化[root@centos179min webbench-1.5]#
WebBench安装及测试
用WebBench测试网站负载
网站压力测试工具 WebBench
服务器压力测试工具WebBench的安装和使用
Linux下网站压力测试工具WebBench下载安装使用
Linux中两款并发测试工具ab&WebBench
使用Nginx搭建WEB服务器
搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程
Nginx 的详细介绍:Nginx 的下载地址:
本文永久更新链接地址:
相关资讯 & & &
& (04月02日)
& (01/11/:46)
& (04/29/:22)
& (12/27/:15)
& (11/06/:46)
& (03/08/:30)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款金钱鳘又称黄唇鱼,目前已经接近濒危灭绝的状态。
赴日游客越来越多,国内游客成为黑心商家的肥肉。
声明:本文由入驻搜狐公众平台的作者撰写,除搜狐官方账号外,观点仅代表作者本人,不代表搜狐立场。
  昨天使用gdb调试MySQL中事务临界状态的时候,发现其实有些场景可能比我想得还要复杂一些,所以我在昨天的测试中结尾也是快快扫过,但是表明了意思即可。这一点上我在后面会把Oracle的临界事务状态也拿出来对比一下,还是蛮有意思的。
  今天简单写了几个脚本继续对一个测试环境的MySQL进行sysbench压力测试。
  先突破1000连接资源设置的瓶颈
  在上一次的基础上,我们保证了能够满足短时间内1000个连接的冲击,从各个方面做了调整,其中的一个重点逐渐落到了IO的吞吐率上,redo日志的大小设置一下子成了焦点和重中之重。
  当然这次的测试中,我的思路还是保持性能持续的增长,边调整,边优化。
  首先一点是我们能够突破1000连接的大关,先用下面的脚本来进行一个初步的测试,测试时长10秒钟,看看能否初始化1500个连接。
  sysbench /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua --mysql-user=root --mysql-port=3306 --mysql-socket=/home/mysql/s1/s1.sock --mysql-host=localhost --mysql-db=sysbenchtest --tables=10 --table-size=5000000 --threads=1500 --report-interval=5 --time=10run没想到就跟约好似的,抛出了如下的错误。注意这里的错误看起来已经不是数据库层面了。
  FATAL: unable to connect to MySQL server on socket '/home/mysql/s1/s1.sock', aborting...
  FATAL: error 2001: Can't create UNIX socket (24)
  PANIC:unprotected error in call to Lua API (cannot open /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua: Too many open files)
  PANIC: unprotected error in call to Lua API (cannot open /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua: Too many open files)是不是支持的socket数的限制呢,我们已经调整了process的值。上面的命令我们可以换个姿势来写,那就是从socket连接改为常用的TCP/IP方式的连接.
  sysbench /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua --mysql-user=perf_test --mysql-port=3306 --mysql-host=10.127.128.78--mysql-password=perf_test--mysql-db=sysbenchtest --tables=10 --table-size=5000000 --threads=1500 --report-interval=5 --time=10run可以看到错误就显示不同了,但是已经能够看出意思来了。
  FATAL: unable to connect to MySQL server on host '10.127.128.78', port 3306, aborting...
  FATAL: error 2004: Can't create TCP/IP socket (24)
  PANIC: unprotected error in call to Lua API (cannot open /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua:Too many open files)
  PANIC: unprotected error in call to Lua API (cannot open /home/sysbench/sysbench-1.0.3/src/lua/oltp_read_write.lua: Too many open files)对此应很明确了,那就是内核资源设置nofile调整一下。
  修改/etc/security/limits.d/90-nproc.conf文件,添加如下的部分即可,重新登录后即可生效。
  * soft nproc 65535
  * soft nofile 65535
  * hard nofile 65535重启MySQL后可以看到设置生效了。# cat /proc/`pidof mysqld`/limits | egrep &(processes|files)&
  Max processes
  Max open files
  调整prepare
  我们继续开启压测模式,马上错误就变了样。是我们熟悉的一个错误,最开始就碰到了。
  FATAL: `thread_init' function failed: /usr/local/share/sysbench/oltp_common.lua:273: SQL API error
  (last message repeated 1 times)
  FATAL: mysql_stmt_prepare() failed
  FATAL: MySQL error: 1461 &Can't create more than max_prepared_stmt_count statements (current value: 100000)&
  FATAL: `thread_init' function failed: /usr/local/share/sysbench/oltp_common.lua:273: SQL API error
  这里得简单说说几个相关的额参数。
  Com_stmt_close prepare语句关闭的次数
  Com_stmt_execute prepare语句执行的次数
  Com_stmt_prepare prepare语句创建的次数这一类的场景可能不是通用的,因为在有些场景下,持续的连接,不是短时间内的大批量连接,这个参数max_prepared_stmt_count其实也不一定需要设置非常大。
  比如我手头一个环境连接数有近500,但是max_prepared_stmt_count还是默认值16382,也稳定运行了很长时间了。# mysqladmin pro|wc -l
  # mysqladmin var|grep max_prepared_stmt_count
  | max_prepared_stmt_count | 16382
  我们的这个压测场景中,会短时间内创建大量的连接,而考虑到性能和安全,会使用prepare的方式,我们以10秒内的sysbench连接测试威力,看看prepare statement的数量变化。
  使用show global status like '%stmt%'能够得到一个基本的数据变化。
  mysql& show global status like '%stmt%';
  +----------------------------+--------+
  | Variable_name | Value |
  +----------------------------+--------+
  | Com_stmt_execute | 477403 |
  | Com_stmt_close | 91000 |
  | Com_stmt_fetch | 0 |
  | Com_stmt_prepare | 298844 |
  | Com_stmt_reset | 0 |
  | Com_stmt_send_long_data | 0 |
  | Com_stmt_reprepare | 0 |
  | Prepared_stmt_count | 0 |
  +----------------------------+--------+过几秒查看,可以看到Prepared_stmt_count已经接近阈值。
  mysql& show global status like '%stmt%';
  +----------------------------+--------+
  | Variable_name | Value |
  +----------------------------+--------+
  | Binlog_stmt_cache_disk_use | 0 |
  | Binlog_stmt_cache_use | 0 |
  | Com_stmt_execute | 477403 |
  | Com_stmt_close | 91000 |
  | Com_stmt_fetch | 0 |
  | Com_stmt_prepare | 398045 |
  | Com_stmt_reset | 0 |
  | Com_stmt_send_long_data | 0 |
  | Com_stmt_reprepare | 0 |
  | Prepared_stmt_count | 98091 |
  +----------------------------+--------+
  按照目前的一个基本情况,我们需要 设置为91*,留有一定的富余,所以我们可以设置为150000
  然后继续测试,就会看到这个参数逐步的飞升。
  mysql& show global status like '%stmt%';
  +----------------------------+--------+
  | Variable_name | Value |
  +----------------------------+--------+
  | Binlog_stmt_cache_disk_use | 0 |
  | Binlog_stmt_cache_use | 0 |
  | Com_stmt_execute | 624184 |
  | Com_stmt_close | 91000 |
  | Com_stmt_fetch | 0 |
  | Com_stmt_prepare | 537982 |
  | Com_stmt_reset | 0 |
  | Com_stmt_send_long_data | 0 |
  | Com_stmt_reprepare | 0 |
  | Prepared_stmt_count | 136500 |
  +----------------------------+--------+整个加压的过程中,可以通过top看到负载还是有一定的潜力,离性能榨干还有距离。
  PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
  13417 mysql 20 0 34.8g 11g 12m S 1324.235.2 19:18.71 /usr/local/mysql/bin/mysqld --defaults-file=/home
  23108 root 20 0 g 2148 S 212.3 5.0 1:32.73 sysbench /home/sysbench/sysbench-1.0.3/src/lua/olt
  下面的图是我使用100M,200M,500,1G的redo得到的TPS图。
  通过这个图也能过看出一个基本的负载情况,在1G的时候,TPS相对比较平稳,但是redo切换还是多多少少都会有一定的抖动。当然redo不是越大越好,
  5.5 中的设置是小于 4G, 5.6 以后是小于512G
  我们持续进行优化。
欢迎举报抄袭、转载、暴力色情及含有欺诈和虚假信息的不良文章。
请先登录再操作
请先登录再操作
微信扫一扫分享至朋友圈
搜狐公众平台官方账号
生活时尚&搭配博主 /生活时尚自媒体 /时尚类书籍作者
搜狐网教育频道官方账号
全球最大华文占星网站-专业研究星座命理及测算服务机构
主演:黄晓明/陈乔恩/乔任梁/谢君豪/吕佳容/戚迹
主演:陈晓/陈妍希/张馨予/杨明娜/毛晓彤/孙耀琦
主演:陈键锋/李依晓/张迪/郑亦桐/张明明/何彦霓
主演:尚格?云顿/乔?弗拉尼甘/Bianca Bree
主演:艾斯?库珀/ 查宁?塔图姆/ 乔纳?希尔
baby14岁写真曝光
李冰冰向成龙撒娇争宠
李湘遭闺蜜曝光旧爱
美女模特教老板走秀
曝搬砖男神奇葩择偶观
柳岩被迫成赚钱工具
大屁小P虐心恋
匆匆那年大结局
乔杉遭粉丝骚扰
男闺蜜的尴尬初夜
客服热线:86-10-
客服邮箱:[数据库]sysbench 压力测试
你的位置:
[数据库]sysbench 压力测试
介绍sysbench是一个模块化、跨平台、多线程基准测试工具,主要用于测试不同系统参数下的数据库负载情况,本文主要介绍0.4版本的使用。sysbench主要用于以下性能测试:文件I/O性能调度内存分配和传输POSIX线程数据库&安装1.安装插件yum install libtool -y2.安装./configure --prefix=/usr/local/sysbench-0.4.12 --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/libmake make installcp -r sysbench/tests /usr/local/sysbench-0.4.12ln -s /usr/local/sysbench-0.4.12/bin/sysbench /usr/local/sysbench-0.4.12/sysbench修改环境变量,在环境变量中加入export LD_LIBRARY_PATH=/usr/local/mysql/lib注意:如果安装目录中没有configure那么需要执行以下操作:chmod +x autogen.sh./autogen.sh如果想要让 sysbench 支持 oracle /pgsql 的话,就需要在编译的时候加上参数--with-oracle或者--with-pgsql一般语法&prepare:用于文件IO和数据库OLTP测试的数据准备阶段。run:性能测试阶段cleanup:移除测试过程中产生的数据help:显示帮助信息,获取--test帮助可以使用--test=name --help通用命令选项这部分命令参数的通用的,不管--test测试什么内容都可以使用这些通用的命令。可以执行sysbench --help了解各参数的具体解释General options: --num-threads=N
number of threads to use [1] --max-requests=N
limit for total number of requests [10000] --max-time=N
limit for total execution time in seconds [0] --forced-shutdown=STRING
amount of time to wait after --max-time before forcing shutdown [off] --thread-stack-size=SIZE
size of stack per thread [32K] --init-rng=[on|off]
initialize random number generator [off] --seed-rng=N
seed for random number generator, ignored when 0 [0] --tx-rate=N
target transaction rate (tps) [0] --tx-jitter=N
target transaction variation, in microseconds [0] --report-interval=N
periodically report intermediate statistics with a specified interval in seconds. 0 disables intermediate reports [0] --report-checkpoints=[LIST,...]dump full statistics and reset all counters at specified points in time. The argument is a list of comma-separated values representing the amount of time in seconds elapsed from start of test when report checkpoint(s) must be performed. Report checkpoints are off by default. [] --test=STRING
test to run --debug=[on|off]
print more debugging info [off] --validate=[on|off]
perform validation checks where possible [off] --help=[on|off]
print help and exit --version=[on|off]
print version and exitLog options: --verbosity=N
verbosity level {5 - debug, 0 - only critical messages} [4] --percentile=N
percentile rank of query response times to count [95]Compiled-in tests: fileio - File I/O test cpu - CPU performance test memory - Memory functions speed test threads - Threads subsystem performance test mutex - Mutex performance test oltp - OLTP testCommands: prepare run cleanup help versionSee 'sysbench --test=&name& help' for a list of options for each test.主要的参数有:--num-threads、--max-requests、--test以下几个参数也经常会使用:--max-time 最大的测试时长--debug(开启debug可以显示更详细的每个线程的执行情况)CPU测试对CPU的性能测试通常有:1. 通过算质数;2计算圆周率等;sysbench使用的就是通过质数相加的测试。对CPU测试直接运行run即可./sysbench --num-threads=12 --max-requests=10000 --debug=on --test=cpu --cpu-max-prime=20000 run上面的测试是:12个线程执行1万条请求,每个请求执行质数相加到20000thread测试测试线程调度的性能,用于高负载下的线程性能测试。& --thread-yields=N&&&&& 每个请求执行&lock/yield/unlock&循环的次数,默认1000& --thread-locks=N&&&&&& 每个线程的互斥锁,默认8个./sysbench --num-threads=12 --max-requests=10000 --test=threads --thread-yields=100 --thread-locks=2 runmemory测试内存分配测试,主要是针对不同的块大小进行内存的连续读写或者随机读写测试。memory options:--memory-block-size=SIZE
size of memory block for test [1K] --memory-total-size=SIZE
total size of data to transfer [100G] --memory-scope=STRING
memory access scope {global,local} [global] --memory-hugetlb=[on|off]
allocate memory from HugeTLB pool [off] --memory-oper=STRING
type of memory operations {read, write, none} [write] --memory-access-mode=STRING memory access mode {seq,rnd} [seq]1.8k顺序分配./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=8K --memory-total-size=100G --memory-access-mode=seq run[ sysbench-0.4.12]# ./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=8K --memory-total-size=100G --memory-access-mode=seq runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing memory operations speed testMemory block size: 8KMemory transfer size: 102400MMemory operations type: writeMemory scope type: globalThreads started!Done.Operations performed: 3893.95 ops/sec) MB transferred (7764.80 MB/sec)General statistics:
total time:
total number of events:
total time taken by event execution: 91.9173
response time:
approx. 95 percentile:
0.02msThreads fairness:
events (avg/stddev):
execution time (avg/stddev):
7.View Code报告:时间13S,7.7G/S2.8k随机分配./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=8K --memory-total-size=100G --memory-access-mode=rnd run[ sysbench-0.4.12]# ./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=8K --memory-total-size=100G --memory-access-mode=rnd runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing memory operations speed testMemory block size: 8KMemory transfer size: 102400MMemory operations type: writeMemory scope type: globalThreads started!Done.Operations performed: 36066.63 ops/sec) MB transferred (8094.27 MB/sec)General statistics:
total time:
total number of events:
total time taken by event execution: 71.5377
response time:
approx. 95 percentile:
0.02msThreads fairness:
events (avg/stddev):
7/19850.15
execution time (avg/stddev):
5.View Code报告:12.6S,8G/s3.16K顺序分配./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=16K --memory-total-size=100G --memory-access-mode=seq run[ sysbench-0.4.12]# ./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=16K --memory-total-size=100G --memory-access-mode=seq runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing memory operations speed testMemory block size: 16KMemory transfer size: 102400MMemory operations type: writeMemory scope type: globalThreads started!Done.Operations performed: 2528.85 ops/sec) MB transferred (13008.26 MB/sec)General statistics:
total time:
total number of events:
total time taken by event execution: 63.7133
response time:
approx. 95 percentile:
0.02msThreads fairness:
events (avg/stddev):
execution time (avg/stddev):
5.View Code报告:7S,13G/S4.16K随机分配./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=16K --memory-total-size=100G --memory-access-mode=rnd run[ sysbench-0.4.12]# ./sysbench --num-threads=12 --max-requests=10000 --test=memory --memory-block-size=16K --memory-total-size=100G --memory-access-mode=rnd runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing memory operations speed testMemory block size: 16KMemory transfer size: 102400MMemory operations type: writeMemory scope type: globalThreads started!Done.Operations performed: 18696.38 ops/sec) MB transferred (15917.13 MB/sec)General statistics:
total time:
total number of events:
total time taken by event execution: 36.1789
response time:
approx. 95 percentile:
0.02msThreads fairness:
events (avg/stddev):
execution time (avg/stddev):
3.[ sysbench-0.4.12]# View Code报告:6.4S,15G/s总结:对于分配同样大小的内存,块月大分配的速率越快,随机分配比顺序分配的速度要快文件io测试./sysbench --test=fileio help文件IO的测试主要用于测试IO的负载性能。主要的测试选项为--file-test-mode。还有几个可以关注的参数包括--file-block-size、--file-io-mode、--file-fsync-freq 、--file-rw-ratio--file-num=N
创建测试文件的数量,默认128个 --file-block-size=N
block size大小,默认16K --file-total-size=SIZE
所有文件的总大小,默认2G --file-test-mode=STRING
测试类型 {seqwr(顺序写), seqrewr(顺序读写), seqrd(顺序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)} --file-io-mode=STRING
I/O模式,需要系统支持默认sync[sync(同步IO),async(异步IO),mmap()] --file-async-backlog=N
每个线程的异步操作队列数,默认128个,需要--file-io-mode= --file-extra-flags=STRING
additional flags to use on opening files {sync,dsync,direct} [] --file-fsync-freq=N
当请求数达到多少时执行fsync()刷新,默认100,0代表过程中不执行fsync() --file-fsync-all=[on|off]
执行每一个写操作后执行fsync()刷新操作,默认关闭off --file-fsync-end=[on|off]
测试结束执行fsync()操作,默认开启on --file-fsync-mode=STRING
同步刷新方法,默认fsync {fsync, fdatasync}
--file-merged-requests=N
合并指定数量的IO请求,0代表不合并,默认0 --file-rw-ratio=N
读写比例,默认1.5/1./sysbench --num-threads=12 --max-requests=10000 --test=fileio --file-total-size=3G --file-test-mode=rndrw prepare./sysbench --num-threads=12 --max-requests=10000 --test=fileio --file-total-size=3G --file-test-mode=rndrw run./sysbench --num-threads=12 --max-requests=10000 --test=fileio --file-total-size=3G --file-test-mode=rndrw clean&上图中的第二部分的包括内容反映了当前系统的io性能大概:38M/S互斥锁测试互斥锁测试模拟所有线程在同一时刻并发运行./sysbench --num-threads=12 --test=mutex --mutex-num=1024 --mutex-locks=10000 --mutex-loops=10000 run[ sysbench-0.4.12]# ./sysbench --num-threads=12 --test=mutex --mutex-num=1024 --mutex-locks=10000 --mutex-loops=10000 runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing mutex performance testThreads started!Done.General statistics:
total time:
total number of events:
total time taken by event execution: 1.0301
response time:
approx. 95 percentile:
86.78msThreads fairness:
events (avg/stddev):
execution time (avg/stddev):
0.oltp测试oltp是针对数据库的基准测试,例如每次对数据库进行优化后执行基准测试来测试不同的配置的tps。可以通过以下命令了解它的有关参数:./sysbench --test=oltp help--oltp-test-mode=STRING
测试类型:simple(简单select测试),complex(事务测试),nontrx(非事务测试),sp(存储过程) ;默认complex --oltp-reconnect-mode=STRING
连接类型:session(每个线程到测试结束不重新连接),transaction(执行每个事务重新连接),query(每一个查询重新连接),random(随机);默认 [session] --oltp-sp-name=STRING
指定执行测试的存储过程名 --oltp-read-only=[on|off]
仅执行select测试,默认关闭 --oltp-avoid-deadlocks=[on|off]
更新过程中忽略死锁,默认[off] --oltp-skip-trx=[on|off]
语句以bigin/commit开始结尾,默认[off] --oltp-range-size=N
范围查询的范围大小,默认 [100],例如begin 100 and 200 --oltp-point-selects=N
单个事务中select查询的数量,默认 [10] --oltp-use-in-statement=N
每个查询中主键查找(in 10个值)的数量,默认 [0] --oltp-simple-ranges=N
单个事务中执行范围查询的数量(SELECT c FROM sbtest WHERE id BETWEEN N AND M),默认[1] --oltp-sum-ranges=N
单个事务中执行范围sum查询的数量,默认 [1] --oltp-order-ranges=N
单个事务中执行范围order by查询的数量,默认[1] --oltp-distinct-ranges=N
单个事务中执行范围distinct查询的数量,默认[1] --oltp-index-updates=N
单个事务中执行索引更新的操作的数量,默认[1] --oltp-non-index-updates=N
单个事务中执行非索引更新操作的数量,默认[1] --oltp-nontrx-mode=STRING
指定单独非事务测试类型进行测试,默认select {select, update_key, update_nokey, insert, delete} [select] --oltp-auto-inc=[on|off]
id列默认自增,默认[on] --oltp-connect-delay=N
指定每一次重新连接延时的时长,默认1秒 [10000] --oltp-user-delay-min=N
minimum time in microseconds to sleep after each request [0] --oltp-user-delay-max=N
maximum time in microseconds to sleep after each request [0] --oltp-table-name=STRING
指定测试的表名,默认[sbtest] --oltp-table-size=N
指定表的记录大小,默认[10000] --oltp-dist-type=STRING
随机数分布状态。uniform(均匀分布)、gauss(高斯分布)、special(特殊分布),默认 [special] --oltp-dist-iter=N
number of iterations used for numbers generation [12] --oltp-dist-pct=N
启用百分比特殊分布,默认 [1] --oltp-dist-res=N
special 百分比[75] --oltp-point-select-mysql-handler=[on|off] Use MySQL HANDLER for point select [off] --oltp-point-select-all-cols=[on|off]
select查询测试时select所有列,默认[off] --oltp-secondary=[on|off]
索引不是主键索引而是二级索引,默认[off] --oltp-num-partitions=N
指定表分区的数量,默认 [0] --oltp-num-tables=N
指定测试表的数量,默认[1]General database options: --db-driver=STRING 指定测试数据库类型,默认mysql --db-ps-mode=STRING prepared statements usage mode {auto, disable} [auto]mysql options: --mysql-host=[LIST,...]
MySQL server host [localhost] --mysql-port=N
MySQL server port [3306] --mysql-socket=STRING
MySQL socket --mysql-user=STRING
MySQL user [sbtest] --mysql-password=STRING
MySQL password [] --mysql-db=STRING
MySQL database name [sbtest] --mysql-table-engine=STRING
storage engine to use for the test table {myisam,innodb,bdb,heap,ndbcluster,federated} [innodb] --mysql-engine-trx=STRING
whether storage engine used is transactional or not {yes,no,auto} [auto] --mysql-ssl=[on|off]
use SSL connections, if available in the client library [off] --myisam-max-rows=N
max-rows parameter for MyISAM tables [1000000] --mysql-create-options=STRING additional options passed to CREATE TABLE []oltp测试主要会有以下相关参数的测试,,其它相关参数默认即可,有需求也可以自定义:--mysql-engine-trx=STRING
指定不同的存储引擎测试。--oltp-test-mode=STRING
测试类型:simple(简单select测试),complex(事务测试),nontrx(非事务测试),sp(存储过程) ;默认complex--oltp-sp-name=STRING
指定存储过程进行语句测试--oltp-table-size=N
指定表的记录大小,默认[10000]--oltp-num-tables=N
指定测试表的数量,默认[1]需要先创建好测试数据库sbtest。1.事务测试,测试12个线程执行1万条请求,10个表,每个表大小100W./sysbench --num-threads=12 --max-requests=100000 --test=oltp --mysql-user=root --mysql-password=root --oltp-test-mode=complex --mysql-db=sbtest --oltp-table-size=1000000 --oltp-num-tables=10 prepare./sysbench --num-threads=12 --max-requests=100000 --test=oltp --mysql-user=root --mysql-password=root --oltp-test-mode=complex --mysql-db=sbtest --oltp-table-size=1000000 --oltp-num-tables=10 run./sysbench --num-threads=12 --max-requests=100000 --test=oltp --mysql-user=root --mysql-password=root --oltp-test-mode=complex --mysql-db=sbtest --oltp-table-size=1000000 --oltp-num-tables=10 cleanup[ sysbench-0.4.12]# ./sysbench --num-threads=12 --max-requests=100000 --test=oltp --mysql-user=root --mysql-password=root --oltp-test-mode=complex --mysql-db=sbtest --oltp-table-size=1000000 --oltp-num-tables=10 runsysbench 0.4.12.10: multi-threaded system evaluation benchmarkNo DB drivers specified, using mysqlRunning the test with following options:Number of threads: 12Random number generator seed is 0 and will be ignoredDoing OLTP test.Running mixed OLTP testUsing Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)Using "BEGIN" for starting transactionsUsing auto_inc on the id columnMaximum number of requests for OLTP test is limited to 100000Using 10 test tablesThreads started!Done.OLTP test statistics:
queries performed:
transactions:
1.94 per sec.)
deadlocks:
(0.00 per sec.)
read/write requests:
046.89 per sec.)
other operations:
83.88 per sec.)General statistics:
total time:
total number of events:
total time taken by event execution:
response time:
approx. 95 percentile:
18.00msThreads fairness:
events (avg/stddev):
7.报告:执行当前测试花费126S,TPS:791/S,RQ:15046/S,95%的请求花费18毫秒事务测试,每个事务包含如下语句:? Point queries:SELECT c FROM sbtest WHERE id= N? Range queries:SELECT c FROM sbtest WHERE id BETWEEN N AND M? Range SUM() queries:SELECT SUM(K) FROM sbtest WHERE id BETWEEN N and M? Range ORDER BY queries:SELECT c FROM sbtest WHERE id between N and M ORDER BY c? Range DISTINCT queries:SELECT DISTINCT c FROM sbtest WHERE id BETWEEN N and M ORDER BYc? UPDATEs on index column:UPDATE sbtest SET k=k+1 WHERE id= N? UPDATEs on non-index column:UPDATE sbtest SET c= N WHERE id= M? DELETE queries:DELETE FROM sbtest WHERE id= N? INSERT queries:INSERT INTO sbtest VALUES ( ...&非事务测试,执行语句如下? Point queries:SELECT pad FROM sbtest WHERE id= N? UPDATEs on index column:UPDATE sbtest SET k=k+1 WHERE id= N? UPDATEs on non-index column:UPDATE sbtest SET c= N WHERE id= M? DELETE queries:DELETE FROM sbtest WHERE id= N? The generated row IDs are unique over each test run, so no rowis deleted twice.? INSERT queries:INSERT INTO sbtest (k, c, pad) VALUES( N , M , S )总结&sysbench是使用最广泛的基准压测工具,功能也很齐全报告也非常的详细。&&&备注:&&& 作者:pursuer.chen&&& 博客:/chenmh本站点所有随笔都是原创,欢迎大家转载;但转载时必须注明文章来源,且在文章开头明显处给明链接。《欢迎交流讨论》
、 、 、 、 、

我要回帖

更多关于 soapui 并发压力测试 的文章

 

随机推荐