-1

If a domain exists say blahblah.com and has a subdomain cdn.blahblah.com, For this scenario, which one of the following two is faster for serving(least server usage) and delivering(fastest for end-user) the website on http protocol?

  1. cdn.blahblah.com has CNAME to blahblah.com, so that it also loads/serves same static files
  2. cdn.blahblah.com is hosted on the same server with same home directory as that of main domain blahblah.com (Meaning that blahblah.com and cdn.blahblah.com have same A records and both point to same dir)

Please note that I have added Access-Control-Allow-Origin headers for both cdn.blahblah.com and blahblah.com && sole reason for using sub domain is to make the static traffic cookieless. (No usage for SPF/TXT or SRV for cdn subdomain)

p.s. This question is not a duplicate of Many domains/sites hosted on same server, CNAME alternatives to avoid writing same IP in DNS?

th3pirat3
  • 103
  • 4

1 Answers1

2

"A" records are generally faster than CNAME records. A CNAME is like an alias, it results in a second DNS lookup for the domain name specified in the CNAME. However, the difference will be small.

You should test to see if the subdomain is faster. If you use https / https2 this split domain technique could theoretically slow things down. http2 allows pushing resources not yet requested and sends multiple resources over the same connection.

Tim
  • 30,383
  • 6
  • 47
  • 77