本文說明如何使用以設定檔為準的設定,簡化採用程序,並提升 Cloud Storage FUSE 的效能,以利人工智慧或機器學習 (AI/ML) 工作負載。
為簡化服務、檢查點或訓練工作負載的 Cloud Storage FUSE 設定,您可以根據工作負載類型,使用 profile
欄位或 --profile
選項套用預先設定的設定檔。您可以使用這個欄位或選項,指定預先定義的 Cloud Storage FUSE 功能最佳化組合,用於快取、執行緒和緩衝區大小,確保訓練、檢查點和服務工作負載的效能,且設定過程輕鬆簡單,設定檔值分別為 aiml-training
、aiml-checkpointing
和 aiml-serving
。
注意事項
您只能在掛接作業期間設定
--profile
選項或profile
欄位。如要更新--profile
選項或profile
欄位,請重新掛接 Cloud Storage FUSE 值區。使用以設定檔為準的設定時,Cloud Storage FUSE 會將中繼資料快取容量和存留時間 (TTL) 設為無限制,也就是說,系統永遠不會從中繼資料快取中逐出項目。如果虛擬機器的記憶體不足,可能會發生記憶體不足 (OOM) 錯誤。因此,建議您先檢查記憶體容量,再套用以設定檔為準的設定。記憶體容量小於 1 TiB 的機器,較有可能發生 OOM 錯誤。
使用設定檔、偵測到的高效能機器類型、
gcsfuse
指令或 Cloud Storage FUSE 設定檔指定設定值時,方法會依下列優先順序執行 (頂端的方法會取代下方的方法):透過
gcsfuse
指令或 Cloud Storage FUSE 設定檔設定的值。在
gcsfuse
指令中,以--profiles
選項的引數形式設定的值,或 Cloud Storage FUSE 設定檔中的profile
欄位。Cloud Storage FUSE 偵測到使用高效能機器類型時,會自動設定配置值。詳情請參閱「自動設定值」。
Google Kubernetes Engine Pod 中的 Cloud Storage FUSE CSI 磁碟區不支援
profile
欄位或--profile
選項。檔案快取無法使用以設定檔為基礎的設定啟用,因為檔案快取需要使用 Cloud Storage FUSE 設定欄位和 Cloud Storage FUSE CLI 選項,這些選項無法一般化。如要啟用檔案快取功能,以提供服務、訓練或檢查點工作負載,您必須明確設定檔案快取選項或欄位。
為訓練工作負載套用以設定檔為準的設定
訓練專用設定檔可針對大型資料集的高輸送量讀取作業,最佳化效能,並防止 Cloud GPU 和 Cloud TPU 硬體等待資料。
如要套用訓練專屬設定檔,請使用 Cloud Storage FUSE 設定檔指定 profile=aiml-training
,或使用 Cloud Storage FUSE CLI 指定 --profile=aiml-training
。然後套用下列設定:
# Create implicit directories locally when accessed:
- implicit-dirs
# Disable caching for lookups of files or directories that don't exist:
- metadata-cache:negative-ttl-secs:0
# Keep cached metadata (file attributes, types) indefinitely time-wise:
- metadata-cache:ttl-secs:-1
# Allow unlimited size for the file attribute (stat) cache:
- metadata-cache:stat-cache-max-size-mb:-1
# Allow unlimited size for the file/directory type cache:
- metadata-cache:type-cache-max-size-mb:-1
為檢查點工作負載套用以設定檔為準的設定
檢查點專用設定檔可大幅縮短儲存數十億位元組檢查點的時間,盡量減少訓練暫停次數,進而提升大型檔案的高輸送量寫入效能。
如要套用訓練專屬設定檔,請使用 Cloud Storage FUSE 設定檔指定 profile=aiml-checkpointing
,或使用 Cloud Storage FUSE CLI 指定 --profile=aiml-checkpointing
。然後套用下列設定:
# Create implicit directories locally when accessed:
- implicit-dirs
# Disable caching for lookups of files/dirs that don't exist:
- metadata-cache:negative-ttl-secs:0
# Keep cached metadata (file attributes, types) indefinitely time-wise:
- metadata-cache:ttl-secs:-1
# Allow unlimited size for the file attribute (stat) cache:
- metadata-cache:stat-cache-max-size-mb:-1
# Allow unlimited size for the file/directory type cache:
- metadata-cache:type-cache-max-size-mb:-1
# Cache the entire file when any part is read sequentially:
- file-cache:cache-file-for-range-read:true
# Allow renaming directories with a lot of files in non-HNS buckets.
- file-system:rename-dir-limit:200000
為供應工作負載套用以設定檔為準的設定
Serving 可改善資料存取和快取機制,進而提升服務工作負載的效能。
如要套用訓練專屬設定檔,請使用 Cloud Storage FUSE 設定檔指定 profile=aiml-serving
,或使用 Cloud Storage FUSE CLI 指定 --profile=aiml-serving
。然後套用下列設定:
# Create implicit directories locally when accessed:
- implicit-dirs
# Disable caching for lookups of files/dirs that don't exist:
- metadata-cache:negative-ttl-secs:0
# Keep cached metadata (file attributes, types) indefinitely time-wise:
- metadata-cache:ttl-secs:-1
# Allow unlimited size for the file attribute (stat) cache:
- metadata-cache:stat-cache-max-size-mb:-1
# Allow unlimited size for the file/directory type cache:
- metadata-cache:type-cache-max-size-mb:-1
# Cache the entire file when any part is read sequentially:
- file-cache:cache-file-for-range-read:true
# Enable kernel-list-cache to make listing faster as this is a readonly file system hierarchy.
- file-system:kernel-list-cache-ttl-secs:-1