ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

GlusterFS优化参数

2022-02-07 15:04:21  阅读:435  来源: 互联网

标签:set read cache gluster volume GlusterFS 参数 performance 优化


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       quick-read(默认on)

gluster volume set tank quick-read on

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.md-cache-timeout 0。

有可能正确,待深入分析,暂用默认值。

 

force-readdirp参数:

    Convert all readdir requests to readdirplus to collect stat info on each entry.

7       io-threads(默认on,16线程)

gluster volume set tank io-thread-count 16

 

    IO线程中继(performance/io-threads)属于性能调整中继的一种,作用是增加IO的并发线程,以提高IO性能。

    IO线程中继试图增加服务器后台进程对文件元数据读写I/O的处理能力。由于GlusterFS服务是单线程的,使用IO线程转换器可以较大的提高性能。这个转换器最好是被用于服务器端,而且是在服务器协议转换器后面被加载。

    IO线程操作会将读和写操作分成不同的线程。同一时刻存在的总线程是恒定的并且是可以配置的。

 

之前GlusterFS Translators v1.3手册对io-threads描述,和当前实现相比可能有出入:

    AIO增加了异步(后台)读写的功能。通过加载这个translator,你可以利用server的空闲时间去处理新的任务。当server在 DMA方式处理读或者写操作的时候,CPU、内存或者网络并没有被使用。这个translator可以将资源更好的利用起来去处理和增加当前的I/O性能。

注意:

    1. io-threads translator 只有在unify之上或者在Server protocol之下才会有效果。如果在unify和namespace brick之间,因为没有文件io的处理,所以不会有效果。

    2. 'thread-count'小于或等于你的CPU数量

 

GlusterFS可以通过配置选项来优化卷

 

配置选项 用途 默认值 合法值
network.ping-timeout    客户端等待检查服务器是否响应的持续时间,节点挂了数据不能写入 42 0-42
diagnostics.brick-log-level   更改卷的日志级别 默认 INFO INFO DEBUG/WARNING/ERROR/CRITICAL/NONE/TRACE
performance.io-thread-count   

IO操作的最大线程 默认16

16 0-65
cluster.min-free-disk         磁盘剩余报警 默认10% 10%  
auth.allow       允许访问卷的客户端ip    
auth.reject   拒接访问卷的客户端ip    
performance.cache-size  读取缓存的大小默认 32 MB  
performance.write-behind-window-size 

能提高写性能单个文件后写缓冲区的大小默认

1MB  
network.frame-timeout

 请求等待时间默认

1800 10-1800
performance.read-ahead-page-count     预读取的数量,默认 4  
luster.self-heal-daemon on            开启目录索引的自动愈合   on|off
Performance.cache-refresh-timeout 缓存校验周期 1s

0-61

 

 

(28条消息) glusterfs性能优化_仇晗的专栏-CSDN博客_glusterfs 调优
https://blog.csdn.net/qiuhan0314/article/details/39672877/

 

标签:set,read,cache,gluster,volume,GlusterFS,参数,performance,优化
来源: https://www.cnblogs.com/paul8339/p/15867864.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有