1 Ceph自带测试工具:rados bench 和 rbd bench
1.1 rados bench
命令行格式:rados bench -p <pool_name> <seconds> <write|seq|rand> -b <block size> -t --no-cleanup 默认对象尺寸是 4 MB ,默认模拟线程数为 16 。
-p:测试所针对的存储池;
seconds:测试所持续的秒数;
<write|seq|rand>:操作模式,write:写,seq:顺序读;rand:随机读;
-b:block size,即块大小,默认为 4M;
-t:读/写并行数,默认为 16;
--no-cleanup 表示测试完成后不删除测试用数据。在做读测试之前,需要使用该参数来运行一遍写测试来产生测试数据,在全部测试结束后可以运行 rados -p <pool_name> cleanup 来清理所有测试数据。
例子:
# rados bench -p test 30 write -b 4M --no-cleanup
1.2 rbd bench
命令行格式:rbd bench -p <pool_name> --image <image_name> --io-size <io-size> --io-total <total>
--io-type <read/write> --io-pattern <rand/seq> --io-threads <thread_num>
例子:使用rbd bench需要手动创建一个image,然后对该image进行测试
# rbd create -p test --image img-1 --size 10G
# rbd bench -p test --image img-1 --io-size 4K --io-total 5G --io-type write --io-pattern rand --io-threads 16
【注意】J版本格式和L版本不同 rbd bench-write -p test --image img-1 --io-size 4K --io-total 5G --io-pattern rand --io-threads 16,且J版本只支持write,不能read。
2 使用fio测试
2.1 rbd裸盘性能
# rbd create volume_normal_triple/pure-volume --size 1000G --imge-feature layering 使用rbd引擎可以直接对rbd做测试,不需要map盘 # fio --ioengine=rbd --pool=volume_normal_triple -rbdname=pure-volume -rw=write -numjobs=1 -direct=1 -bs=tM -iodepth=16 -runtime=600 -name=test |
2.3 rbd盘做文件系统
然后向/mnt/rbd0写数据
# rbd create volume_normal_triple/test --size 1000G --imge-feature layering # rbd map volume/test /dev/rbd0 # mkfs.xfs /dev/rbd0 # mount /dev/rbd0 /mnt/rbd0 # fio --ioengine=libaio -filename=/mnt/rbd0/file1 -rw=write -direct=1 -bs=4M -size=100M -numjobs=1 -iodepth=16 -runtime=60 -name=test |