5

I went for an interview yesterday where I was asked this question:

"How does having assets (images/videos) stored on a secondary domain (assets.example.com) reduce the load time of example.com?"

To that I answered that by having the code "call" those assets from a secondary website it reduces the traffic that is coming to the main domain and therefore only applying bandwidth to the main domain vs having to also serve bandwidth to request assets.

Is that correct?

Also, If i am correct, would you say it makes sense to start new websites with this in mind or do you prefer having it done after large traffic rates are achieved?

Rachel
  • 24,037
AAA
  • 323

1 Answers1

4

Updated answer for 2024: the technique described (which is called Domain Sharding) is obsolete according to this MDN article because most servers (and basically all browsers) support HTTP2 now, which supports unlimited concurrent requests.

None of that per-domain throttling there used to be, which would have been the main reason to do it. So the extra performance cost of doing DNS lookups for each extra domain now means domain sharding is slower than serving everything up from a single domain.

Put it all together and that means that, as of 2024, your answer to the interview question would be the most correct!