「638 倍」這個數字不是頁面延遲
兩個數字、兩種工作負載,而兩者量的都不是頁面延遲。638 倍講的是一次 stat,也就是在剛建立的檔案上做檔案詮釋資料查詢,EFS 對比區塊裝置。4 倍則是合成、以請求形狀設計的掃描中,stat 的彙總平均時間,對比本機磁碟區,而中位數差距其實只有 1.2 到 1.3 倍。平均值是真的,但它仍然不會告訴你哪一個請求慢。
文中引用的每一項發現都有名稱,連同背後的執行紀錄,全部放在研究 repo 裡。
量測工具:需求量固定
這裡把 WordPress 當成樣本,它代表大多數環境都有的那一類軟體:在物件儲存還不普遍之前寫的,假設有 POSIX 檔案系統,而且從自己的核心程式碼、外掛、主題到模板階層都不停地查它。把應用程式當成黑盒子,是本研究的限制條件。我改的是 task 定義、掛載拓撲、容器映像、php.ini 與 opcache,還有 proxy;我不改應用程式本身。六年前我建過這套架構的天真版本,它在這裡是背景脈絡,不是研究對象。
以下每個數字都是單一 warm request 的計數。一個 warm request 大約發出 4,300 次檔案系統 syscall,其中約 3,900 次是 stat,而在我測過的所有 php.ini 設定裡,這個地板都沒有動過(warm request syscall 普查,E0-n10)。Cold request 是另一組數字,15,400 到 16,400 次操作,不會加進 warm 的計數。
| 量測項目 | 次數 |
|---|---|
| 首頁 / 產品頁 / wp-admin,syscall 總數 | 5,157 / 5,265 / 5,140 |
| 購物車與結帳頁(含實際商品),syscall 總數 | 5,941 / 5,884 |
wp-includes(核心),檔案系統操作 | 約 103 |
wpforms-lite,檔案系統操作 | 約 1,155 |
| Elementor / WooCommerce / 主題 / ACF | 590 / 528 / 214 / 137 |
ENOENT 查找 | 約 1,600 |
端點那幾列是 syscall 總數,不是檔案系統呼叫數,所以數字高於普查;它們在內容頁與 WooCommerce 頁之間有 14 到 15% 的變動,而重複十次之間完全沒變(購物車與結帳的計數,E0-cart-checkout)。大約 1,600 次檔案系統呼叫回傳 ENOENT,也就是應用程式在問「這個檔案存不存在」。在區塊裝置上,這個問題幾乎不花成本;在網路檔案系統上,這是花了延遲卻什麼也沒學到。這陣風暴來自外掛程式碼而不是核心,是逐元件觀察到的;每個探測為什麼存在則是推論,因為我沒有把任何呼叫點追回 PHP 原始碼。
大家常建議的兩個設定,改變的是應用程式「多久問一次」,而不是「問多少」。關掉 opcache.validate_timestamps 會少掉約 700 次 open,以及在重新驗證視窗內約 1.8% 的 stat;而開啟驗證的設定,每個 revalidate_freq 視窗要付一次大約 +4,400 次 stat 的稅,預設 2 秒、調校後 60 秒(同一份普查,E0-n10)。我跑的三種設定,包括 realpath_cache 32 MB、TTL 3600 秒那一組,全都把地板留在約 3,900(PHP 設定比較,E0-first-run)。因為這筆稅每個視窗只付一次,所以在低流量網站上,攤到每個請求的效益最高。
兩個數字,兩種工作負載
每次呼叫 · 一次 stat,新建檔案
638.2×
每個請求 · 中位數
1.21× / 1.29× / 1.25×
每個請求 · 平均值
3.91× / 4.43× / 5.19×
每個請求 · p99
88.7× / 125.9× / 87.6×
每次呼叫 · 一次 stat,新建檔案
638.2×
每個請求 · 中位數
1.21× / 1.29× / 1.25×
每個請求 · 平均值
3.91× / 4.43× / 5.19×
每個請求 · p99
88.7× / 125.9× / 87.6×
Log₁₀ scale · ratio · Supplied replications
同一個比較,兩個分母。每次呼叫:638.2×,在剛建立的檔案上量測。每個請求:同一個檔案系統在接近真實的存取模式下,中位數 1.21× / 1.29× / 1.25×、平均值 3.91× / 4.43× / 5.19×、p99 88.7× / 125.9× / 87.6×(每個 replication 一個值)。對數刻度;run results/E2/20260910T163206Z-66dcff8, results/E5-formal/20261028T160106Z-dd5fce0。
Source: mikeng-io/aws-wordpress@b52192b
results/E2/20260910T163206Z-66dcff8 · results/E5-formal/20261028T160106Z-dd5fce0
Measurement definitions / Command
- 每次呼叫 · 一次 stat,新建檔案
- EC2 EFS direct TLS stat p50 / EC2 instance-store stat p50, pooled across three replications. Formula: raw numerator / raw denominator in ns, before display rounding; no ratio field exists in the pinned summary. Source JSON pointers (numerator, denominator): /tiers/ec2~1efs/stat/p50_ns; /tiers/ec2~1instance_store/stat/p50_ns.
- 每個請求 · 中位數
- EFS plain per-request summed stat time median / matched-EBS median, delta=1 s. Leaves are numerator, denominator pairs per replication in chronological order of the three eligible formal-v3 replications. Formula: raw numerator / raw denominator in ns, before display rounding; no ratio field exists in the pinned summary. Source JSON pointers (numerator, denominator): /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/median; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/median; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/median.
- 每個請求 · 平均值
- Reported amortised per-request stat-time EFS plain / EBS ratios, delta=1 s; the array is the three eligible formal-v3 replications in chronological order. Source JSON pointers (output order): /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_over_ebs; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_over_ebs; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_over_ebs.
- 每個請求 · p99
- EFS plain per-request summed stat time p99 / matched-EBS p99, delta=1 s. Leaves are numerator, denominator pairs per replication in chronological order of the three eligible formal-v3 replications. Formula: raw numerator / raw denominator in ns, before display rounding; no ratio field exists in the pinned summary. Source JSON pointers (numerator, denominator): /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/p99; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/p99; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/p99.
python3 analysis/export_figures.py 在 EFS 上做一次 stat,耗時是區塊裝置上同一個呼叫的 638 倍。但在「請求形狀」的掃描中——檔案至少放了兩分鐘,一個客戶端大約每秒對每個檔案 stat 一次——彙總 stat 時間只有本機 EBS 相同掃描的 1.2 到 1.3 倍中位數、3.9 到 5.2 倍平均值。把這兩個比值乘起來,會得到一個沒有人量過的數字,我自己早期版本的發現就做過這件事;而 per-request 的結果也沒有推翻 per-call 的結果,它只是重新界定了範圍。你可能看過被單獨引用的 638 倍,那就是那份早期草稿。這些掃描用的是合成目錄樹,不是 WordPress 的請求路徑,而且這裡沒有任何數字是照上面 3,900 次呼叫的普查放大換算的。
| 層級 | stat p50 | open+read p50 | create p50 | unlink p50 |
|---|---|---|---|---|
| Instance store | 1.3 µs | 5.2 µs | 19.7 µs | 7.5 µs |
| EBS gp3 | 1.3 µs | 5.3 µs | 19.9 µs | 7.6 µs |
| Fargate ephemeral | 1.8 µs | 5.7 µs | 21.9 µs | 11.4 µs |
| EC2 + EFS,Elastic throughput / One Zone / General Purpose / NFS 4.1 | 814 µs | 904 µs | 7.34 ms | 3.00 ms |
| Fargate + EFS,同設定 | 778 µs | 679 µs | 6.99 ms | 2.93 ms |
三個重複實驗、每組三個獨立部署彙整而來(per-call 層級矩陣,E2-block-backed)。文中所有比值都以未四捨五入的彙總 p50 計算,所以從這張四捨五入後的表重算,會得到 626 倍而不是 638 倍。區塊儲存底層在這裡分不出差異:instance store 對 EBS 在 stat 上是 1.00 倍、open+read 1.03 倍、create 1.01 倍、unlink 1.02 倍,p99 也跟著同樣走勢。跨過那條界線就完全是另一回事:stat 638 倍、unlink 399 倍、create 373 倍、open+read 174 倍。詮釋資料操作受到的影響遠大於小檔案的 open+read,而這正是問題的形狀:伺服器支撐的層級,在做這個讀取時遠比回答「檔案狀態」時來得好。這不是吞吐量測試,我也不會從中讀出任何關於搬移位元組的結論。
我的推論是問題在協定,不在硬體,而且這不是一個獨立驗證過的結果:沒有任何一次執行只變動協定,所以這個推論建立在三個區塊底層結果一致、以及六種 EFS 設定結果一致之上。四個候選變因量起來都在噪音範圍內,對比重複實驗之間 1.49 到 1.82 倍的地板:透過本機 efs-proxy 的傳輸加密(依掛載路徑不同,1.00 到 1.10 倍)、掛載拓撲(1.00 到 1.09 倍,而 ECS 代管路徑叫用的是同一個 mount helper,和手寫的沒兩樣)、EFS 路徑上 EC2 對 Fargate(stat 1.06 倍、create 1.01 倍),以及六種 EFS 設定,stat p50 從 683 到 786 µs,差距 1.15 倍,各設定對區塊組的倍數則落在 357 到 630 倍。彙總的 638 倍是標題比值;357 到 630 倍才是每個個別設定實際做到的範圍。這些都是同一件量測工具上的 per-call 發現,沒有任何一項被證明是尾部延遲的變因。
有兩組收集必須分開看:上面 Fargate ephemeral 那一列來自層級矩陣,而另一組獨立收集量了三個 Fargate task、4,020 個樣本(Fargate ephemeral 發現,E3-fargate-ephemeral)。再分開來看,EFS 是每個 task 掛載一次,不是每台主機掛載一次。同一台 t4g.small 上的兩個 task,task 定義與檔案系統都相同,卻產生兩個 NFS4 客戶端掛載、兩個 efs-proxy 行程,以及各自獨立的屬性快取(掛載隔離發現,E1-mount-per-task)。同機共置的 task 預設不會幫彼此暖快取,這也是為什麼一個 task 能確定在本機持有的程式碼,只有它自己寫在本機的那些。刻意共用主機掛載的作法我從未量測,因此不做任何一方的結論。
檔案年齡、快取歷史與計時器
EFS
7.173 s / 6.502 s / 7.122 s
FSx OpenZFS
3.385 s / 3.408 s / 3.416 s
FSx ONTAP
0.9938 s / 0.9682 s / 0.9875 s
EFS
7.173 s / 6.502 s / 7.122 s
FSx OpenZFS
3.385 s / 3.408 s / 3.416 s
FSx ONTAP
0.9938 s / 0.9682 s / 0.9875 s
Linear scale · s · Supplied replications
在每個 tier 建立測試檔案所需的秒數,每個 replication 一點:EFS 為 7.173 s / 6.502 s / 7.122 s,對比 ONTAP 的 0.9938 s / 0.9682 s / 0.9875 s。下一張圖說明這對 benchmark 意味著什麼。Run results/E2/20261015T000959Z-85382cc。
Source: mikeng-io/aws-wordpress@b52192b
results/E2/20261015T000959Z-85382cc
Measurement definitions / Command
- EFS
- duration of the 1,000-file create pass, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/efs/replications/rep-1/create_pass_s; /tiers/efs/replications/rep-2/create_pass_s; /tiers/efs/replications/rep-3/create_pass_s.
- FSx OpenZFS
- duration of the 1,000-file create pass, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/fsx_openzfs/replications/rep-1/create_pass_s; /tiers/fsx_openzfs/replications/rep-2/create_pass_s; /tiers/fsx_openzfs/replications/rep-3/create_pass_s.
- FSx ONTAP
- duration of the 1,000-file create pass, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/fsx_ontap/replications/rep-1/create_pass_s; /tiers/fsx_ontap/replications/rep-2/create_pass_s; /tiers/fsx_ontap/replications/rep-3/create_pass_s.
python3 analysis/export_figures.py per-call benchmark 會先建立一組檔案,幾秒後再對它 stat;工具跑一輪就是一次 create 掃描加一次 stat 掃描。FSx 那組揭露了這到底在量什麼:在每個 NFS 層級上,快的那些 stat 形成一段連續的尾端,對應最近建立的檔案,並在某個固定年齡結束(伺服器支撐層級矩陣,E2-server-backed)。
| 層級(固定設定) | 建立檔案集耗時 | 快速回答的 stat | 邊界年齡 |
|---|---|---|---|
| EFS,Elastic / One Zone / General Purpose / NFS 4.1 | 6.5 到 7.2 秒 | 31 到 38% | 2.30 到 2.48 秒 |
| FSx for OpenZFS,Single-AZ 64 GiB,128 MBps | 3.4 秒 | 68 到 70% | 2.91 到 2.92 秒 |
| FSx for ONTAP,Single-AZ gen-1 1024 GiB,128 MBps | 1.0 秒 | 100% | 整個掃描都在視窗內 |
create 掃描越快,stat 掃描開始時就有越多檔案還在有效視窗內,所以越多 stat 在本機就被回答。ONTAP 對 1,000 次 stat 只送出 8 個 GETATTR RPC,而它同組的 1.7 µs p50 是快取命中,不是一次往返。這屬於它 Single-AZ gen-1、1024 GiB、128 MBps 的那個配置點,不是 ONTAP 這個服務的性質。
這個邊界是 Linux 客戶端的 acregmin,預設 3 秒(nfs(5)),退避邏輯是從 kernel v6.1 的 fs/nfs/inode.c 讀來的,不是從這些執行推論出來的。每次重新驗證若檔案未變,逾時就加倍,3 秒、6 秒、12 秒、24 秒、48 秒、60 秒,上限是 acregmax,任何變更都會重置。所以超過 60 秒的檔案並不是產生 miss 的原因:計時器跟著這個客戶端上 inode 的重新驗證歷史走,這也是為什麼一個一年前寫的 PHP 檔,在 cold mount 上第一次被查找時,會像全新檔案一樣從 3 秒起算。
這樣就得出兩種不同的 miss 工作負載。第一次觸及 cold 客戶端——task 啟動、scale-out 或部署之後——要付一次 LOOKUP compound,在 EFS 各組量到是重新驗證成本的 2.8 到 4.4 倍,OpenZFS 是 1.04 到 1.08 倍(其中一次重複是 0.72 倍),ONTAP 是 1.08 到 1.44 倍(首觸與重新驗證比較,E5-attribute-cache)。那個大幅溢價是 EFS 的觀察,不是 NFS 的性質。穩態下的重新驗證,每個檔案大約每 acregmax 付一次 GETATTR:EFS 263 到 357 µs,OpenZFS 69 到 98 µs,ONTAP 109 到 111 µs。這修正了我自己先前的一個數字,也就是 per-call benchmark 得到的 827 µs EFS miss 成本,它在這裡重現不出來;這些數字是它的 0.32 到 0.43 倍,因為那是另一種 miss。
計時器能不能乾脆停掉,是協定能力問題。EFS 不能授予 NFSv4 delegation,所以 OPEN 永遠回傳 OPEN_DELEGATE_NONE(EFS 限制);FSx for OpenZFS 可以授予 read delegation(OpenZFS 效能指南),而執行中在它上面數到 1,000 次 DELEGRETURN,EFS 與 ONTAP 都是零。持有 delegation 的客戶端會在本機回答 stat,計時器根本不會啟動。這是「有能力持有 delegation」,不是說每個 OpenZFS 存取都持有。
這套機制是文件與 kernel 支援的推論,和量到的邊界相符;真正能定案的做法是改 actimeo,然後看邊界跟著移動。用 20 µs 門檻來判定一次 stat「由客戶端記憶體回答」,是事後描述的規則。而缺陷在於指標的範圍,不在 benchmark 作者:對剛建立的檔案做 per-call 量測,等於在不同快取生命週期的位置上比較各層級——EFS 只有 31 到 38%、OpenZFS 68 到 70% 的 stat 落在視窗內,ONTAP 則是全部。它量到的是取決於建立歷史的命中與未命中混合物,不是一個均勻暖好的快取。
心跳:到期前幾乎打平
- EFS · 每個請求的 stat 時間 ×3
- EBS 對照組 · 每個請求的 stat 時間 ×3
Log₁₀ scale · ms · Ordered positions · straight segments join supplied observations
每個請求加總的 stat 時間,從中位數到最大值排成階梯,EFS 與 EBS 對照組各三個 replication,同一對數刻度。對照組保持平直;EFS 在尾部離開它。間距是次序性的,不是時間軸。Run results/E5-formal/20261028T160106Z-dd5fce0。
Source: mikeng-io/aws-wordpress@b52192b
results/E5-formal/20261028T160106Z-dd5fce0
Measurement definitions / Command
- EFS · 每個請求的 stat 時間
- Per-request summed stat time on EFS plain, delta=1 s, eligible formal-v3 replication 1 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/amortised; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/efs_per_request_ns/max.
- EFS · 每個請求的 stat 時間
- Per-request summed stat time on EFS plain, delta=1 s, eligible formal-v3 replication 2 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/amortised; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/efs_per_request_ns/max.
- EFS · 每個請求的 stat 時間
- Per-request summed stat time on EFS plain, delta=1 s, eligible formal-v3 replication 3 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/median; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/amortised; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/p99; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/efs_per_request_ns/max.
- EBS 對照組 · 每個請求的 stat 時間
- Per-request summed stat time on the matched-EBS control, delta=1 s, eligible formal-v3 replication 1 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/median; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/amortised; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/p99; /predictions/9/per_replication/20261028T103017Z-342d6b4~1rep-1/ebs_per_request_ns/max.
- EBS 對照組 · 每個請求的 stat 時間
- Per-request summed stat time on the matched-EBS control, delta=1 s, eligible formal-v3 replication 2 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/median; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/amortised; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/p99; /predictions/9/per_replication/20261028T125412Z-f6659e0~1rep-1/ebs_per_request_ns/max.
- EBS 對照組 · 每個請求的 stat 時間
- Per-request summed stat time on the matched-EBS control, delta=1 s, eligible formal-v3 replication 3 in chronological order. Percentile ladder, element order median, mean (amortised), p99, max; every element ns/1e6 (milliseconds) at four significant figures, exact ns in raw. Milliseconds because a request's summed stat time runs from ~1.5 ms to ~260 ms. Source JSON pointers (output order): /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/median; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/amortised; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/p99; /predictions/9/per_replication/20261028T160106Z-dd5fce0~1rep-1/ebs_per_request_ns/max.
python3 analysis/export_figures.py 第二件工具會在量測前至少 120 秒,從另一個掛載點先播種檔案,所以每個量測掛載點遇到它們時都是 cold 的。一個客戶端每 0.1 秒、每 1 秒或每 10 秒對每個檔案 stat 一次,暖機 300 秒、量測 600 秒。Miss 是從 mountstats 的 RPC 計數器判定,而不是用延遲門檻,因為計數器會告訴你呼叫有沒有上網路,計時器只告訴你花多久。那些計數器算的是 RPC 操作,跟檔案 miss 事件不是同一個量,所以我引用比率,而不把它換算成命中百分比。
在一秒一次的節奏下,EFS 每筆正向 stat 約 0.017 次 RPC 操作;0.1 秒時是 0.0017,10 秒時是 0.16。所以在現實節奏下,網路活動很低,客戶端幾乎全靠記憶體回答。這換來的中位請求是大約 2 ms 的彙總 stat 時間,三次重複分別是 2.14 / 2.09 / 1.88 ms,對比 EBS 的 1.77 / 1.63 / 1.50 ms。平均值是 3.91 倍、4.43 倍、5.19 倍。p99 是 151 到 217 ms,最大值 233 到 262 ms(節奏發現,E5-attribute-cache)。這些全是 EC2 純主機掛載組的彙總 stat 時間,不是端到端頁面延遲,也不是 WordPress 路徑。
集中度讓這個形狀變得可讀。前 5% 的請求承載了 82.9%、89.4%、82.5% 的 NFS RPC 操作。在第一次重複的原始逐請求計時中(我是人工檢視,不是靠提交的推導程式),慢於 20 ms 的請求在 EFS 上以 56 到 59 秒的間隔成群出現,EBS 控制組則從未出現。那次檢視只涵蓋一次重複。它與 60 秒視窗、以及「一起編譯的檔案一起到期」相符,兩者都還是推論;資料中沒有任何東西能把同步到期和 burst 出現的其他原因分開。
Lustre 是「屬性計時器買不到什麼」的對照組:它慢呼叫的比例在每個間隔都維持在 0.157 到 0.335%,對比實驗設下的 1% 上限;同時段的 EBS 控制組是 0.0000 到 0.0243%,配置為 Scratch 2、1200 GiB、版本 2.15。這是延遲觀察,不是鎖定狀態的證明。
平均值是最容易讀錯的地方。它量到的彙總 stat 時間是真實工作,也是估算總等待時間模型時站得住腳的輸入,只要那個模型談的是總量;它做不到的是描述典型請求(大約 2 ms),或描述集中的停頓(151 到 217 ms)。這份彙總等待會不會變成機群成本,取決於並行度、worker 佔用率與你的延遲目標,而這三件事本研究都沒量。
啟動類型決定你能選什麼
EFS
33.5% / 37.8% / 30.9%
FSx OpenZFS
69.6% / 68.9% / 67.9%
FSx ONTAP
100% / 100% / 100%
EFS
33.5% / 37.8% / 30.9%
FSx OpenZFS
69.6% / 68.9% / 67.9%
FSx ONTAP
100% / 100% / 100%
Linear scale · percent · Supplied replications
由 client memory 直接回答的 stat 佔比,依據正文說明、並標明是事後回看才定下的描述性規則:EFS 33.5% / 37.8% / 30.9%,ONTAP 100% / 100% / 100%。建立檔案最快的 tier 看起來最快,因為它的檔案仍在 attribute-cache 窗口內。Run results/E2/20261015T000959Z-85382cc。
Source: mikeng-io/aws-wordpress@b52192b
results/E2/20261015T000959Z-85382cc
Measurement definitions / Command
- EFS
- share of the 1,000 stat calls answered in client memory under the descriptive, post-hoc 20 us rule (stat latency < 20 us = answered in client memory), declared after inspecting the run's samples and not pre-registered; every absolute threshold in the 15-30 us sensitivity range yields identical shares, so the value is not tuned. It disagrees with the repo's registered E3-gated k-means clustering rule, which leaves ONTAP and Lustre undefined and is kept as per-rep diagnostics (registered_rule) in the derived file, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/efs/replications/rep-1/answered_local_share; /tiers/efs/replications/rep-2/answered_local_share; /tiers/efs/replications/rep-3/answered_local_share.
- FSx OpenZFS
- share of the 1,000 stat calls answered in client memory under the descriptive, post-hoc 20 us rule (stat latency < 20 us = answered in client memory), declared after inspecting the run's samples and not pre-registered; every absolute threshold in the 15-30 us sensitivity range yields identical shares, so the value is not tuned. It disagrees with the repo's registered E3-gated k-means clustering rule, which leaves ONTAP and Lustre undefined and is kept as per-rep diagnostics (registered_rule) in the derived file, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/fsx_openzfs/replications/rep-1/answered_local_share; /tiers/fsx_openzfs/replications/rep-2/answered_local_share; /tiers/fsx_openzfs/replications/rep-3/answered_local_share.
- FSx ONTAP
- share of the 1,000 stat calls answered in client memory under the descriptive, post-hoc 20 us rule (stat latency < 20 us = answered in client memory), declared after inspecting the run's samples and not pre-registered; every absolute threshold in the 15-30 us sensitivity range yields identical shares, so the value is not tuned. It disagrees with the repo's registered E3-gated k-means clustering rule, which leaves ONTAP and Lustre undefined and is kept as per-rep diagnostics (registered_rule) in the derived file, per replication; derived by analysis/e2_cache_window.py from the pinned FSx run's raw CSVs; the array is the three replications. Source JSON pointers (output order): /tiers/fsx_ontap/replications/rep-1/answered_local_share; /tiers/fsx_ontap/replications/rep-2/answered_local_share; /tiers/fsx_ontap/replications/rep-3/answered_local_share.
python3 analysis/export_figures.py 下面這張表編碼的規則:你能用哪些層級,在你的啟動類型就決定了,任何效能問題都還來不及問。
| 層級 | 在 EC2 上 | 在 Fargate 上 | 決定因素 |
|---|---|---|---|
| EFS | ECS 代管 volume,或主機掛載後 bind | ECS 代管 volume,平台 1.4.0+ | mount helper、port 2049 |
| EBS gp3 | ECS volume 或 root volume | AWS 文件列為 volume 選項 | 沒有實測的 Fargate 組 |
| FSx for Lustre | 主機掛載後 bind | 不支援 | 不是 ECS volume 類型 |
| FSx for OpenZFS | 主機掛載後 bind | 不支援 | 不是 ECS volume 類型 |
| FSx for ONTAP | task 定義 volume、原生 NFS | 只有 S3 Access Points,S3 API 不是 POSIX | 原生 NFS 得用 EC2 |
| S3 Access Points | S3 API | 可達,但不是掛載 | 物件語意,不是 POSIX |
上表的可用性是文件記載,不是我量出來的(ECS data volumes)。FUSE 層級缺席是平台原因,不是測試結果:它們需要 CAP_SYS_ADMIN,而 Fargate 只允許加一個 Linux capability,就是 CAP_SYS_PTRACE(Fargate task 注意事項)。研究中每一項 FUSE 量測都在 EC2 上做,沒有任何一項在 Fargate 上嘗試過。
| 層級 | 固定設定 |
|---|---|
| EFS | Elastic throughput、One Zone、General Purpose、傳輸加密開啟、NFS 4.1 |
| FSx for OpenZFS | Single-AZ、64 GiB、128 MBps provisioned(不是 64 MBps 的地板)、壓縮 NONE |
| FSx for ONTAP | Single-AZ gen-1、1024 GiB、128 MBps、無快照、儲存效率關閉 |
| FSx for Lustre | Scratch 2、1200 GiB、版本 2.15、以 -o flock 掛載 |
每一列是一個配置點,不是整個服務的延遲性質。Provisioned throughput 決定 FSx 檔案伺服器記憶體中詮釋資料快取的大小,所以 OpenZFS 與 ONTAP 的數字有一部分就是這個上限;Scratch 2 不是 Persistent,這裡沒有任何東西描述 Persistent 部署類型。加密的 EFS 那一列屬於 per-call 實驗;上面節奏的結果來自純主機掛載組。
量了三個檔案系統,而誠實的結論比「淘汰」窄得多。JuiceFS 達到 stat p50 104.6 µs,create 29.2 ms,主要由把檔案本體寫到 S3 所支配;它登記要回答的問題是「物件儲存支撐的使用者空間檔案系統,能不能在詮釋資料上快 EFS 一個數量級」,而它以比 EFS cache-miss p50 快 7.5 倍作收,結果是未定論,不是勝也不是敗(FUSE 結果,E2-fuse)。SeaweedFS 達到 stat 20.2 µs、create 2.28 ms,通過 11 項一致性檢查中的 11 項,這讓它在 EC2 上成為本研究沒有對應用程式實測過的真實選項。Mountpoint for S3 在每次重複中,11 項單節點檢查都失敗 8 項,包括 rename 不會覆蓋、mtime 不會前進,所以它沒有延遲表:語意上的失敗不該被平均進效能排名裡。三者共同的特性是都不能用 Fargate,這是平台排除,不是對軟體的評價。
注水(hydration)消除了到期事件
- EFS · stat
- 已 hydrate 的本機目錄樹 · stat
Log₁₀ scale · us · Ordered positions · straight segments join supplied observations
EFS 與在啟動時 hydrate 到 task-local storage 的程式碼樹,兩者的 stat 延遲,p50 到 p99,同一對數刻度。hydration 在啟動時要付多少代價,正文已經說明。間距是次序性的。Run results/E4/20261029T091909Z-842d596。
Source: mikeng-io/aws-wordpress@b52192b
results/E4/20261029T091909Z-842d596
Measurement definitions / Command
- EFS · stat
- EFS stat percentile ladder, pooled across three deployments; element order p50, p95, p99; every element ns/1000 at four significant figures, exact ns in raw. Source JSON pointers (output order): /pooled/efs/stat/p50_ns; /pooled/efs/stat/p95_ns; /pooled/efs/stat/p99_ns.
- 已 hydrate 的本機目錄樹 · stat
- Hydrated code-tree stat percentile ladder, pooled across three deployments; element order p50, p95, p99; every element ns/1000 at four significant figures, exact ns in raw. Source JSON pointers (output order): /pooled/hydrated/stat/p50_ns; /pooled/hydrated/stat/p95_ns; /pooled/hydrated/stat/p99_ns.
python3 analysis/export_figures.py 啟動時把唯讀程式碼樹從 EFS 注水到 task 自己的 ephemeral 儲存,並不會消除檔案系統存取;它消除的是那條讀取路徑上的遠端屬性快取到期。三個獨立部署,Fargate 1.4.0、ARM64、0.5 vCPU 與 1 GiB、20 GiB ephemeral(注水發現,E4-hydration):
| 量測項目 | 在 EFS 上 | 注水後 | 比值 |
|---|---|---|---|
stat p50 | 1.3884 ms | 3.061 µs | 0.00220 |
open_read p50 | 2.7109 ms | 11.667 µs | 0.00430 |
| Tar 解壓縮,27,412,480 bytes | n/a | 0.218 / 0.444 / 0.429 秒 | 相同位元組下 2.04 倍差距 |
| 第一次 log 到 benchmark 開始,兩組之間 | n/a | 0.051 / 0.192 / 0.265 秒 | 有混淆,見下文 |
上面那個 3.061 µs 與 0.00220 是實驗回報的摘要值,逐操作量在 task 本機儲存上。每次重複都成立的是它們背後的驗收門檻:注水後不得比 EFS 的 stat 成本差過十分之一,open_read 成本不得差過五分之一;逐次執行的結果在摘要值附近變動,而不是一位數一位數地重現。本機分布是單峰的,stat p99 為 6.023 µs,ENOENT p99 為 22.6 µs,重點就在這裡:本機檔案系統沒有重新驗證計時器,所以沒有事件會到期。
我預測注水會讓 benchmark 至少晚 0.5 秒才開始,這個預測錯在便宜的方向。解壓縮本身花了 0.218 到 0.444 秒,而兩組之間第一次 log 到 benchmark 的差值落在 0.051 到 0.265 秒,其中包含遠端一致性寫入與排程噪音,所以我不會把那個差值記成注水的因果開銷,也不會當成完整啟動時間。
這不是一個量到的請求延遲結果。注水後的程式碼樹從未在節奏工具的負載下跑過,所以 151 到 217 ms 的停頓並未被證明會消失,兩者之間的連結是從兩個獨立結果推出的推論。它也很特定:唯讀程式碼樹、27 MB 而非正式安裝、沒有 write-back adapter、沒有機群更新或失效行為、沒有端到端延遲量測。它處理的是某一條路徑上的到期事件。它沒有讓可變的應用程式狀態變成本機,而且它是眾多選項中一個有界的選項,不是唯一還站著的選項。
稽核筆記:這份研究能確立什麼
| 研究問的問題 | 結果 |
|---|---|
每個伺服器支撐的層級,在 stat 上都會比區塊組慢 10 倍以上嗎? | 機械性地被否證:表面上的反例是客戶端快取命中而不是伺服器查找,所以這個否證本身沒有資訊量 |
| 第一次觸及比重新驗證更貴嗎? | 在 EFS 上是,2.8 到 4.4 倍;登記的 1.0 到 3.0 區間被兩邊否證——EFS 各組高於它,一次 OpenZFS 重複以 0.72 倍低於它 |
| 一個請求會付到 per-call 的比值嗎? | 不會:平均值落在其支持上界內,且遠低於否證門檻(節奏發現,E5-attribute-cache) |
| 注水成本會低於我在 benchmark 開始前預測的 0.5 秒地板嗎? | 不會;解壓縮花了 0.218 到 0.444 秒,所以預測被否證,而兩組之間的差值混淆太深,無法替代它 |
| 注水能消除請求停頓嗎? | 未證明;從未在節奏工具下跑過 |
預測都在執行前登記,在設計允許時做三次重複,每個服務都在單一配置點上量測。網路活動以 RPC 計數器為依據,wall-clock 延遲永遠不會成為「呼叫有沒有離開客戶端」這類主張的依據。20 µs 的快取命中門檻、只做一次重複的群集檢視、以及同步到期的解釋,在出現之處都標為事後推論。沒有量測端到端請求延遲,沒有節奏相符的 Fargate 執行,沒有測試刻意共用的主機掛載,購物車與結帳流量只有計數,沒有端到端埋點。
星期一:決策清單
- 在比較任何儲存層級之前,先數一個 warm request 的檔案系統需求。你沒有量到的需求數字,沒辦法用來估算容量。
- 先確認你的啟動類型到底能掛哪些東西,因為對你不存在的選項,不是一個比較慢的選項。
- 先測應用程式需要的 POSIX 語意。
rename與mtime正是物件儲存掛載會失敗的地方,而正確性失敗是排除條件,不是排名。 - 用自己的節奏量,用 RPC 計數器而不是碼錶,因為新檔矩陣和請求形狀的掃描回答的是不同問題。
- 每次重複引用數字,都要連配置點一起講。Single-AZ OpenZFS 128 MBps 和 Single-AZ gen-1 ONTAP 1024 GiB 是設定,不是服務本身。
- 如果你需求中的程式碼那一側是唯讀的,可以考慮注水到 task 本機儲存,並同時量解壓縮成本與逐操作結果。如果不是唯讀,這個選項就不適用於你。
對這個工作負載來說,儲存層級決定尾部的形狀,也同樣決定平均值;而消除到期事件的干預,是改變程式碼從哪裡被讀取。平均懲罰仍然存在,任何計算總 stat 等待的帳都該算進去;它從來沒描述的是單一請求,而使用者記得的請求,是 p99 的那些。