Ceph存储性能测试工具详解

您所在的位置:网站首页 linux硬盘测速工具 Ceph存储性能测试工具详解

Ceph存储性能测试工具详解

2023-05-11 13:46| 来源: 网络整理| 查看: 265

dd:磁盘读写性能测试

语法:

dd if=/dev/zero of=/root/testfile bs=1G count=1 oflag=direct/dsync/sync iperf3:网络带宽性能测试 rados bench:Ceph 自带的 rados 性能测试工具

语法:

rados bench -p -b -t --no-cleanup rados load-gen:Ceph 自带的 rados 性能测试工具,可在集群内产生指定类型的负载,比 rados bench 功能丰富,能指定更多的参数

语法:

rados -p rbd load-gen

选项说明:

--num-objects #产生的对象数目 --min-object-size #最小对象大小 --max-object-size #最大对象大小 --max-ops #最大操作数目 --min-op-len #最小操作长度 --max-op-len #最大操作长度 --read-percent #读操作的百分比 --target-throughput #目标吞吐量,单位 MB --run-length #运行时长,单位秒 rbd bench-write:ceph 自带的 rbd 性能测试工具,只能对块设备做写测试

语法:

rbd bench-write

选项说明:

--io-size:单位 byte,默认 4M --io-threads:线程数,默认 16 --io-total:总写入字节,默认 1024M --io-pattern :写模式,默认为 seq 即顺序写 fio + rbd ioengine:fio 结合 rbd IO 引擎的性能测试工具

说明:Linux 平台上做 IO 性能测试的瑞士军刀,可以对使用内核内 rbd 和用户空间 librados 进行比较,标准规则:顺序和随机 IO,块大小:4k,16k,64k,256k,模式:读和写,支持混合模式。

fio + libaio:fio 结合 linux aio 的 rbd 性能测试 OSD 磁盘写性能 # echo 3 > /proc/sys/vm/drop_caches # dd if=/dev/zero of=/var/lib/ceph/osd/ceph-0/delete_me bs=1G count=1 oflag=direct OSD 磁盘读性能 # dd if=/var/lib/ceph/osd/ceph-0/delete_me of=/dev/null bs=1G count=1 iflag=direct 网络性能 服务端: # iperf3 -s -D -f m -i 1 客户端: # iperf -c RADOS 性能测试:使用 Ceph 自带的 rados bench 工具

该工具的语法为:

rados bench -p -b -t --no-cleanup

选项说明:

pool_name:测试所针对的存储池; seconds:测试所持续的秒数; :操作模式,write:写,seq:顺序读;rand:随机读; -b:block size,即块大小,默认为 4M; -t:读/写并行数,默认为 16; --no-cleanup:表示测试完成后不删除测试用数据。在做读测试之前,需要使用该参数来运行一遍写测试来产生测试数据,在全部测试结束后可以运行 rados -p cleanup 来清理所有测试数据。

写:

# rados bench -p rbd 10 write --no-cleanup

顺序读:

# rados bench -p rbd 10 seq

随机读:

# rados bench -p rbd 10 rand RADOS 性能测试:使用 rados load-gen 工具

该工具的语法为:

rados -p rbd load-gen

选项说明:

--num-objects 初始生成测试用的对象数,默认 200; --min-object-size 测试对象的最小大小,默认 1KB,单位byte; --max-object-size 测试对象的最大大小,默认 5GB,单位byte; --min-op-len 压测IO的最小大小,默认 1KB,单位byte; --max-op-len 压测IO的最大大小,默认 2MB,单位byte; --max-ops 一次提交的最大IO数,相当于iodepth; --target-throughput 一次提交IO的历史累计吞吐量上限,默认 5MB/s,单位B/s; --max-backlog 一次提交IO的吞吐量上限,默认10MB/s,单位B/s; --read-percent 读写混合中读的比例,默认80,范围[0, 100]; --run-length 运行的时间,默认60s,单位秒;

