Home > TechBlog > WordPress Speedup – Multiple hostnames for parallel connections

WordPress Speedup – Multiple hostnames for parallel connections

Recently while working on a site for a client, and using Google Page Speed, there is a recommendation for using multiple hostnames to serve content, which helps decrease page load times, as your browser is able to open more than 2 connections to your site. After looking around, I decided the cleanest and cheapest method, would be to just do the following:

1. Create a DNS cname that point to your site, for example:

static.parraz.net CNAME would point to parraz.net A Record.

2. Now that I have a new hostname, this static.parraz.net domain will be used to serve content from parraz.net, in the example; Now, make sure that your web server answers for this name, and uses the SAME document root. We want to use the same info, as both URL’s are serving the same content, except that your browser can open connections to both static and www hosts on a single page request.

If your using apache, just add a VhostAlias of “static.parraz.net”, from the example, and restart apache to make sure the change takes affect.

3. Now, just verify that your new hostname is working in a browser, and that the content is being served correctly; We can now download and install the OSSDL WordPress plugin. This plugin was designed for either CDN or hostname usage, and since we are not expecting to get Slashdotted anytime soon, I suspect that this mod will work for the long haul – once we exhaust our hostname mod,  we can also switch to Rackspace CloudFiles or another CDN, for the real deal 😉

4. Download and install plugin as instructed below:

http://wordpress.org/extend/plugins/ossdl-cdn-off-linker/

Once the plugin in activated, click edit, and use the “static.parraz.net” hostname from the example, and click on Save. One advantage I saw, was that this plugin changes the php URL dir, so no rewrites are required, so that also keeps it quite simple.

 

Your done – Your site will now load faster to most user agents (browsers, I said it!)

Categories: TechBlog
  1. Paul
    2011/03/31 at 10:26 am

    Daniel – sounds easy enough. But what about more than one sub-domain? There’s another plugin out there that seems to do the same thing:

    http://wordpress.org/extend/plugins/parallel-loading-system/

    But that one seems to support 4 or 5 hostnames…

    What do you think? I also saw on the wordpress plugin page for this plugin – that someone patched the code – but that was a bit out of my scope..

    Any thoughts?

    • 2011/03/31 at 9:16 pm

      Paul,

      About the only issue i see with “too many hostnames”, is that you will start to take a hit with DNS queries. I would probably say that having 2-3 hosts is about as far as you want to go, as the more you add, you will add latency by having to look up lots of hostnames.

      I would say one factor is your DNS setup; if you have a diverse DNS system, with servers all over the globe, you shouldn’t see much of an impact, with all the lookups. If your paying per query, like UltraDNS or similar, you could begin to see more requests than you wanted to pay for 😀

      Let me know if you see reduced page load times with using multiple names, and the DNS environment your using.

      Hope that helps,

      Daniel Parraz

  2. Paul
    2011/03/31 at 9:41 pm

    You know what happened? I spent hours setting it all up – and realized my host doesn’t allow the virtual parallel connections! (Rackspace Cloud Sites)

    Unless I physically move the static content (i.e., images) – I cannot use these parallel efficiencies. Really sucks.

    So my final option is to use W3 Total Cache – which allows for CDN… and even copies the static wordpress files to my subdomain directory. I’ll try that tonight.

    In the end – I may have to consider switching hosting companies again to one that allows for virtual parallel connections.

  1. No trackbacks yet.

Leave a reply to dparraz Cancel reply