-2

I would like to clarify a doubt that's haunting me after learning DNS.

I'll briefly write it as a question. "A user was watching a video in youtube and suddenly the DNS server which was used by the user(primary and alternative dns) went down". From DNS perpective what I can understand is that the user should be able to continue watching youtube since the DNS is already resolved. But what actually happens is, the youtube video stops playing after the buffered video is played and youtube is not playing anymore.

Could you please explain to me the working behind this based on OSI layer? 

itSupport
  • 11
  • 1

3 Answers3

2

Regarding the OSI model, HTTP isn't on top of DNS, but both are independent application layer protocols, having their own OSI model stacks beneath. They can share the same cables and network connection, but on top of that they get data from different IP addresses using separate TCP/UDP connections.

DNS & HTTP in OSI & TCP/IP models

Despite HTTP works independently from the DNS once the hostname has been cached, these implementation details of modern services using the HTTP protocol makes things more complicated. Especially global and popular streaming services like YouTube simply cannot serve the content from a single server nor IP address, but requires a content distribution network (CDN) with several servers sharing the load.

When you watch videos from YouTube, you aren't actually downloading the buffered video stream from www.youtube.com, but using additional requests to hostnames like r2---sn-xap5-ixaz.googlevideo.com. Using the developer tools you may see that they are rather small chunks requested constantly:

Chrome developer tools showing /videoplayback queries

  • Those hostnames seem to have quite a short TTL of 5-15 minutes. After this cache expires, an addional DNS query is required. However, this is not a bad choice, as a CDN needs to be able to adapt to changes in demand.

    From ipconfig /displaydns:

    r2---sn-xap5-ixaz.googlevideo.com
    ----------------------------------------
    Record Name . . . . . : r2---sn-xap5-ixaz.googlevideo.com
    Record Type . . . . . : 5
    Time To Live  . . . . : 587
    Data Length . . . . . : 8
    Section . . . . . . . : Answer
    CNAME Record  . . . . : r2.sn-xap5-ixaz.googlevideo.com
    
    Record Name . . . . . : r2.sn-xap5-ixaz.googlevideo.com
    Record Type . . . . . : 1
    Time To Live  . . . . : 587
    Data Length . . . . . : 4
    Section . . . . . . . : Answer
    A (Host) Record . . . : 193.229.108.205
    
  • For the same reasons, from time to time the backend changes, which also requires additional DNS queries.

Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
1

I don't think OSI layering is really a factor for this question.

The assumptions laid out in the question seem largely correct for a trivial scenario with a cache.
That is, provided that the relevant DNS data is already cached and the same name keeps being requested, it doesn't make any difference that a theoretical new DNS lookup wouldn't work as no lookup is made.

I rather expect that these assumptions don't actually apply in your non-trivial real world scenario with the Youtube player in a browser. Ie, I expect that either the necessary DNS data is not actually cached (long enough?) or new/additional names are being looked up throughout the playback.

You may want to track both what your browser is doing (developer console?) and the cache state to figure out this particular scenario.

Håkan Lindqvist
  • 35,011
  • 5
  • 69
  • 94
  • I think requesting an explanation using OSI model isn't that bad after all. The OSI model is a template you can fit things in, and understanding how things are build on top of each other (or aren't) really helps building the overall picture. The co-operation between DNS & HTTP fits into the OSI model, if you put them next to each other instead of the same stack. Although this question is based on a misconception, it's a good and educating one! – Esa Jokinen Sep 12 '20 at 15:31
  • @EsaJokinen Fair enough. Fwiw, I did upvote your answer when you posted it. – Håkan Lindqvist Sep 12 '20 at 19:17
  • Thanks! Likewise. :) – Esa Jokinen Sep 12 '20 at 19:33
0

Your assertion that the IP is cached by the computer is wrong (almost all of the time). The IP can change dynamically and the user can change the IP in the middle of the view of Youtube. The computers starts to cache the IP to allow a small problem with DNS. But if the DNS server is down for long time (30s ? more ? I don't know), when the session is almost finished, a new DNS request is done. And the DNS will not answer, the client will stop to communicate. A new DNS RFC has started last year to continue to work in this case, but it is not actually deployed.

Dom
  • 6,743
  • 1
  • 20
  • 24
  • Could you please let me know the RFC for the same.. And what I understand is each video in the youtube could be server by different Servers, Right? – itSupport Sep 12 '20 at 12:39
  • 1
    The "cache is cancelled" part sounds interesting, can you elaborate on which cache we are talking about? – Håkan Lindqvist Sep 12 '20 at 13:35
  • @Håkan Lindqvist, right, I updated the answer – Dom Sep 12 '20 at 15:06
  • @itSupport, videos can be provided by multiple HTTP servers. The problem here is on the client to know how found these servers, and what should be done if the IP change. – Dom Sep 12 '20 at 15:08
  • This answer seems a bit like guessing, as it lacks evidence and references. You might want to improve it. – Esa Jokinen Sep 12 '20 at 20:31