运维的同学前端时间搭建了一个4台Server的GlusterFS集群
按照其默认的配置,没有使用replicate,读性能还是不错的,每秒大概100M
但写性能相当比较糟糕,每秒大概只有5M左右,几乎比NFS慢了一个数量级
GlusterFS的官方文档比较恶心,在其首页没有具体配置文档的链接,费了好大劲才找到
其Translators的说明文档,见这里,可以参考下
使用一些Translators进行优化后,写性能有了不少的提升,基本能达到25M-30M每秒,这个速度还是基本可以接受的
优化后,读的性能有了一定的下降,不过下降不太明显,每秒在70M-100M之间,也还是可以的
在Client端和Server端都是需要做一些优化的,主要是增加io-cache,write-behind,quick-read,io-threads这些选项
其中对性能提高最大的应该是write-behind,它相当于是个异步写
我们利用cluster/replicate和cluster/distribute就可以搭建一个分布式,高可用,可扩展的存储系统
server端的部分配置如下:
volume posix
type storage/posix
option directory /data-b
end-volume
volume locks
type features/locks
subvolumes posix
end-volume
volume brick
type performance/io-threads
option thread-count 8 # default is 16
subvolumes locks
end-volume
volume server
type protocol/server
option transport-type tcp
subvolumes brick
option auth.addr.brick.allow *
end-volume
client的部分配置如下
volume client1
type protocol/client
option transport-type tcp
option remote-host 10.0.0.1
option remote-subvolume brick # name of the remote volume
end-volume
......
volume replicate1
type cluster/replicate
subvolumes client1 client2
end-volume
volume distribute
type cluster/distribute
subvolumes replicate1 replicate2
end-volume
volume iocache
type performance/io-cache
option cache-size 1024MB # default is 32MB
option cache-timeout 1 # default is 1 second
subvolumes distribute
end-volume
volume readahead
type performance/read-ahead
option page-count 16 # cache per file = (page-count x page-size)
subvolumes iocache
end-volume
volume writebehind
type performance/write-behind
option cache-size 512MB # default is equal to aggregate-size
option flush-behind on # default is 'off'
subvolumes readahead
end-volume
volume quickread
type performance/quick-read
option cache-timeout 1 # default 1 second
option max-file-size 256KB # default 64Kb
subvolumes writebehind
end-volume
volume iothreads
type performance/io-threads
option thread-count 8 # default is 16
subvolumes quickread
end-volume