1.安装sysbench

yum install sysbench

2.download source code

sysbench-1.0.14\src\lua,所有文件上传Linux /opt目录

3.准备mysql

CREATE DATABASE tdb01;

CREATE USER 'root'@'192.168.0.130' IDENTIFIED BY 'root123';

GRANT ALL PRIVILEGES ON tdb01.* TO ‘'root'@'192.168.0.130';

FLUSH PRIVILEGES;

4.执行步骤

/prepare/

sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 prepare

/run/

sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 run

/clean/

sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 cleanup

5.执行过程

[root@mdb01 lua]# sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 prepare

sysbench 1.0.14 (using bundled LuaJIT 2.1.0-beta2)

Initializing worker threads...

Creating table 'sbtest10'...

Creating table 'sbtest1'...

Creating table 'sbtest7'...

Creating table 'sbtest9'...

Creating table 'sbtest6'...

Creating table 'sbtest8'...

Creating table 'sbtest3'...

Creating table 'sbtest2'...

Creating table 'sbtest5'...

Creating table 'sbtest4'...

Inserting 5000000 records into 'sbtest1'

Inserting 5000000 records into 'sbtest2'

Inserting 5000000 records into 'sbtest7'

Inserting 5000000 records into 'sbtest5'

Inserting 5000000 records into 'sbtest10'

Inserting 5000000 records into 'sbtest4'

Inserting 5000000 records into 'sbtest3'

Inserting 5000000 records into 'sbtest9'

Inserting 5000000 records into 'sbtest6'

Inserting 5000000 records into 'sbtest8'

Creating a secondary index on 'sbtest4'...

Creating a secondary index on 'sbtest6'...

Creating a secondary index on 'sbtest5'...

Creating a secondary index on 'sbtest1'...

Creating a secondary index on 'sbtest9'...

Creating a secondary index on 'sbtest8'...

Creating a secondary index on 'sbtest2'...

Creating a secondary index on 'sbtest7'...

Creating a secondary index on 'sbtest10'...

Creating a secondary index on 'sbtest3'...

[root@mdb01 lua]#

[root@mdb01 opt]# sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 run

sysbench 1.0.14 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:

Number of threads: 300

Report intermediate results every 10 second(s)

Initializing random number generator from current time

Initializing worker threads...

Threads started!

[ 10s ] thds: 300 tps: 28.98 qps: 998.95 (r/w/o: 753.86/157.17/87.92) lat (ms,95%): 9799.46 err/s: 0.00 reconn/s: 0.00

[ 20s ] thds: 300 tps: 44.61 qps: 921.51 (r/w/o: 644.08/188.22/89.21) lat (ms,95%): 12163.09 err/s: 0.00 reconn/s: 0.00

[ 30s ] thds: 300 tps: 43.02 qps: 892.44 (r/w/o: 643.05/163.36/86.03) lat (ms,95%): 12163.09 err/s: 0.00 reconn/s: 0.00

[ 40s ] thds: 300 tps: 51.40 qps: 997.46 (r/w/o: 686.07/208.59/102.80) lat (ms,95%): 16819.24 err/s: 0.00 reconn/s: 0.00

[ 50s ] thds: 300 tps: 47.00 qps: 978.98 (r/w/o: 680.65/204.32/94.01) lat (ms,95%): 14302.94 err/s: 0.00 reconn/s: 0.00

[ 60s ] thds: 300 tps: 58.69 qps: 1103.34 (r/w/o: 783.19/202.77/117.38) lat (ms,95%): 10531.32 err/s: 0.00 reconn/s: 0.00

SQL statistics:

queries performed:

read: 42518

write: 12148

other: 6074

total: 60740

transactions: 3037 (48.99 per sec.)

queries: 60740 (979.77 per sec.)

ignored errors: 0 (0.00 per sec.)

reconnects: 0 (0.00 per sec.)

General statistics:

total time: 61.9920s

total number of events: 3037

Latency (ms):

min: 114.27

avg: 6085.46

max: 26580.90

95th percentile: 12609.11

sum: 18481536.44

Threads fairness:

events (avg/stddev): 10.1233/1.86

execution time (avg/stddev): 61.6051/0.23

[root@mdb01 opt]#

sysbench /opt/lua/oltp_read_write.lua --db-driver=mysql --mysql-host=192.168.0.130 --mysql-db=tdb01 --mysql-user=root --mysql-password=root123 --table_size=5000000 --tables=10 --threads=300 --time=60 --report-interval=10 cleanup

sysbench 1.0.14 (using bundled LuaJIT 2.1.0-beta2)

Dropping table 'sbtest1'...

Dropping table 'sbtest2'...

Dropping table 'sbtest3'...

Dropping table 'sbtest4'...

Dropping table 'sbtest5'...

Dropping table 'sbtest6'...

Dropping table 'sbtest7'...

Dropping table 'sbtest8'...

Dropping table 'sbtest9'...

