Home » Htaccess » Speed Tips: Use Multiple SubDomains

by 23 comments

To make your site even faster, serve certain content from different subdomains. For instance, on this site I serve (html, favicon, etc.) from, (css, js, images, uploads, etc.) from, and (flash, flv, swf, movies, mp3, etc.) from The reason this works is amazingly cool!

Easy Apache Speed Tips Articles

A subdomain is the part of a domain that is appended to the beginning of the domain name, like a prefix. For example, my domain is "," and 3 subdomains I am using are "," "," and "".

Speed Benefits of Multiple Subdomains

Basically when a visitor comes to, they make a DNS request for each of my 3 subdomains [www/z/f] to translate them into IP addresses. These hostname to IP address translations are then cached for that visitor, so no more DNS requests are needed. Because the first request was for, the browser requests the .html document from the www server first. In the .html document the browser is told to also retrieve .css and .js files from my z server. In the .js file I load some flash which tells the browser to fetch the flash from my f server. So the users are able to see the content (.html) first, but thats not the only benefit to using these subdomains.

Subdomain Persistant Connections Benefits

The other benefit to using these subdomains is brilliant. Instead of a browser having to make 30 tcp connections to my www server to download everything, a browser is instead instructed to download 3 items from my www server, 22 items from my z server, and 5 items from my f server. So instead of waiting for 30 items from 1 source, it waits for 30 items from 3 different sources, drastically speeding up the transfer. By using multiple subdomains browsers are further able to maintain persistant connections with all 3 unique servers, making the site load incredibly faster.

Please read about Persistant Connections for more info.

Start using Subdomains

If you are an incredibly savvy and experienced web developer, no doubt you already have a DreamHost account, and so you already have the ability to add as many subdomains (for free) that you want. I think the limit per domain is 2500.

If you don't have DreamHost, it's never to late to start experiencing what the elite webmaster already has. For user and editorial reviews of DreamHost and other web hosts, check out Web Hosting Search


Comments Welcome

Information is freedom. Freedom is non-negotiable. So please feel free to modify, copy, republish, sell, or use anything on this site in any way at any time ;)

My Online Tools

Popular Articles
Hacking and Hackers

The use of "hacker" to mean "security breaker" is a confusion on the part of the mass media. We hackers refuse to recognize that meaning, and continue using the word to mean someone who loves to program, someone who enjoys playful cleverness, or the combination of the two.
-- Richard M. Stallman

It's very simple - you read the protocol and write the code. -Bill Joy


Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group. POSIX ® is a registered Trademark of The IEEE.

+Askapache | |

Site Map | Contact Webmaster | License and Disclaimer | Terms of Service | @Htaccess

↑ TOPMain