Skip to content
所有文章 ‹ Part 07 of 18 · Cache 不是方塊,是一條鏈
工程 · 2 min read

Akamai property:一份 edge 設定

Akamai property 就是一份 edge 設定:hostname、origin、rule tree、CP code 和版本,以及裡面跟這次 cache 問題有關的三條規則。

Property 是一份 Akamai 設定。它決定 edge 怎麼送出檔案:cache 規則、origin 路由、header 修改和安全設定。

我們用的 CDN 是 Akamai。要知道 edge 怎麼處理一個檔案,第一步是讀懂 property。

Property Hostname:cdn.example.com(主要) Hostname:old.example.net(已淘汰) Origin:origin.example.com Rule tree:cache、header、路由 CP code:計費標籤
一個 property 把 hostname、origin、rule tree 和 CP code 包成一份 edge 設定。
  • 一個 property 可以服務很多個 hostname。這些 hostname 共用同一個 origin 和同一套規則(一個 request 走過的路)。
  • Edge hostname:DNS 指過去的 Akamai 網域,結尾是 .akamaized.net。使用者在網址列看不到它。
  • CP code(Content Provider code):Akamai 用它計費、出報表和監控。每個 property 都要有一個。
  • Rule tree:所有行為的集合,例如 TTL、header 注入和 path matching。CLI 和網頁後台都能查看。
  • Version:每次修改都產生新版本。正式環境只會啟用其中一個版本。

跟這個故事有關的三條規則

我讀 rule tree 時,跟這個故事有關的只有三條規則:

  1. 一條決定 TTL(三個地方都在設定 TTL)。
  2. 一條在每個送往 origin 的 request 加上 bypass header(Cache header:誰設定,誰讀取)。
  3. 一條在 html、css、js 的 request 加上 proxy header(Load balancer 怎麼選後端)。

後面整個問題,就是這三條規則和下一層對不上(兩層 cache:我原本以為的樣子)。

一份設定寫得再清楚,也只管得到自己這一層。

參考來源:Akamai: hostname buckets

延伸閱讀:Akamai 工具:purge 和 CLI、一個 request 走過的路、兩層 cache:我原本以為的樣子。或回到系列總覽。

↑↓ 移動 ↵ 開啟 esc 關閉