CEPH同时应用WAL/DB及BCACHE不同模式下的性能测试
刚把ceph osd重建,为osd WAL/DB分配ssd专门的分区,同时也应用了bcache。想测试下不同bcache缓存模式下对性能的影响情况。
4个节点,节点配置:E5-2650/ 32GB内存 / 4*4TB ST4000NM0035 128MB缓存 + 三星zet983 480GB + 三星pro 500GB系统盘;zet983为每个hdd分配35GB DB分区、4GB WAL分区、50GB BCACHE分区。
测试时当前已经有1500个生产vm在线,集群在1000 iops上下浮动,同时pg还有在进行scrub,4个进程。
而后我新加了4个osd是4TB ST4000NM000A 256MB缓存,每个节点一个,这时候已经有1700个生产VM在线,读写iops已在1500 iops上下浮动,但没有pg scrub进程。
因为不是纯净的测试环境、测试也不完整、4k没有全部测试又是写文件的,所以数据可能存在偏差,蛮看。writeback的测试是在脏数据满了才开始的,所以测试的时候同时会进行回刷;而在没满的时候,测试数据基本上是现在的好几倍,但随着长时间运行一边回刷一边缓存才是常态。
数据大概可以看出来:
- writeback在缓存未满之前性能非常好,但满了以后和writethrough差异不是特别大;
- writeback稳定性也不如writethrough,writeback缓存满了iops会上蹿下跳不稳定;
- 把DB/WAL迁移到SSD性能会有大幅提升,而如果应用bcache在这基础上还会有一定提升。
- 增加性能的最佳方式是增加osd。
顺序读16k:
命令:fio -filename=/dev/vda -direct=1 -iodepth 1 -thread -rw=read -ioengine=psync -bs=16k -size=5G -numjobs=30 -runtime=300 -group_reporting -name=mytest
结果:
writethrough:read: IOPS=1335, BW=20.9MiB/s (21.9MB/s)(6261MiB/300006msec)
writeback:read: IOPS=1530, BW=23.9MiB/s (25.1MB/s)(7174MiB/300020msec)
writearound: read: IOPS=1070, BW=16.7MiB/s (17.5MB/s)(5020MiB/300029msec)
nobache: read: IOPS=794, BW=12.4MiB/s (13.0MB/s)(3727MiB/300013msec)
增加4个osd之后:writethrough:read: IOPS=1901, BW=29.7MiB/s (31.2MB/s)(8917MiB/300150msec)
随机写16k(均出现2个左右osd大于500ms以上,出现slow ops):
命令:fio -filename=/dev/vda -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=16k -size=5G -numjobs=30 -runtime=600 -group_reporting -name=mytest
结果:
writethrough:write: IOPS=690, BW=10.8MiB/s (11.3MB/s)(6572MiB/608729msec)
writeback:write: IOPS=736, BW=11.5MiB/s (12.1MB/s)(6938MiB/603340msec)
writearound: write: IOPS=740, BW=11.6MiB/s (12.1MB/s)(6974MiB/602903msec)
nobache: write: IOPS=792, BW=12.4MiB/s (12.0MB/s)(7524MiB/607642msec)
增加4个osd之后:writethrough:write: IOPS=1420, BW=22.2MiB/s (23.3MB/s)(13.2GiB/606818msec)
随机16k读写:
命令:fio -filename=/dev/vda -direct=1 -iodepth 1 -thread -rw=randrw -ioengine=psync -bs=16k -size=5G -numjobs=30 -runtime=300 -group_reporting -name=mytest
结果:
*writethrough:
- read: IOPS=613, BW=9818KiB/s (10.1MB/s)(2885MiB/300942msec)
- write: IOPS=616, BW=9859KiB/s (10.1MB/s)(2897MiB/300942msec)
*writeback:
- read: IOPS=620, BW=9935KiB/s (10.2MB/s)(2914MiB/300387msec)
- write: IOPS=623, BW=9981KiB/s (10.2MB/s)(2928MiB/300387msec)
*writearound:
- read: IOPS=241, BW=3863KiB/s (3956kB/s)(1133MiB/300415msec)
- write: IOPS=240, BW=3851KiB/s (3943kB/s)(1130MiB/300415msec)
*nobcache
- read: IOPS=234, BW=3759KiB/s (3849kB/s)(1105MiB/301072msec)
- write: IOPS=234, BW=3746KiB/s (3835kB/s)(1101MiB/301072msec)
增加4个osd之后 *writethrough:
- read: IOPS=1370, BW=21.4MiB/s (22.5MB/s)(6428MiB/300194msec)
- write: IOPS=1373, BW=21.5MiB/s (22.5MB/s)(6442MiB/300194msec)
随机写4k
命令:fio -filename=/root/testfile -direct=1 -iodepth 1 -thread -rw=randwrite -ioengine=psync -bs=4k -size=1G -numjobs=30 -runtime=100 -group_reporting -name=randwrite-4k
结果:
writethrough:write: IOPS=2547, BW=9.95MiB/s (10.4MB/s)(996MiB/100056msec)
writeback:write: IOPS=2013, BW=8054KiB/s (8248kB/s)(795MiB/101044msec)
writearound:write: IOPS=1512, BW=6050KiB/s (6195kB/s)(601MiB/101692msec)
nobcache:write: IOPS=2745, BW=10.7MiB/s (11.2MB/s)(1073MiB/100009msec)
增加4个osd之后 *writethrough:write: IOPS=3730, BW=14.6MiB/s (15.3MB/s)(1457MiB/100010msec)