GlusterFS优化参数
gluster volume set rep_vol performance.client-io-threads on #Performance.quick-read: 优化读取小文件的性能 gluster volume set rep_vol performance.quick-read on #Performance.io-cache: 缓存已经被读过的 gluster volume set rep_vol performance.io-cache on gluster volume set hklt_data_vol cluster.quorum-type fixed # 全局读缓存大小 gluster volume set hklt_data_vol performance.cache-size 4GB # IO线程数 gluster volume set hklt_data_vol performance.io-thread-count 16 # 客户端等待时间 gluster volume set hklt_data_vol network.ping-timeout 10 gluster volume set hklt_data_vol performance.write-behind-window-size 500MB # 可以给Gluster逻辑卷设置访问权限以增加安全性。可使用auth.allow和auth.reject允许或禁止特定IP地址访问逻辑卷,支持*通配符。例如:192.168.0.*、192.168.*、192.*都是符合规则的。 # 例如允许192.168.0.*网段的主机访问rep-volume: gluster volume set hklt_data_vol auth.allow 192.168.0.*
参数说明
1 write-behind(默认on)
gluster volume set tank write-behind on
Write Behind Translator (后写)
通常情况下,写操作会比读要慢。通过使用"aggregated background write"技术,write-behind translator 相当显著地改善了写的性能。更确切地说,大量小的写操作被集中起来,形成少量的、大一些的写操作,并且进行后台写处理(non-blocking)。后写方式在client端上聚合了写操作,减小了必须传递的网络包数量。在server端,它帮助服务器优化写的磁盘寻道时间。
aggregate-size
该选项决定了在汇聚写操作之前块的大小。参照你的连接速度、RAM的大小,以及工作负载情况,你可以调整这个值。默认的,该值为128KB,能够比较好的满足大多数应用情况。无限制的增加和减小这个值可能会带来性能上的降低。你可以逐渐调整和分析,慢慢找出一个最优化的结果。
flush-behind
该选项可以直接通过命令 gluster volume set tank flush-behind 的形式进行设置,但实际上,该参数是write-behind的一个选项,如果write-behind为off,只设置flush-behind应该是没有意义的。
该选项也同样是为了提升处理大量小文件的性能。在这个选项里close()/flush()能够被堆到后台,允许客户端去处理下一个请求。默认值是on。
注意:
通常情况下,protocol translator对于一个请求或者转发的数据包有一个4MB的上限。因此,如果你在client端用了上面的write-behind(大多数会如此),并且aggregate-size大于4MB,他也不会发出大的数据包。
2 read-ahead(默认on)
gluster volume set tank read-ahead on
Read Ahead Translator (预读)
基于预设值,read-ahead会顺序地预取一些块。当你的应用忙于处理一些数据的时候,GlusterFS能够预读下一批等待处理的数据。这样能够使的读取操作更加流畅和迅速。而且,工作起来像一个读的集合器一样(read-aggregator),也就是说,将大量的、零散的读取操作集合成少量的、大一些的读操作,这样,减小了网络和磁盘的负载。page-size 描述了块的大小。page-count 描述了预读块的总数量。
注意:
这个translator比较适合于应用在IB-verbs transport环境里。在百兆和千兆以太网接口、没有read-ahead的环境下,能够达到这种连接的最高速度。
3 io-cache(默认on)
gluster volume set tank io-cache on
IO-Cache Translator
如果在client端被加载,能够帮助减小server的负载(如果client正在读一些文件,而且这个文件在两次读操作期间没有被修改)。举个例子,在编译内核时所需要访问的头文件。
type performance/io-cache
IO缓存中继(performance/io-cache)属于性能调整中继的一种,作用是缓存住已经被读过的数据,以提高IO性能。
IO缓存中继可以缓存住已经被读过的数据。这个对于多个应用对同一个数据多次访问,并且如果读的操作远远大于写的操作的话是很有用的(比如,IO缓存很适合用于提供web服务的环境,大量的客户端只会进行简单的读取文件的操作,只有很少一部分会去写文件)。
当IO缓存中继检测到有写操作的时候,它就会把相应的文件从缓存中删除。
IO缓存中继会定期的根据文件的修改时间来验证缓存中相应文件的一致性。验证超时时间是可以配置的。
4 http://www.gluster.org/community/documentation/index.php/Translators/performance/quick-read
从描述上看,该选项只对fuse有用,同时,如果文件的大小大于默认的64k,则该选项也不起作用。
Translator performance/quick-read
该中继器用来提高小文件读性能。
通过网络对文件系统进行操作开销很大,因此,quick-read使用glusterfs内部get接口来一次执行多个posix系统调用open/read/close,一次get调用包含:一个open调用 + 多个read调用 + 一个close调用。
This translator improves performance of read on small files. Over a posix interface, files are read using the apis open, read and close. For a filesystem implemented over a network, the round trip overhead of these calls can be significant. Hence quick-read uses the glusterfs internal get interface to implement posix abstraction of using open/read/close for reading of files there by reducing the number of calls over network from n to 1 where n = no of read calls + 1 (open) + 1 (close).
Example:
volume quick-read
type performance/quick-read
option cache-timeout nsecs (1 second)
option max-file-size nbytes (64Kb)
subvolumes client
end-volume
-
cache-timeout
缓存失效验证时间,默认值1秒。
Timeout for validation of cached file. On timeout stats of the file is compared with that of cached copy. If the file is found to be changed after it is cached, the cache is flushed. The default timeout value is 1 second.
-
max-file-size
可以使用get接口读取的文件最大值,默认值是64KB。当文件大于该值,则使用标准的open/read/close调用。
Maximum size of the file that can be fetched using get interface. Files bigger than this are read using the normal open/read/close. Note that this option controls only how quick-read behaves. Irrespective of the value this option, the applications running on glusterfs continue to use the normal open/read/close interface. Default value of this option is 64 kilo bytes.
glusterfs3.4把quick-read(3.3就这一个translaotr)分解为open-behind和quick-read。原来设计不管操作文件的目的是什么,都要获取真正的fd。重构后,可以根据文件操作目的,如果是修改文件内容,就在后台打开文件并进行操作。如果仅仅是fstat等类似操作,就利用匿名fd来进行,不会等待真正的fd。这样根据操作目的,优化了性能。在lookup时,根据需要设置xdata key,在posix translator层就抓取文件内容。read操作执行到quick-read层时就返回文件内容。
5 open-behind(默认on)
gluster volume set tank open-behind on
Perform open in the backend only when a necessary FOP arrives (e.g writev on the FD, unlink of the file). When option is disabled, perform backend open right after unwinding open().
6 stat-prefetch(默认on)
即:performance/md-cache
gluster volume set tank stat-prefetch on
meta-data caching translator in the volume。
网上有说法:
为规避客户端元数据不一致,把客户端的metadata cache禁用,即配置performance.io-thread-count
IO操作的最大线程 默认16
能提高写性能单个文件后写缓冲区的大小默认
请求等待时间默认
0-61
(28条消息) glusterfs性能优化_仇晗的专栏-CSDN博客_glusterfs 调优
https://blog.csdn.net/qiuhan0314/article/details/39672877/