- HTTP/1.1 makes multiple new connections
- HTTP/2 multiplex from original connection
- Showing active HTTP/2 session
- About the new VPS
My blog has been migrated to a new Debian Virtual Private Server (VPS) . I was trying to enable SPDY on my new server but support from Google for Apache is kind of broken. Latest Chrome browser support SPDY 3.1 only but Google only provides SPDY 3.0 to Apache module. I decide to skip SPDY and setup HTTP/2, as more major browsers are adopting HTTP/2.
Before HTTP/2, let’s have a brief idea how slow HTTP/1.1 is,
As you can see from above chart, 21 new connections are trying to connect to the HTTP server simultaneously after the first request. Grey line in timelines represents time wasted on connecting to the server. My poor server can only serve 5 (first 3, 7th and 8th) immediately. Overall, the client has to wait for 0.5-1s to start downloading content and reach the red goal line, which means the page is ready for rendering.
Below is HTTP/2. No more grey! This is because the HTTP/2 keeps one single connection (multiplexing) and no time is waste on handshaking connections.
There are many more benefits from HTTP/2. Feel free to explore!
To setup HTTP/2 on Apache with PHP5 on Debian 8, I have to use Apache 2.4.18 from testing channel as the version include
mod_fcgid is used but no NPN is required. Lastly, SSL is required for HTTP/2.
deb http://mirror.steadfast.net/debian/ testing main contrib non-free
Add below to site config file
Run below commands
# install Apache 2.4.18 from testing channel instead of 2.4.10 from stable
Open chrome://net-internals/#events&q=type:HTTP2_SESSION%20is:active from Chrome. You should see your site listed as below screen if you have set it up successfully,
There are many tutorials about setting up SPDY would suggest to choose SPDY from the drop down. SPDY has been removed from the recent version of Chrome.
I have been using Openshift.com for free for years. However, I have to switch to another service from Openshift because the free account doesn’t support CA signed SSL. Paid user can add CA signed SSL to their website, I do not mind to pay but they do not accept payment from Hong Kong. SSL is getting more important in search engine ranking, and it is required for an advanced protocol such as SPDY that can improve page loading performance. I choose VPS from hostmada.com for USD 24 a year at the end.