I’m using CNAMEs together with S3/CloudFront to serve some static files like js, css, images, etc.
I do it to make the bucket’s URL pretty and because I think is better have all targeting to my site and in case in some future I want to move those files the change should be transparent.
Today reading blogs I saw some think CNAMEs are evil for speed.
So, what to think about it?
CNAMES add another level of indirection using the DNS lookup, so some penalty will be incurred. However, once the IP has been looked up through DNS, it should remain cached and the penalty shouldn’t occur anymore for that client.
Make sure to set the expiry times correctly in your DNS entry and you shouldn’t see any visible delay.