I am no expert at this at all, so I am wandering is there a difference in speed, etc. when using some subdomain (CNAME record) over the original address?

For example, when using CDN like Amazon S3. There is an option to set up custom domain alias, and create CNAME record that points to cloudfront address. So, is there difference in speed when using sub.domain.com that points to someString.cloudfront.net?

I understand the advantage of CNAME if you plan to change CDN provider, and you don't need to change links, but I am interested in speed.


It obviously is slower. You Need 2 requests to see the IP address, not one.

THAT SAID: If that is a differnce, you have a Problem - as the results are cached, we talk of a one time Overhead of WAY less than a second, given a proper DNS Service to start with. It is more - practically - a 0.05 second ONE TIME hit.

| improve this answer | |

It could be slower as it could require 2 DNS queries.

But in the real world a users web browser will not know in advance that sub.domain.com is a CNAME and it will ask for the A or AAAA record of sub.domain.com.
The upstream recursive DNS will recognize that the answer is a CNAME and do the lookup of that as well (and cache it).
If the target of the CNAME is on the same authoritative DNS server it will already include the resolved A in the answer as well.
So it can also be handled in a single query with no performance hit, but this depends on the DNS setup you are using.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.