北碚免费建站哪家做得好,WordPress仿w3c主题,建设网站的内容,wordpress 换服务器mysql 压力测试sysbench支持的测试模式#xff1a;1、CPU运算性能2、磁盘IO性能3、调度程序性能4、内存分配及传输速度5、POSIX线程性能6、数据库性能(OLTP基准测试)目前sysbench主要支持 mysql,drizzle,pgsql,oracle 等几种数据库。二、编译安装sysbench[roottest package]# …mysql 压力测试sysbench支持的测试模式1、CPU运算性能2、磁盘IO性能3、调度程序性能4、内存分配及传输速度5、POSIX线程性能6、数据库性能(OLTP基准测试)目前sysbench主要支持 mysql,drizzle,pgsql,oracle 等几种数据库。二、编译安装sysbench[roottest package]# tar zxvf sysbench-0.4.12-1.1.tgz[roottest sysbench-0.4.12-1.1]# ./autogen.sh[roottest sysbench-0.4.12-1.1]# ./configure[roottest sysbench-0.4.12-1.1]# make[roottest sysbench-0.4.12-1.1]# make install三、OLTP测试环境初始化测试库环境对已经准备好的数据库进行操作首先需要在准备好的数据库中创建一个名为sbtest的库不可更改必须叫这个名字能看得懂lua脚本可以随意更改这个是个大前提1、需要切到这个目录下进行操作如果不切目录也可以使用绝对路径oltp.lua脚本路径[roottest db]# cd /data/package/sysbench-0.4.12-1.1/sysbench/tests/db2、在sbtest库中创建10个测试表每个测试表中100000条记录(行)填充随机生成的数据[roottest db]# sysbench --mysql-host192.168.4.100 --mysql-useradmin --mysql-passwordFJRUDKEISLWO --testoltp.lua --oltp_tables_count10 --oltp-table-size100000 --rand-initon prepare参数解释--testtests/db/oltp.lua 表示调用 ./tsysbench-0.4.12-1.1/sysbench/tests/db/oltp.lua 脚本进行 oltp模式测试--oltp_tables_count10 表示会生成 10 个测试表--oltp-table-size100000 表示每个测试表填充数据量为 100000--rand-initon 表示每个测试表都是用随机数据来填充的他人经验真实测试场景中数据表建议不低于10个单表数据量不低于500万行当然了要视服务器硬件配置而定。如果是配备了SSD或者PCIE SSD这种高IOPS设备的话则建议单表数据量最少不低于1亿行。四、进行OLTP测试[roottest db]# sysbench --mysql-host10.10.95.235 --mysql-useradmin --mysql-passwordFJRUDKEISLWO --testoltp.lua --oltp_tables_count10 --oltp-table-size10000000 --num-threads10 --oltp-read-onlyoff --report-interval10 --rand-typeuniform --max-time120 --max-requests0 --percentile99 run /data/log/sysbench.log参数解释--num-threads8 # 表示发起 8个并发连接--oltp-read-onlyoff #表示不要进行只读测试也就是会采用读写混合模式测试--report-interval10 #表示每10秒输出一次测试进度报告--rand-typeuniform #表示随机类型为固定模式其他几个可选随机模式uniform(固 定),gaussian(高斯),special(特定的),pareto(帕累托)--max-time120 #表示最大执行时长为 120秒--max-requests0 #表示总请求数为 0因为上面已经定义了总执行时长所以总请求数可以设定为 0也可以只设定总请求数不设定最大执行时长--percentile99 #表示设定采样比例默认是 95%即丢弃1%的长请求在剩余的99%里取最大值他人经验真实测试场景中建议持续压测时长不小于30分钟否则测试数据可能不具参考意义。五、测试结果解读sysbench 0.5: multi-threaded system evaluation benchmarkRunning the test with following options:Number of threads: 8Report intermediate results every 10 second(s)Random number generator seed is 0 and will be ignoredThreads started!-- 每10秒钟报告一次测试结果tps、每秒读、每秒写、99%以上的响应时长统计[ 10s] threads: 8, tps: 1111.51, reads/s: 15568.42, writes/s: 4446.13, response time: 9.95ms (99%)[ 20s] threads: 8, tps: 1121.90, reads/s: 15709.62, writes/s: 4487.80, response time: 9.78ms (99%)[ 30s] threads: 8, tps: 1120.00, reads/s: 15679.10, writes/s: 4480.20, response time: 9.84ms (99%)[ 40s] threads: 8, tps: 1114.20, reads/s: 15599.39, writes/s: 4456.30, response time: 9.90ms (99%)[ 50s] threads: 8, tps: 1114.00, reads/s: 15593.60, writes/s: 4456.70, response time: 9.84ms (99%)[ 60s] threads: 8, tps: 1119.30, reads/s: 15671.60, writes/s: 4476.50, response time: 9.99ms (99%)OLTP test statistics:queries performed:read: 938224 -- 读总数write: 268064 -- 写总数other: 134032 -- 其他操作总数(SELECT、INSERT、UPDATE、DELETE之外的操作例如COMMIT等)total: 1340320 -- 全部总数transactions: 67016 (1116.83 per sec.) -- 总事务数(每秒事务数)deadlocks: 0 (0.00 per sec.) -- 发生死锁总数read/write requests: 1206288 (20103.01 per sec.) -- 读写总数(每秒读写次数)other operations: 134032 (2233.67 per sec.) -- 其他操作总数(每秒其他操作次数)General statistics: -- 一些统计结果total time: 60.0053s -- 总耗时total number of events: 67016 -- 共发生多少事务数total time taken by event execution: 479.8171s -- 所有事务耗时相加(不考虑并行因素)response time: -- 响应时长统计min: 4.27ms -- 最小耗时avg: 7.16ms -- 平均耗时max: 13.80ms -- 最长耗时approx. 99 percentile: 9.88ms -- 超过99%平均耗时Threads fairness:events (avg/stddev): 8377.0000/44.33execution time (avg/stddev): 59.9771/0.00最重要的参数指标总的事物数每秒事务数时间统计信息(最大、最小、平均、99%以上语句响应时间)上述测试方式是在云RDS(UDB)数据库实例验证的我测试的时候是采用了迅达云和ucloud云进行的对比性测试更容易拿出数据。在测试环境也就是自建的数据库会发生各种情况只能依靠个人排查能力了。