做石材一般用哪些网站推销,珠海网络公司网站建设,厦门软件网站建设,怎么开发游戏git项目地址#xff1a; https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试#xff08;当然这个工具很强大#xff0c;除了测试主流数据库性能#xff0c;还能测试其它方面#xff0c;详情自己看官网项目文档#xff09; mac上的用法#…git项目地址 https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试当然这个工具很强大除了测试主流数据库性能还能测试其它方面详情自己看官网项目文档 mac上的用法 一、安装 brew install sysbench 二、先在mysql上创建一个专门的测试数据库比如test 三、利用sysbench先生成测试数据 sysbench --testoltp --oltp-table-size5000000 --oltp-table-namet_test \
--mysql-table-engineinnodb \
--mysql-hostlocalhost \
--mysql-dbtest \
--mysql-userroot \
--mysql-password*** \
prepare上面这一堆的意思是在本机localhost的test数据库的t_test中创建500万条测试数据表的数据库引擎为innodb. tips:如果想知道还有哪些参数可用可输入命令 sysbench --testoltp helpcentos上如果用yum install sysbench安装的话运行时可能会出现 FATAL: no database driver specifiedFATAL: failed to initialize database driver! 可以加上参数 --db-drivermysql 原因是yum方式安装时同时安装了mysql与其它数据库的驱动不指定驱动类型的话sysbench不知道你是要测试是mysql还是oracle之类的其它数据库 四、运行测试 sysbench --testoltp --oltp-table-size5000000 --oltp-table-namet_test \
--mysql-table-engineinnodb \
--mysql-hostlocalhost \
--mysql-dbtest \
--mysql-userroot \
--mysql-password*** \
run最后一个prepare改成run就行了测试完后会输出类似以下结果 sysbench 0.4.12: multi-threaded system evaluation benchmarkNo DB drivers specified, using mysql
Running the test with following options:
Number of threads: 1Doing 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: 140000write: 50000other: 20000total: 210000transactions: 10000 (514.48 per sec.)deadlocks: 0 (0.00 per sec.)read/write requests: 190000 (9775.14 per sec.)other operations: 20000 (1028.96 per sec.)Test execution summary:total time: 19.4371stotal number of events: 10000total time taken by event execution: 19.3581per-request statistics:min: 1.65msavg: 1.94msmax: 13.48msapprox. 95 percentile: 2.34msThreads fairness:events (avg/stddev): 10000.0000/0.00execution time (avg/stddev): 19.3581/0.00一般我们比较关心 transactions: 10000 (514.48 per sec.)read/write requests: 190000 (9775.14 per sec.)这代表每秒能处理的事务数以及每秒的读写次数。 五、清理测试数据 sysbench --testoltp --oltp-table-size5000000 --oltp-table-namet_test \
--mysql-table-engineinnodb \
--mysql-hostlocalhost \
--mysql-dbtest \
--mysql-userroot \
--mysql-password*** \
cleanup最后一个换成cleanup即可。 春晚实在太无聊了还不如写二行代码有意思祝各位园友猴年大吉身体健康心想事成转载于:https://www.cnblogs.com/yjmyzz/p/mysql-benchmark-use-sysbench.html