sysbench 0.5 性能测试工具使用手册
作者:网络转载 发布时间:[ 2013/9/30 16:20:31 ] 推荐标签:
补充知识:
查看CPU核数的方法
查看物理cpu个数
grep "physical id" /proc/cpuinfo | sort -u | wc -l
查看核心数量
grep "core id" /proc/cpuinfo | sort -u | wc -l
查看线程数量
grep "processor" /proc/cpuinfo | sort -u | wc -l
在sysbench的测试中,--num-threads取值为"线程数量"即可,再大的值没有什么意义,对测试结果也没有什么影响。
3.2 线程(thread)测试
测试线程调度器的性能。对于高负载情况下测试线程调度器的行为非常有用。
sysbench --test=threads --num-threads=64 run
下面是输出结果:
Number of threads: 64 Doing thread subsystem performance test Thread yields per test: 1000 Locks used: 8 Threads started! Done. Test execution summary: total time: 4.5845s total number of events: 10000 total time taken by event execution: 291.9995 per-request statistics: min: 0.76ms avg: 29.20ms max: 152.71ms approx. 95 percentile: 71.11ms Threads fairness: events (avg/stddev): 156.2500/5.81 execution time (avg/stddev): 4.5625/0.02 |
说实话,我也不怎么会分析这个测试结果,网上搜了半天也没有搜到,几乎所有的资料都是简单的罗列出测试结果, 也不告诉我们应该怎么分析,实在是太不照顾新手了。 我自己是通过(total time:)判断线程调度的性能的,下面是我在服务器上运行这个测试的输出:
Number of threads: 64 Doing thread subsystem performance test Thread yields per test: 1000 Locks used: 8 Threads started! Done. Test execution summary: total time: 2.4829s total number of events: 10000 total time taken by event execution: 157.3468 per-request statistics: min: 0.21ms avg: 15.73ms max: 166.69ms approx. 95 percentile: 119.14ms Threads fairness: events (avg/stddev): 156.2500/22.25 execution time (avg/stddev): 2.4585/0.02 |
可以看到total time 比在我自己电脑上少了一半,服务器的线程调度肯定比普通电脑快多了。
3.3 互斥锁(mutex)
测试互斥锁的性能,方式是模拟所有线程在同一时刻并发运行,并都短暂请求互斥锁。
sysbench --test=mutex --num-threads=16 --mutex-num=2048
--mutex-locks=1000000 --mutex-loops=5000 run
输出结果如下:
Number of threads: 16 Doing mutex performance test Threads started! Done. Test execution summary: total time: 3.6123s total number of events: 16 total time taken by event execution: 57.6636 per-request statistics: min: 3580.79ms avg: 3603.98ms max: 3610.94ms approx. 95 percentile: 10000000.00ms Threads fairness: events (avg/stddev): 1.0000/0.00 execution time (avg/stddev): 3.6040/0.01 |
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11