Tuesday, January 26, 2010

Wildcard Subdomains on Godaddy and Parallelizable Requests

So I wanted to speed up the pages on one of the websites I run. This page has a lot of images on it. So I decided to parallelize the image downloads for the browser.

Lets say you have 50 images on a page all with <img src="http://www.YOURDOMAIN.com/images/SEO-FILENAME.png" alt="SEO ALT TAG" width="320" height="240" title="SEO TITLE" />. Well a browser can only make a few requests to the domain at a time so the browser will download the fist few images at the same time and then create a queue for the rest of the images on the page to be downloaded.

So the solution is to create subdomains that resolve to your website. What we want to do is give 2 (or more) ways to get to the same place. An exa,ple would be http://purplemonkeydishwasher.YOURDOMAIN.com/images/SEO-FILENAME.png would be the same as http://www.YOURDOMAIN.com/images/SEO-FILENAME.png, get it?

Now some hosts let you add a wildcard for the CNAME on your domain. Something like:
Alias name = *
points to host name = @
TTL= 1 hour

Unfortunately GoDaddy doesn't allow this. Or do they?

You can create a wildcard for the A (Host) record. So you would have something like
 Host Name = *
TTL = 1 hour

See.... I have a dedicated IP address so I am able to do it. Now ANYTHING.YOURDOMAIN.com will pull up my website.

So now I can code the page with a bunch of images on it a little differently. Maybe something like:
<img src="http://image1.YOURDOMAIN.com/images/SEO-FILENAME.png" alt="SEO ALT TAG" width="320" height="240" title="SEO TITLE" />
<img src="http://image2.YOURDOMAIN.com/images/SEO-FILENAME-2.png" alt="SEO ALT TAG" width="320" height="240" title="SEO TITLE" />
<img src="http://image1.YOURDOMAIN.com/images/SEO-FILENAME-3.png" alt="SEO ALT TAG" width="320" height="240" title="SEO TITLE" />

Its just a little shortcut to help your page load quicker. Since you (and Google) want the users of your website to have a good experience, making your pages load quickly should be important to you.

Of course, if you have dynamic IP address for your domain you could always just add a specific CNAME (subdomain) and use that for your "<img src=".
Post a Comment