Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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