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?

  • 3
    To most English speakers, "fasten" means "make stationary", not "increase the speed of". There are two meanings to "fast": the most common is "moving quickly, or capable of moving quickly", and the other is a nautical term meaning "fixed in place." "Fasten" is related to the second meaning. – kevin cline Jun 29 '12 at 17:13

I'm sorry, but your answer is incorrect. The main reason to use a sub domain would be to maximize parallel downloads, and you could take it a step further if said sub domain was cookie free. From Yahoo's Best Practices for Speeding Up Your Web Site:

Split Components Across Domains

Splitting components allows you to maximize parallel downloads. Make sure you're using not more than 2-4 domains because of the DNS lookup penalty. For example, you can host your HTML and dynamic content on www.example.org and split static components between static1.example.org and static2.example.org


Use Cookie-free Domains for Components

When the browser makes a request for a static image and sends cookies together with the request, the server doesn't have any use for those cookies. So they only create network traffic for no good reason. You should make sure static components are requested with cookie-free requests. Create a subdomain and host all your static components there.

If your domain is www.example.org, you can host your static components on static.example.org. However, if you've already set cookies on the top-level domain example.org as opposed to www.example.org, then all the requests to static.example.org will include those cookies. In this case, you can buy a whole new domain, host your static components there, and keep this domain cookie-free. Yahoo! uses yimg.com, YouTube uses ytimg.com, Amazon uses images-amazon.com and so on.

  • I don't think AAA's answer is necessarily incorrect though. What they have described is a beneficial side effect of splitting your content across multiple domains. You have described the primary reason that would lead someone to consider splitting content if bandwidth is no object. But I have also encountered situations where bandwidth concerns are an issue. If I have a popular blog with lots of video content and a hosting plan with little bandwidth, the first thing I would do to decrease costs would be to move all my videos to another service and have the content fetched from there. – David Cowden Jun 29 '12 at 20:02
  • Although I will agree that I think your answer is what the interviewer was looking for (; – David Cowden Jun 29 '12 at 20:03
  • @DavidCowden Well... If I'm interviewing, I'd pretty much prefer a straight "I don't know" than vague generalities. I wouldn't mind AAA's answer in casual conversation, but definitely not in an interview. – yannis Jun 30 '12 at 0:16

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.