标签:oracle 数据库 include 多线程 压力测试
一、sysbench简介
sysbench是一款开源的多线程性能测试工具,可以执行CPU/内存/线程/IO/数据库等方面的性能测试。数据库目前支持MySQL/Oracle/PostgreSQL。
二、sysbench安装
下载sysbench-0.4.12.tar.gz
tar -xvf sysbench-0.4.12.tar.gz
如果 MySQL 并不是安装在标准目录下的话,那么就需要自己指定 MySQL 的路径了。
编译安装:
./configure --with-mysql-includes=/usr/local/mysqlndb/include --with-mysql-libs=/usr/local/mysql/lib make make install
三、测试
测试分为prepare、run.
ndbcluster测试prepare
sysbench --test=oltp --mysql-table-engine=ndbcluster --mysql-db=ndb --oltp-table-size=100 --mysql-user=root --mysql-password="" --mysql-socket=/usr/local/mysql/tmp/mysql.sock --db-driver=mysql --num-threads=16 prepare
手动自己写一个存储过程录入数据:
DELIMITER $$ DROP PROCEDURE test.wuxin_erp_insert $$ CREATE PROCEDURE test.wuxin_erp_insert() BEGIN DECLARE i INT; SET i=0; WHILE i< 100000 DO REPLACE INTO ndb.sbtest SELECT i,0,‘‘,‘qqqqqqqqqqwwwwwwwwwweeeeeeeeeerrrrrrrrrrtttttttttt‘; END WHILE; COMMIT; END$$ DELIMITER ;
录入数据:
call test.wuxin_erp_insert ();
分别测试线程说为8,16,32
下面以线程数量为8进行测试
并发线程数量:8
sysbench --test=oltp --mysql-table-engine=ndbcluster --mysql-db=ndb --oltp-table-size=100000 --mysql-user=root --mysql-password="" --mysql-socket=/usr/local/mysql/tmp/mysql.sock --db-driver=mysql --num-threads=8 run 测试结果: WARNING: Preparing of "BEGIN" is unsupported, using emulation (last message repeated 7 times) Running the test with following options: Number of threads: 8 Doing OLTP test. Running mixed OLTP test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Maximum number of requests for OLTP test is limited to 10000 Threads started! Done. OLTP test statistics: queries performed: read: 140000 write: 50000 other: 20000 total: 210000 transactions: 10000 (143.72 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 190000 (2730.70 per sec.) other operations: 20000 (287.44 per sec.) Test execution summary: total time: 69.5791s total number of events: 10000 total time taken by event execution: 556.3746 per-request statistics: min: 0.0201s avg: 0.0556s max: 0.3690s approx. 95 percentile: 0.0766s Threads fairness: events (avg/stddev): 1250.0000/8.28 execution time (avg/stddev): 69.5468/0.01
Innodb测试prepare
sysbench --test=oltp --mysql-table-engine=innodb --mysql-db=test --oltp-table-size=100000 --mysql-user=root --mysql-password="" --mysql-socket=/usr/local/mysql/tmp/mysql.sock --db-driver=mysql --num-threads=8 prepare
分别测试线程说为8,16,32
下面以线程数量为8进行测试:
开始测试 8线程
sysbench --test=oltp --mysql-table-engine=innodb --mysql-db=test --oltp-table-size=100000 --mysql-user=root --mysql-password="" --mysql-socket=/usr/local/mysql/tmp/mysql.sock --db-driver=mysql --num-threads=8 run 测试结果: WARNING: Preparing of "BEGIN" is unsupported, using emulation (last message repeated 7 times) Running the test with following options: Number of threads: 8 Doing OLTP test. Running mixed OLTP test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Maximum number of requests for OLTP test is limited to 10000 Threads started! Done. OLTP test statistics: queries performed: read: 140000 write: 50000 other: 20000 total: 210000 transactions: 10000 (771.84 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 190000 (14664.87 per sec.) other operations: 20000 (1543.67 per sec.) Test execution summary: total time: 12.9561s total number of events: 10000 total time taken by event execution: 103.5427 per-request statistics: min: 0.0023s avg: 0.0104s max: 0.3084s approx. 95 percentile: 0.0185s Threads fairness: events (avg/stddev): 1250.0000/9.50 execution time (avg/stddev): 12.9428/0.01
本文出自 “笔记” 博客,请务必保留此出处http://sunflower2.blog.51cto.com/8837503/1670601
标签:oracle 数据库 include 多线程 压力测试
原文地址:http://sunflower2.blog.51cto.com/8837503/1670601