A well-known technique is to link resources (CSS, JavaScript, …) with a separate DNS name for various reasons. Like this:
GET http://stackoverflow.com/
GET http://cdn.sstatic.net/stackoverflow/all.css
(Two different domain names)
Instead:
GET ...
GET http://92.60.242.2/stackoverflow/all.css
(One DNS lookup)
This means that two DNS lookups are required. Couldn’t we just use an IP address instead of cdn.sstatic.net in order to save one DNS lookup?
Please assume that it is possible to use an IP host from the point of view of the server. Assume, that there is a dedicated resource serving server with a dedicated IP.
Content delivery networks usually employ some sort of load balancing, often implemented at the DNS level (e.g. the name
cdn.sstatic.netresolves to different IP addresses, based on the geographical location of the requester). Hard-coding the IP address would be counter-productive, as the request will always go to the same server (which might still be a load balancer in front of several backend servers, but all of them will be in the same location).