Google 推出 nginx 上的 PageSpeed 模組

Google 推出了 nginx 上的 Page Speed 模組:「ngx_pagespeed」,想做的事情與 apache 上的 mod_pagespeed 相同,利用各種技術加速網頁的速度:

Nginx module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth. It started as a port of mod_pagespeed to Nginx, and for now the documentation links below still all point to mod_pagespeed's documentation.

看之後會不會變成 PPA 裡的一包吧...

Adobe Typekit 對 PageSpeed 的妥協

Adobe Typekit 是個收費的網頁字型服務,為了讓變更可以儘快生效,用了比較短的 cache time:

We use a short cache time for the kit JavaScript so that you can update your kit (for example, adding fonts, or changing the list of allowed domains) and have your changes live in a reasonable amount of time.

但這也造成了不少人抱怨 Google PageSpeed Tools 會扣分,而實際上也的確降低效率 (因為你不需要天天改設定):

Adobe 給了妥協的方案,你可以選擇使用更長的 cache time,從本來的 10 mins 變成 1 week:「Improved caching for kits: Opt for longer cache timeout」。

這個選項使得 Google PageSpeed Tools 不會扣分,也讓效能再更好一些。

4chan 前端頁面的調校... (cookie-free domain 的重要性)

Chris Poole (4chan 的創辦人) 寫了一篇「Small things add up」,說明針對前端頁面的調整帶來的效能改善...

YSlowPageSpeed 都反應靜態內容 (像是圖片) 是從帶有 cookie 的 domain (4chan.org) 提供服務。

所以 Chris Poole 打算把靜態內容換到一個新的網域下。

首先是選擇新的 cookie-free domain 名稱,由於不需要好記 (因為是程式在用),所以在選擇時愈短愈好,這可以讓 html 內的大小會少一些 (即使是 gzip 後還是有差),所以 Chris Poole 選擇了 4cdn.org

而更大的改善其實是在 cookie 這塊。4chan 平均的 cookie 大小大約是 1KB,這表示每一個到 4chan.org 的 request 都要送出 1KB 的 cookie 資訊。對於行動用戶來說,上傳的頻寬就這樣被浪費掉了,在搬移到新的 4cdn.org 後可以省下大量的上傳頻寬:

By migrating to the new domain, end users now save roughly 100 KB upstream per page load, which at 500 million pageviews per month adds up to 46 terabytes per month in savings for our users. I find this unreal.