Are CNAMES slow? Are CNAMES slow? apache apache

Are CNAMES slow?


As per other answers, using a CNAME should only cause very minimal additional DNS resolution delay, and only if the result is not already in the recursive DNS server's cache.

Note that DNS clients don't routinely ask explicitly for CNAME records. Typically they'll ask for whatever record type they actually want - for a web browser that would be an A or AAAA record.

It's the job of the upstream servers to recognise that the queried domain name has a CNAME entry in it, and then look up and return the target result. In this case both the CNAME record and the required result are returned in the Answer Section of the DNS response (and not in the Additional Section as someone else answered).

For optimum performance it's best that the target of the CNAME be hosted on the same authoritative DNS server as the domain name that contains the CNAME so that the CNAME resolution can be done without further DNS requests.


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.


The impact of using CNAME is in most cases very low. The DNS response format allows the server to put some additional data in the message, and in many situation when you look up CNAME record, the server will add the corresponding A record in the additional data section, so no more look ups are required.