Current time: 11-15-2018, 05:26 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HTTP2 multi-origin connection sharing vs DNS requests
10-18-2018, 11:05 PM (This post was last modified: 10-19-2018 07:34 PM by jakub.)
Post: #1
HTTP2 multi-origin connection sharing vs DNS requests
I'm trying to understand the behavior observed in my tests.

We use an HTTP2-enabled CDN that is available under multiple domain names (that all resolve to the same IP at the end for a given user, normally -- unless the DNS requests happen at different time and the load balancing kicks in), for example:

https://static1.dmcdn.net/
https://static2-ssl.dmcdn.net/
etc.

The domains were created long time ago for sharding + differentiating http vs https calls, but essentially they are all equivalent nowadays.

I was thinking this would be an antipattern as it would cause a DNS+TCP+TLS for each of those domains, but actually it's not true. It seems that HTTP2 is intelligent enough to reuse the connection even across the domains if it's sure it's talking to the same server.

Test page:
https://jg-testpage.github.io/wpt/cdn-sh...nnect.html

Firefox: https://www.webpagetest.org/result/18101...view_step1
Chrome: https://www.webpagetest.org/result/18101...view_step1

As you can see, Chrome immediately reuses the existing h2 connection (no DNS, no TCP, no TLS).
Firefox does a DNS query first, and then reuses the existing h2 connection (no TCP, no TLS).

I can explain the behavior of Firefox:
- DNS request to both servers, notices the same IP
- TLS handshake returns a cert with `*.dmcdn.net, dmcdn.net` subjectAltName

What is surprising to me though is that Chrome doesn't do DNS request to get IP of the second server. How does it know that `static1` and `static2-ssl` are the same thing then?
Find all posts by this user
Quote this message in a reply
10-19-2018, 12:17 AM (This post was last modified: 10-19-2018 07:15 PM by jakub.)
Post: #2
RE: HTTP2 multi-origin connection sharing vs DNS requests
Having read a bit, seems that the things I observed are known as "connection coalescing" and "ORIGIN frame", and that Chrome (and Safari) support ORIGIN frame without the DNS query.

(edited): But apparently only Firefox has implemented ORIGIN frame as of today:

https://bugzilla.mozilla.org/show_bug.cgi?id=1337791
https://bugs.chromium.org/p/chromium/iss...?id=697333

So I'm still puzzled how the requests to the two subdomains get merged into one H2 connection in Chrome, and the second subdomain doesn't trigger a DNS request?
Find all posts by this user
Quote this message in a reply
10-25-2018, 09:29 PM
Post: #3
RE: HTTP2 multi-origin connection sharing vs DNS requests
Appears there's a second DNS requesting being made in the Chrome case

Doesn't appear in the waterfall but it's in the packet capture

https://www.webpagetest.org/result/18102...view_step1


Attached File(s) Image(s)
   

Andy

Using WebPageTest - http://usingwpt.com/
Visit this user's website Find all posts by this user
Quote this message in a reply
10-26-2018, 02:14 AM
Post: #4
RE: HTTP2 multi-origin connection sharing vs DNS requests
@andydavies Thanks a lot!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)