Is it better to have a fewer A records and dozens of CNAME records or vice verca?

One (or few) A records per unique IP and many CNAME records per A record:

@   3600    IN  A

a   3600    IN  CNAME   @
b   3600    IN  CNAME   @
c   3600    IN  CNAME   @

Bunches of A records:

@   3600    IN  A
a   3600    IN  A
b   3600    IN  A
c   3600    IN  A

Better for what?

From a performance perspective, it's marginally (and by "marginally", I mean "technically, but not noticeably") better to use the A records, as your DNS responses will not need to include the extra data.

If the CNAME points to another domain for which your server is not authoritative, it can have a greater impact due to a resolver needing to make more requests to get to the result.. but in the example you've provided, the performance impact is completely negligible.

From a manageability perspective, the CNAME may be easier, as you'd only need to make one change instead of several to account for an IP change to the system.

If the deployment is as simple as the example that you've provided, then it honestly doesn't matter either way.


Is it better to have a fewer A records and dozens of CNAME records or vice verca?

No. Less glibly, there really isn't much reason to prefer one to the other, provided that you don't point CNAME to CNAME along the way.

The main advantage that the CNAME choice would mean is that you don't have to add an MX record, or other ephemera, to each subdomain. The main drawback is that you can't vary those without converting back to an A record.


Re: CNAME vs A - it really doesn't matter for performance, per other answers.

However, if you do use a CNAME, don't make it a pointer to @, make it a pointer to some other sub-domain in the zone.

The reason is that @ also contains other records, e.g. your SOA, NS, MX records etc.

If your CNAME points to @, then all those other records will (incorrectly) start to exist for your aliased subdomains too.

BTW, if your web host becomes multihomed (i.e. it has multiple A records, or even an A and AAAA) then a CNAME to the real host machine is only a single record to maintain. If you had used A records you'd need to duplicate the list over and over for each subdomain.

  • Thanks for your input, as I do currently have sites with multiple CNAME records pointing to @. – sente Feb 4 '12 at 1:47

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.