运行命令:

# rados -p rbd load-gen --read-percent 0 --min-object-size 1073741824 --max-object-size 1073741824 --max-ops 1 --read-percent 0 --min-op-len 4194304 --max-op-len 4194304 --target-throughput 1073741824 --max_backlog 1073741824

可见,与 rados bench 相比,rados load-gen 的特点是可以产生混合类型的测试负载,而 rados bench 只能产生一种类型的负载。但是 load-gen 只能输出吞吐量,只合适做类似于 4M 这样的大block size 数据测试,输出还不包括延迟。

使用 rbd bench-write 进行块设备写性能测试

执行如下命令来准备 Ceph 客户端中的块设备:

# rbd create test --size 1024 --image-feature layering # rbd info test # rbd map test # rbd showmapped # mkfs.xfs /dev/rbd1 # mkdir -p /mnt/test # mount /dev/rbd1 /mnt/test # df -h /mnt/test

测试工具:

rbd bench-write 的语法为:

rbd bench-write

可以带如下参数:

--io-size:单位 byte,默认 4096 bytes = 4K; --io-threads:线程数,默认 16; --io-total:总写入字节,单位为字节,默认 1024M; --io-pattern :写模式,默认为 seq 即顺序写;

分别在OSD节点和客户端上做测试:

(1)在 OSD 节点上做测试

# rbd bench-write test --io-total 171997300

(2)在客户端上做测试

# rbd bench-write test --io-total 1719973000 --io-size 4096000 # rbd bench-write test --io-total 1719973000 使用 fio + rbd ioengine

运行 apt-get install fio 来安装 fio 工具,并创建 fio 配置文件write.fio:

[write-4M] description="write test with block size of 4M" ioengine=rbd clientname=admin pool=rbd rbdname=test iodepth=32 runtime=120 rw=write bs=4M write:表示顺序写 randwrite:表示随机写 read:表示顺序读 randread:表示随机读

运行命令:

# fio write.fio 使用 fio + libaio 进行测试

libaio 是 Linux native asynchronous I/O。

有几种测试模式:

随机写:

# fio -filename=/mnt/test/test -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=libaio -bs=4M -size=1G -numjobs=1 -runtime=120 -group_reporting -name=read-libaio

随机读:

# fio -filename=/mnt/test/test -direct=1 -iodepth 1 -thread -rw=randread -ioengine=libaio -bs=4M -size=1G -numjobs=1 -runtime=120 -group_reporting -name=read-libaio

顺序写:

# fio -filename=/mnt/test/test -direct=1 -iodepth 1 -thread -rw=write -ioengine=libaio -bs=4M -size=1G -numjobs=1 -runtime=120 -group_reporting -name=read-libaio

顺序读:

# fio -filename=/mnt/test/test -direct=1 -iodepth 1 -thread -rw=read -ioengine=libaio -bs=4M -size=1G -numjobs=1 -runtime=120 -group_reporting -name=read-libaio

这些参数的含义是:

filename:表示待测试的设备名称; iodepth: libaio 会用这个 iodepth 值来调用 io_setup 准备个可以一次提交 iodepth 个 IO 的上下文,同时申请个io请求队列用于保持IO; iodepth_batch:在压测进行的时候,系统会生成特定的IO请求,往io请求队列里面扔,当队列里面的IO个数达到 iodepth_batch 值的时候; iodepth_batch_complete 和 iodepth_low: 调用 io_submit 批次提交请求,然后开始调用 io_getevents 开始收割已经完成的IO。 每次收割多少呢?由于收割的时候,超时时间设置为0,所以有多少已完成就算多少,最多可以收割 iodepth_batch_complete 值个。随着收割,IO队列里面的IO数就少了,那么需要补充新的IO。 什么时候补充呢?当IO数目降到 iodepth_low 值的时候,就重新填充,保证 OS 可以看到至少 iodepth_low 数目的io在队列口排队着。


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3