Dropping table 'sbtest10'...

[root@mdb01 opt]#

6.注意事项

1).max_prepared_stmt_count参数应该设置的高一点否则会提示超过阈值

2).由于数据库数据需要装载到内存变成热数据,run应该执行多次,第一次的TPS,QPS一般偏低,应该取执行几次后的值作为参考。

sysbench 1.0.6 mysql_mysql sysbench 1.0.X相关推荐

  1. 为什么 HashMap 加载因子一定是0.75?而不是0.8,0.6?

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 有很多东西之前在学的时候没怎么注意,笔者也是在重温HashMap的 ...

  2. 安卓绿色联盟两项免费福利重磅发布:EMUI9.0和绿色应用2.0测试能力

    为什么要把华为的EMUI9.0系统和安卓绿色联盟绿色应用标准2.0放在一块提?有兴趣的朋友可以自行google百度,小编这里卖个关子~ 9月5日,华为正式对外发布EMUI 9.0系统,这也是目前国内首 ...

  3. android6.0麦克风权限,android 6.0权限检测以及6.0以下,麦克风、相机权限判断

    android 6.0以上权限 android 6.0以上权限,我是通过PermissionsDispatcher进行申请,操作的,具体使用方法,见PermissionsDispatcher,Andr ...

  4. 完美解决:You are using pip version 9.0.1, however version 18.0 is available.

    问题描述: You are using pip version 9.0.1, however version 18.0 is available. You should consider upgrad ...

  5. Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for i

    keras  imshow显示图片显示不出来,报错 Clipping input data to the valid range for imshow with RGB data ([0..1] fo ...

  6. cdh的集成phoenix安装_环境篇:Kylin3.0.1集成CDH6.2.0

    环境篇:Kylin3.0.1集成CDH6.2.0 Kylin是什么? Apache Kylin™是一个开源的.分布式的分析型数据仓库,提供Hadoop/Spark 之上的 SQL 查询接口及多维分析( ...

  7. php7.0 + mysql5.7.10 + nginx7.0 web开发环境搭建(CentOS7)

    一.搭建nginx开发环境 参考官方文档:http://nginx.org/en/linux_pac... 1.设置yum 官当提供了利用yum来安装.升级nginx的方法 在/etc/yum.rep ...

  8. sphinx error connection to 127.0.0.1:9312 failed (errno=0, msg=)

    通过一键安装lnmp环境,运行sphinx时,提示sphinx error connection to 127.0.0.1:9312 failed (errno=0, msg=) 是因为lnmpa服务 ...

  9. mysql+1.6安装,CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法

    这篇文章主要介绍了CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享,需要的朋友可以参考下准备篇: 一.配置防火墙,开启80端口.3306端口 Cen ...

最新文章

  1. 嵌入式linux程序没有任何提示退出,答网友问:嵌入式Linux执行程序提示Not found的解答...
  2. 再见 Win10!下一代操作系统要来了!
  3. 学习 Spring (十七) Spring 对 AspectJ 的支持 (完结)
  4. 手机抓包app_Python爬取网站上面的数据很简单,但是如何爬取APP上面的数据呢
  5. AES 加密256位 错误 java.security.InvalidKeyException: Illegal key size or default parameters
  6. 分布式事务一致性方案
  7. android 常用代码
  8. 学习笔记一 线性代数
  9. 计算机网络基础(一)
  10. 软件测试流程图及描述
  11. 一文详解 RSA 非对称加密算法
  12. scratch 编程 + 小学数学
  13. Facebook改名,元宇宙非区块链不可
  14. 计算机和工业设计哪个就业前景大,工业设计专业就业前景
  15. 逃跑吧少年维护服务器,逃跑吧少年—逃跑吧少年3月6日更新公告 新增道具卡新时装...
  16. Oracle 的 表空间(Tablespace)、用户(User)、模式(Schema)详细解释
  17. 【应用安全】微软的安全开发生命周期(SDL)
  18. python读取Excel文件是报(xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; fo
  19. vue3一键复制功能
  20. linux下c/c++实例之十四c实现的bt软件下载

热门文章

  1. 如何理解if __name__=='__main__'?
  2. 判断一个字符串是否是回文_Python
  3. linux c普通用户怎么判断键盘是否按动_网络没问题,电脑却无法联网怎么办?win10无法联网搞定方式举例...
  4. php分页类示例下载,PHP 通用分页类的简单示例
  5. 图片支持滚轮缩放(缩放中心为鼠标位置)_JS实现图片缩放、拖动、剪裁、预览及保存效果...
  6. puts遇到空格无法输出_ACM输出超限|puts与printf
  7. knife4j导出html有误,knife4j无法生成完整的响应说明
  8. java调用日期控件_JAVA基础应用:日期时间选择控件(代码)
  9. 人工智能行业有哪些岗位_建筑行业“七大员”是哪些岗位?职责是什么?
  10. php怎么上传函数,【后端开辟】php上传函数怎样封装