磁盘io测试工具_CPU、内存、磁盘IO性能如何压测?

介绍

  • SysBench 是一款开源的、跨平台的、模块化的、多线程的性能测试工具, 可以执行 CPU/内存/线程/IO/数据库 等方面的性能测试. 用于评估操作系统的性能参数.
* oltp_*.lua: a collection of OLTP-like database benchmarks* fileio: a filesystem-level benchmark* cpu: a simple CPU benchmark* memory: a memory access benchmark* threads: a thread-based scheduler benchmark* mutex: a POSIX mutex benchmark
  • 主要包含如下几种测试
8549389535a931eb43ed172ab13278a0.png

安装 sysbench

  • yum -y install sysbench

一 、CPU性能测试 (cpu测试主要是进行素数的加法运算)

  • 帮助命令 sysbench cpu help
sysbench 1.0.17 (using system LuaJIT 2.0.4)cpu options: --cpu-max-prime=N upper limit for primes generator [10000] 最大质数发生器数量。默认是10000
  • 测试命令 sysbench cpu --cpu-max-prime=20000 --threads=2 run
5ce60e563b053b00a5a8bd7b8ab6677c.png

二、内存分配及传输速度

  • 帮助命令 sysbench memory help
sysbench 1.0.17 (using system LuaJIT 2.0.4)memory options: --memory-block-size=SIZE size of memory block for test [1K] --memory-total-size=SIZE total size of data to transfer [100G] --memory-scope=STRING memory access scope {global,local} [global] --memory-hugetlb[=on|off] allocate memory from HugeTLB pool [off] --memory-oper=STRING type of memory operations {read, write, none} [write] --memory-access-mode=STRING memory access mode {seq,rnd} [seq]
  • 测试命令 sysbench memory --memory-block-size=8k --memory-total-size=2G run
66acc3448f70a1ddcfc1f61d36b9248d.png

三、磁盘IO性能测试

  • 帮助命令 sysbench fileio help
fileio options: --file-num=N number of files to create [128] --file-block-size=N block size to use in all IO operations [16384] --file-total-size=SIZE total size of files to create [2G] --file-test-mode=STRING test mode {seqwr, seqrewr, seqrd, rndrd, rndwr, rndrw} --file-io-mode=STRING file operations mode {sync,async,mmap} [sync] --file-async-backlog=N number of asynchronous operatons to queue per thread [128] --file-extra-flags=[LIST,...] list of additional flags to use to open files {sync,dsync,direct} [] --file-fsync-freq=N do fsync() after this number of requests (0 - don't use fsync()) [100] --file-fsync-all[=on|off] do fsync() after each write operation [off] --file-fsync-end[=on|off] do fsync() at the end of test [on] --file-fsync-mode=STRING which method to use for synchronization {fsync, fdatasync} [fsync] --file-merged-requests=N merge at most this number of IO requests if possible (0 - don't merge) [0] --file-rw-ratio=N reads/writes ratio for combined test [1.5]
  • 测试命令
  • 1、prepare阶段,生成需要的测试文件,完成后会在当前目录下生成很多小文件
sysbench fileio --threads=2 --file-total-size=1G --file-test-mode=rndrw prepare
1883482c86d7b772507318b4c7756d25.png
  • 2、run阶段
sysbench fileio --threads=2 --file-total-size=1G --file-test-mode=rndrw run
72ec416997d7b5a43e071766eaccd7a8.png
  • 3、清理测试时生成的文件
sysbench fileio --threads=2 --file-total-size=1G --file-test-mode=rndrw cleanup

四、 mutex性能测试

  • 帮助命令 sysbench mutex help
mutex options: --mutex-num=N total size of mutex array [4096] 数组互斥的总大小 --mutex-locks=N number of mutex locks to do per thread [50000] 每个线程互斥锁的数量 --mutex-loops=N number of empty loops to do outside mutex lock [10000] 内部互斥锁的空循环数量
  • 命令测试 sysbench mutex --threads=2 --mutex-num=4096 --mutex-locks=50000 --mutex-loops=10000 run
a1a2796e37035e261f2f30d3cd1fab69.png

五、POSXI线程性能

  • 帮助测试 sysbench threads help
threads options: --thread-yields=N number of yields to do per request [1000] 每个请求产生多少个线程。 --thread-locks=N number of locks per thread [8] 每个线程的锁的数量
  • 命令测试 sysbench threads --threads=2 --thread-yields=100 --thread-locks=4 run
2eeacfe69b4c0d482215036fcd867ce2.png

六、数据库性能(OLTP基准测试)

待定后续~

  • 官方文档:https://github.com/akopytov/sysbench

爱运维、爱分享,感兴趣请帮关注或转发~~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值