To make your site even faster, serve certain content from different subdomains. For instance, on this site I serve (html, favicon, etc.) from
www.askapache.com, (css, js, images, uploads, etc.) from
static.askapache.com, and (flash, flv, swf, movies, mp3, etc.) from
f.askapache.com. The reason this works is amazingly cool!
Easy Apache Speed Tips Articles
- Turn On Compression
- Add Future Expires Header
- Add Cache-Control Headers
- Turn Off ETags
- Remove Last-Modified Header
- Use Multiple SubDomains
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 "
askapache.com," and 3 subdomains I am using are "
static.askapache.com," and "
Basically when a visitor comes to /htaccess/htaccess.html, they make a DNS request for each of my 3 subdomains
[www/z/f].askapache.com 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 /htaccess/htaccess.html, 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.
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.
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
September 17th, 2007