溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

gluster性能調(diào)優(yōu)選項有哪些

發(fā)布時間:2022-01-04 17:44:41 來源:億速云 閱讀:200 作者:iii 欄目:云計算

這篇文章主要介紹“gluster性能調(diào)優(yōu)選項有哪些”,在日常操作中,相信很多人在gluster性能調(diào)優(yōu)選項有哪些問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”gluster性能調(diào)優(yōu)選項有哪些”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

1       write-behind(默認on)

gluster volume set tank write-behind on

Write Behind Translator (后寫)

    通常情況下,寫操作會比讀要慢。通過使用"aggregated background write"技術(shù),write-behind translator 相當(dāng)顯著地改善了寫的性能。更確切地說,大量小的寫操作被集中起來,形成少量的、大一些的寫操作,并且進行后臺寫處理(non-blocking)。后寫方式在client端上聚合了寫操作,減小了必須傳遞的網(wǎng)絡(luò)包數(shù)量。在server端,它幫助服務(wù)器優(yōu)化寫的磁盤尋道時間。

aggregate-size

    該選項決定了在匯聚寫操作之前塊的大小。參照你的連接速度、RAM的大小,以及工作負載情況,你可以調(diào)整這個值。默認的,該值為128KB,能夠比較好的滿足大多數(shù)應(yīng)用情況。無限制的增加和減小這個值可能會帶來性能上的降低。你可以逐漸調(diào)整和分析,慢慢找出一個最優(yōu)化的結(jié)果。

flush-behind

    該選項可以直接通過命令 gluster volume set tank flush-behind 的形式進行設(shè)置,但實際上,該參數(shù)是write-behind的一個選項,如果write-behind為off,只設(shè)置flush-behind應(yīng)該是沒有意義的。

    該選項也同樣是為了提升處理大量小文件的性能。在這個選項里close()/flush()能夠被堆到后臺,允許客戶端去處理下一個請求。默認值是on。

注意:

通常情況下,protocol translator對于一個請求或者轉(zhuǎn)發(fā)的數(shù)據(jù)包有一個4MB的上限。因此,如果你在client端用了上面的write-behind(大多數(shù)會如此),并且aggregate-size大于4MB,他也不會發(fā)出大的數(shù)據(jù)包。

2       read-ahead(默認on)

gluster volume set tank read-ahead on

Read Ahead Translator (預(yù)讀)

    基于預(yù)設(shè)值,read-ahead會順序地預(yù)取一些塊。當(dāng)你的應(yīng)用忙于處理一些數(shù)據(jù)的時候,GlusterFS能夠預(yù)讀下一批等待處理的數(shù)據(jù)。這樣能夠使的讀取操作更加流暢和迅速。而且,工作起來像一個讀的集合器一樣(read-aggregator),也就是說,將大量的、零散的讀取操作集合成少量的、大一些的讀操作,這樣,減小了網(wǎng)絡(luò)和磁盤的負載。page-size 描述了塊的大小。page-count 描述了預(yù)讀塊的總數(shù)量。

注意:

這個translator比較適合于應(yīng)用在IB-verbs transport環(huán)境里。在百兆和千兆以太網(wǎng)接口、沒有read-ahead的環(huán)境下,能夠達到這種連接的最高速度。

3       io-cache(默認on)

gluster volume set tank io-cache on

IO-Cache Translator

    如果在client端被加載,能夠幫助減小server的負載(如果client正在讀一些文件,而且這個文件在兩次讀操作期間沒有被修改)。舉個例子,在編譯內(nèi)核時所需要訪問的頭文件。

type performance/io-cache

    IO緩存中繼(performance/io-cache)屬于性能調(diào)整中繼的一種,作用是緩存住已經(jīng)被讀過的數(shù)據(jù),以提高IO性能。

    IO緩存中繼可以緩存住已經(jīng)被讀過的數(shù)據(jù)。這個對于多個應(yīng)用對同一個數(shù)據(jù)多次訪問,并且如果讀的操作遠遠大于寫的操作的話是很有用的(比如,IO緩存很適合用于提供web服務(wù)的環(huán)境,大量的客戶端只會進行簡單的讀取文件的操作,只有很少一部分會去寫文件)。

    當(dāng)IO緩存中繼檢測到有寫操作的時候,它就會把相應(yīng)的文件從緩存中刪除。

   IO緩存中繼會定期的根據(jù)文件的修改時間來驗證緩存中相應(yīng)文件的一致性。驗證超時時間是可以配置的。

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

該中繼器用來提高小文件讀性能。

通過網(wǎng)絡(luò)對文件系統(tǒng)進行操作開銷很大,因此,quick-read使用glusterfs內(nèi)部get接口來一次執(zhí)行多個posix系統(tǒng)調(diào)用open/read/close,一次get調(diào)用包含:一個open調(diào)用 + 多個read調(diào)用 + 一個close調(diào)用。

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。當(dāng)文件大于該值,則使用標(biāo)準(zhǔn)的open/read/close調(diào)用。

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。原來設(shè)計不管操作文件的目的是什么,都要獲取真正的fd。重構(gòu)后,可以根據(jù)文件操作目的,如果是修改文件內(nèi)容,就在后臺打開文件并進行操作。如果僅僅是fstat等類似操作,就利用匿名fd來進行,不會等待真正的fd。這樣根據(jù)操作目的,優(yōu)化了性能。在lookup時,根據(jù)需要設(shè)置xdata key,在posix translator層就抓取文件內(nèi)容。read操作執(zhí)行到quick-read層時就返回文件內(nèi)容。

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。

網(wǎng)上有說法:

    為規(guī)避客戶端元數(shù)據(jù)不一致,把客戶端的metadata cache禁用,即配置performance.md-cache-timeout 0。

有可能正確,待深入分析,暫用默認值。

force-readdirp參數(shù):

    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)屬于性能調(diào)整中繼的一種,作用是增加IO的并發(fā)線程,以提高IO性能。

    IO線程中繼試圖增加服務(wù)器后臺進程對文件元數(shù)據(jù)讀寫I/O的處理能力。由于GlusterFS服務(wù)是單線程的,使用IO線程轉(zhuǎn)換器可以較大的提高性能。這個轉(zhuǎn)換器最好是被用于服務(wù)器端,而且是在服務(wù)器協(xié)議轉(zhuǎn)換器后面被加載。

    IO線程操作會將讀和寫操作分成不同的線程。同一時刻存在的總線程是恒定的并且是可以配置的。

之前GlusterFS Translators v1.3手冊對io-threads描述,和當(dāng)前實現(xiàn)相比可能有出入:

    AIO增加了異步(后臺)讀寫的功能。通過加載這個translator,你可以利用server的空閑時間去處理新的任務(wù)。當(dāng)server在 DMA方式處理讀或者寫操作的時候,CPU、內(nèi)存或者網(wǎng)絡(luò)并沒有被使用。這個translator可以將資源更好的利用起來去處理和增加當(dāng)前的I/O性能。

注意:

    1. io-threads translator 只有在unify之上或者在Server protocol之下才會有效果。如果在unify和namespace brick之間,因為沒有文件io的處理,所以不會有效果。

    2. 'thread-count'小于或等于你的CPU數(shù)量。

到此,關(guān)于“gluster性能調(diào)優(yōu)選項有哪些”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識,請繼續(xù)關(guān)注億速云網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI