ondrej 的 nginx PPA 支援 SPDY + HTTP/2 了...

直接跑去問 ondrej 有沒有意願把 CloudFlare 提供的 patch 放進去,結果也很順利的就更新了:「nginx 1.11.1 (security release) and CloudFlare SPDY + HTTP2 patch」(先前標題還打錯... XDDD)。

所以現在在 nginx PPA 裡的版本同時支援 SPDYHTTP/2 了,可以參考「SSL Server Test: blog.gslin.org (Powered by Qualys SSL Labs)」。

可以看到舊的行動平台都透過 SPDY 連上來了,速度應該會比之前順不少...

CloudFlare 提供的 SPDY + HTTP/2 patch 可以在 nginx 1.11 上面跑了...

SPDY 對行動裝置還是很重要,尤其是 Android 裝置在 5.0 之後才有支援 HTTP/2,但在 3.0 之後就有支援 SPDY,也就是超過一半的 Android 用戶只有 SPDY 但沒有 HTTP/2 能力:

查資料的時候發現當初 CloudFlare 提供的 SPDY + HTTP/2 patch 本來只能對 nginx 1.9.7 更新 (參考之前寫的「CloudFlare 放出可以同時支援 HTTP/2 與 SPDY 的 nginx patch」),後來有人再更新到 1.9.15,而在留言的地方也可以看到有人回報在 1.11.0 上面可以跑:「Update NGINX SPDY patch for 1.9.15」:

Works fine against nginx 1.11.0 and OpenSSL 1.0.2h (with ChaCha20 patch). I am building nginx as an Ubuntu 16.04 package.

而最新版 1.11.1 只有一個安全性更新,應該也可以跑... 來找看看會不會有人包 ppa 出來。

Google Chrome 51 出版,SPDY 被拔掉,HTTP/2 只支援 ALPN

Google Chrome 剛剛出了 51 版:「Stable Channel Update」。

除了界面的改變外,對效能最主要的改變就是 SPDY 被拔掉,HTTP/2 的 NPN 支援也被拔掉:「Transitioning from SPDY to HTTP/2」:

To better align with Chrome's release cycle, SPDY and NPN support will be removed with the release of Chrome 51.

又有一波 migrate 功夫要做了...

Dropbox 從 SPDY 切換到 HTTP/2 發現的現象

Dropbox 將本來的 SPDY 切換到 HTTP/2 後整理了不少資料:「Enabling HTTP/2 for Dropbox web services: experiences and observations」。

大多數都是效能的改善,但「Increased latency for POST requests.」這段頗有趣的,找出了 nginx 的 bug:

POST 的 latency 大約增加了 50%,而實際追蹤問題發現是 nginx 中 SETTINGS_INITIAL_WINDOW_SIZE 預設值的問題,然後提出 patch 改善:「[nginx] HTTP/2: rewritten handling of request body.」:

There is a small issue with setting `SETTINGS_INITIAL_WINDOW_SIZE` to 0: now when client tries to POST data it needs to wait for an additional RTT(between `send HEADERS` and `recv WINDOW_UPDATE`) to start sending data.

CloudFlare 放出可以同時支援 HTTP/2 與 SPDY 的 nginx patch

CloudFlare 放出可以同時支援 HTTP/2SPDYnginx patch:「Open sourcing our NGINX HTTP/2 + SPDY code」。

不過 patch 的版本有點舊:

We've extracted our changes and they are available as a patch here. This patch should build cleanly against NGINX 1.9.7.

如同原文下面 comment 提到的問題,nginx 1.9.7 太舊了 (2015/11/17 放出的版本),到現在有出了不少安全性更新,以及對 HTTP/2 的 bugfix。應該會需要再等官方把新版的 patch 拿出來改之後才能用。

WordPress.com 將全面提供 HTTPS 服務

WordPress.com 宣佈將全面提供 HTTPS 服務:「HTTPS Everywhere: Encryption for All WordPress.com Sites」。

其中 wordpress.com 應該是買 wildcard SSL certificate 來做,而 custom domain 的部份將會透過 Let's Encrypt 來做:

The Let’s Encrypt project gave us an efficient and automated way to provide SSL certificates for a large number of domains. We launched the first batch of certificates in January 2016 and immediately started working with Let’s Encrypt to make the process smoother for our massive and growing list of domains.

這包括了對 SPDY + HTTP/2 的支援,使得 HTTPS 的速度不比 HTTP 差 (甚至更快)。

Chrome 宣佈 SPDY 的退役,只支援 HTTP/2 (ALPN)

Google Chrome 將在今年 (2016) 的五月 15 日讓 SPDYHTTP/2 NPN 退役:「Transitioning from SPDY to HTTP/2」。

主要是依據 Google Chrome 的流量數據,HTTP/2 大約佔了 25% 的流量 (目前檯面上大網站的 HTTPS 都支援了),而 SPDY 只剩下 5% 的量:

Over 25% of resources in Chrome are currently served over HTTP/2, compared to less than 5% over SPDY.

另外一個是對 HTTP/2 NPN 的支援將同一個時間關閉,只支援 ALPN

At the same time, Chrome will stop supporting the TLS protocol extension NPN, which allows servers to negotiate SPDY and HTTP/2 connections with clients. NPN has been superseded by the TLS extension ALPN, published by the IETF in 2014. ALPN is already used 99% of the time to negotiate HTTP/2 with Chrome, and the remaining servers can gain ALPN support by upgrading their SSL library.

所以還有四個月的時間...

CloudFlare 有計劃要放出對 nginx 的 HTTP/2 + SPDY patch

nginx 在 1.9.5 後移除了對 SPDY 的支援,只支援 HTTP/2,剛剛找其他資料的時候在「HTTP/2 is here! Goodbye SPDY? Not quite yet」這邊發現 CloudFlare 的人有打算放 patch,讓 nginx 可以同時支援 HTTP/2 與 SPDY:

同時也可以看到有人抱怨 caniuse 上面的資料與實際使用的情況有蠻大的差距,拿 caniuse 來說服人不太準確。

另外也發現我自己的 blog 有時候 HTTP/2 不會啟用 (透過「HTTP/2 and SPDY indicator」觀察),不知道是什麼原因,也許 nginx 的時候還是有 bug?

HTTP/2 測試工具

CloudFlare 整理了一篇「Tools for debugging, testing and using HTTP/2」,說明有哪些測試工具可以用...

Screen-Shot-2015-12-04-at-10-46-21

從最簡單的「HTTP/2 and SPDY indicator」(Google Chrome) 或是「HTTP/2 and SPDY indicator」(Firefox),到後面各式各樣的工具都有列出來。甚至還包括 command line 與 packet snooping 類的工具都有...

CloudFlare 正式推出 HTTP/2,可以與 SPDY 同時混搭

CloudFlare 推出了 HTTP/2 服務,與其他 CDN 業者不一樣的地方在於,他可以同時接受 HTTP/2 與 SPDY:「HTTP/2 is here! Goodbye SPDY? Not quite yet」。

CloudFlare 拿自家的 www.cloudflare.com 官網測試,顯示 HTTP/2 的效能比 SPDY 又好了不少:

Access via HTTP Protocol Version Average Page Load time
HTTP 1.x 9.07 sec.
SPDY/3.1 7.06 sec.
HTTP/2 4.27 sec.

在正式上 HTTP/2 前,有 80.38% 對 www.cloudflare.com 的 SSL/TLS 連線是 SPDY:

During the week before our HTTP/2 launch, 80.38% of all SSL/TLS connections to our own website at www.cloudflare.com were made over SPDY/3.1.

上線後其實沒有想像中的高:

Protocol Version Percentage of Hits
HTTP 1.x 19.36%
SPDY/3.1 57.02%
HTTP/2 23.62%

這也說明了為什麼 CloudFlare 要推出 SPDY + HTTP/2 的服務:

Why choose, if you can have both? Today CloudFlare is introducing HTTP/2 support for all customers using SSL/TLS connections, while still supporting SPDY. There is no need to make a decision between SPDY or HTTP/2. Both are automatically there for you and your customers.

剛剛連到後台確認,由於本來已經打開 SPDY 的使用者會自動開啟 HTTP/2,這表示全球 HTTP/2 的使用率會馬上拉高很多,有太多資源掛在 CloudFlare 上:(像是 cdnjs.com,剛剛確認也已經是 HTTP/2 了)

If you are a customer on the Free or Pro plan, there is no need to do anything at all. Both SPDY and HTTP/2 are already enabled for you.

Customers on Business and Enterprise plans can enable HTTP/2 within the "Network" application of the CloudFlare Dashboard.