Results 1 to 13 of 13
-
2022-01-26, 11:27 AM (ISO 8601)
- Join Date
- Jan 2021
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.
-
2022-01-26, 12:02 PM (ISO 8601)
- Join Date
- Nov 2013
Re: Why do websites make so many dns requests
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.
-
2022-01-26, 12:12 PM (ISO 8601)
- Join Date
- Nov 2006
- Location
- England. Ish.
- Gender
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
-
2022-01-26, 03:11 PM (ISO 8601)
- Join Date
- Aug 2010
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)"
-
2022-01-26, 07:00 PM (ISO 8601)
- Join Date
- Jan 2022
Re: Why do websites make so many dns requests
-
2022-01-27, 03:33 AM (ISO 8601)
- Join Date
- Jan 2021
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.
-
2022-01-27, 06:04 AM (ISO 8601)
- Join Date
- Jan 2019
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.
-
2022-01-27, 01:24 PM (ISO 8601)
- Join Date
- Nov 2006
- Location
- England. Ish.
- Gender
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
-
2022-02-01, 12:24 PM (ISO 8601)
- Join Date
- Aug 2010
Re: Why do websites make so many dns requests
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)"
-
2022-02-15, 02:36 PM (ISO 8601)
- Join Date
- Oct 2015
- Location
- Berlin
- Gender
Re: Why do websites make so many dns requests
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.....
-
2022-02-17, 01:51 PM (ISO 8601)
- Join Date
- Jan 2021
Re: Why do websites make so many dns requests
-
2022-02-17, 02:19 PM (ISO 8601)
- Join Date
- Oct 2015
- Location
- Berlin
- Gender
-
2022-03-24, 03:44 PM (ISO 8601)
- Join Date
- Aug 2010