A Monster for Every Season: Summer 2
You can get A Monster for Every Season: Summer 2 now at Gumroad
Results 1 to 13 of 13
  1. - Top - End - #1
    Halfling in the Playground
    Join Date
    Jan 2021

    confused Why do websites make so many dns requests

    I'm currently busy with web development and during my search I noticed that websites make tons of dns request.
    I understand that they embed other websites, but why in domain name form instead of ip+port?
    Why do google analytics, www.w3.org, images, embedded video, favicons, etc. even need domain names. I understand, why topdomains, links, and quoted embedded domains need them, but many of these domains don't even want to be noticed by the user.
    The closest I get to clear and consise:
    Quote Originally Posted by Justanotherhero View Post
    Interesting read! Thanks for the post!

  2. - Top - End - #2
    Bugbear in the Playground
    Join Date
    Nov 2013

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    I'm currently busy with web development and during my search I noticed that websites make tons of dns request.
    I understand that they embed other websites, but why in domain name form instead of ip+port?
    Why do google analytics, www.w3.org, images, embedded video, favicons, etc. even need domain names. I understand, why topdomains, links, and quoted embedded domains need them, but many of these domains don't even want to be noticed by the user.
    So your question is why they don't just put ip addresses in for the big sites to skip that step? For one it would make it less human readable both to maintain it and for users who want to know what is being accessed, also if one wanted to do that dynamically replacing it with an automatic cache system would be the better option. But the big services don't have a single ip address anyway they have whole ranges, you could pick a specific one and hardcode it but that might not be as reliable as getting one automatically via the url.

  3. - Top - End - #3
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Why do websites make so many dns requests

    It's very simple - if you use a FQDN it will - by the magic of DNS and other networking necromancies - always go to the machine it points to. You don't have to know anything about the internals of the network.

    It makes coding a lot easier to read, and if the machine's IP Address is changed (a frequent occurance in cloud systems) you will still go to the correct place.
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  4. - Top - End - #4
    Troll in the Playground
     
    OldWizardGuy

    Join Date
    Aug 2010

    Default Re: Why do websites make so many dns requests

    Sure, that makes sense.

    But, it's also likely that your website has multiple spots that refer to the same web location, so it probably makes sense to have a single location that they can get that info from, so you don't have to change a billion things when somebody's IP changes, right?

    So you could put that in a file. Now you have a quick lookup, and only have to change the lookup file when an IP changes. That sounds better.

    But.... if you have multiple web servers, you now have to duplicate that across them, and also you're now tied to a deployment cycle to push that change. It'd be a lot easier if that was some kind of pretty trivial service, right? So you can just stand up that service, and let people know the IP to reach it. That sounds good, too! Faster updates that can happen on the fly, even while a service is running!

    But... now we still have to get those updates and the new information from somewhere. So we either have to go and ask people when things change... or.... we could make a way for people to just update the information themselves when they change it, and our address server could get that info directly, or know how to redirect it. That would seem pretty ideal, really.

    Congratulations, you've just reinvented DNS.
    "Gosh 2D8HP, you are so very correct (and also good looking)"

  5. - Top - End - #5
    Pixie in the Playground
    Join Date
    Jan 2022

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    I'm currently busy with web development and during my search I noticed that websites make tons of dns request.
    I understand that they embed other websites, but why in domain name form instead of ip+port?
    Why do google analytics, w3.org, images, embedded video, favicons, etc. even need domain names. I understand, why topdomains, links, and quoted embedded domains need them, but many of these domains don't even want to be noticed by the user.
    Are you asking about why static IP addresses aren't used for urls, avoiding dns?

    It would make everything faster. Everything now is behind virtual hosts or CDNs, so server daemons won't respond correctly if you linked directly to their IP addresses.

  6. - Top - End - #6
    Halfling in the Playground
    Join Date
    Jan 2021

    Default Re: Why do websites make so many dns requests

    Thanks everyone.
    Now I understand it's mostly for server cluster support and shared hosting.
    I think I would use ports to deal with the shared hosting problem and would've fixed the server cluster problem by configuring the server router to pick a computer and ip-adress, but I understand how this would be an easier updatable, scalable and implemented solution.
    So, thanks for the explanations they were really helpfull.
    The closest I get to clear and consise:
    Quote Originally Posted by Justanotherhero View Post
    Interesting read! Thanks for the post!

  7. - Top - End - #7
    Dwarf in the Playground
     
    Imp

    Join Date
    Jan 2019

    Default Re: Why do websites make so many dns requests

    Another thing worth pointing out is that many of these services have multiple entry points. If a website were to hard code their local google IP into it and a user around the world were to access the site, their browser would try to access that endpoint on the other side of the world. By putting a service name rather than an IP the local DNS service is able to direct the user to the most appropriate end point. It avoids a lot of long distance traffic, and from Google's standpoint it keeps all user data relatively close to the user, rather than spread across the world.

    As another benefit, if an end point of a service goes down then the DNS system can rapidly redirect traffic to a different end point without sites or users being aware. It is far more robust.

    One way of thinking about it is that the domain name refers to what you want, while the IP refers to a location. It might seem like an optimisation to put the location of the thing you want instead of using the systems for getting it, but you lose a lot of information if you do that. This has implications for human readability, robustness, and maintainability, but also in terms of clever tricks that can go on behind the curtain. Anywhere you can think to replace something with an optimisation there is probably a cache hiding anyway.

  8. - Top - End - #8
    Ogre in the Playground
     
    Flumph

    Join Date
    Nov 2006
    Location
    England. Ish.
    Gender
    Male

    Default Re: Why do websites make so many dns requests

    It's worth remembering how far back mapping host names on to IP addresses goes - hosts files were used for this purpose on the original ARPANET, before DNS was created in the mid-1980's.
    Warning: This posting may contain wit, wisdom, pathos, irony, satire, sarcasm and puns. And traces of nut.

    "The main skill of a good ruler seems to be not preventing the conflagrations but rather keeping them contained enough they rate more as campfires." Rogar Demonblud

    "Hold on just a d*** second. UK has spam callers that try to get you to buy conservatories?!? Even y'alls spammers are higher class than ours!" Peelee

  9. - Top - End - #9
    Troll in the Playground
     
    OldWizardGuy

    Join Date
    Aug 2010

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    Thanks everyone.
    Now I understand it's mostly for server cluster support and shared hosting.
    I think I would use ports to deal with the shared hosting problem and would've fixed the server cluster problem by configuring the server router to pick a computer and ip-adress, but I understand how this would be an easier updatable, scalable and implemented solution.
    So, thanks for the explanations they were really helpfull.
    Not really. It's primarily because people don't read and parse IP addresses well, and to support services moving hosting/changing IP addresses.

    IOW, if I send you a letter, do you want it to go to Smoutwortel, or "whoever is at 12345 Smoutwortel's Street"? The post office isn't smart enough to just accept "Smoutwortel" as an address, but if it could, that would be ideal. And it's really easy to inadvertently screw up 183.145.29.201, especially when staring at a bunch of them, and especially making sure you're looking at the right thing.

    The kind of clustering and shared hosting you're talking about didn't really come about until well after DNS was entrenched.
    "Gosh 2D8HP, you are so very correct (and also good looking)"

  10. - Top - End - #10
    Ettin in the Playground
    Join Date
    Oct 2015
    Location
    Berlin
    Gender
    Male

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    Thanks everyone.
    Now I understand it's mostly for server cluster support and shared hosting.
    I think I would use ports to deal with the shared hosting problem and would've fixed the server cluster problem by configuring the server router to pick a computer and ip-adress, but I understand how this would be an easier updatable, scalable and implemented solution.
    So, thanks for the explanations they were really helpfull.
    Basically, what you do not want to do is hardcode anything in web sites.

    Just consider: Currently, you only need to point one DNS Entry towards a Host, Service or Reverse Proxy. Change something, change the IP mapping in one central place and you can be sure that everything else that uses the FQDN updates, too.

    It would be quite stupid to use something like k8s to use a scaleable database cluster as a backend and then again limit yourself by pointing to one docker and port only.....

  11. - Top - End - #11
    Halfling in the Playground
    Join Date
    Jan 2021

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by kyoryu View Post
    Not really. It's primarily because people don't read and parse IP addresses well, and to support services moving hosting/changing IP addresses.

    IOW, if I send you a letter, do you want it to go to Smoutwortel, or "whoever is at 12345 Smoutwortel's Street"? The post office isn't smart enough to just accept "Smoutwortel" as an address, but if it could, that would be ideal. And it's really easy to inadvertently screw up 183.145.29.201, especially when staring at a bunch of them, and especially making sure you're looking at the right thing.

    The kind of clustering and shared hosting you're talking about didn't really come about until well after DNS was entrenched.
    I already understood what DNS did in user space like urls and top domains in this case I was talking about domains beyond user vision like embedded youtube, analytics, embedded fora, picture domains, etc.
    The closest I get to clear and consise:
    Quote Originally Posted by Justanotherhero View Post
    Interesting read! Thanks for the post!

  12. - Top - End - #12
    Ettin in the Playground
    Join Date
    Oct 2015
    Location
    Berlin
    Gender
    Male

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    I already understood what DNS did in user space like urls and top domains in this case I was talking about domains beyond user vision like embedded youtube, analytics, embedded fora, picture domains, etc.
    Dunno about you, but in the rare cases I deal with building a website, it's mostly API calls to remote systems I want to use/include.

  13. - Top - End - #13
    Troll in the Playground
     
    OldWizardGuy

    Join Date
    Aug 2010

    Default Re: Why do websites make so many dns requests

    Quote Originally Posted by Smoutwortel View Post
    I already understood what DNS did in user space like urls and top domains in this case I was talking about domains beyond user vision like embedded youtube, analytics, embedded fora, picture domains, etc.
    There's no real difference in practical terms. Services change IPs. Often. Plus the maintainability aspects.
    "Gosh 2D8HP, you are so very correct (and also good looking)"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •