Support » Plugin: W3 Total Cache » Self-hosted CDN: benefit of using another server as opposed to a sub-domain?

  • Resolved xberg



    All articles explaining how to set up a self-hosted CDN explain that I should create a sub-domain ( on my machine. This seems strange to me.

    I have contracts with 2 hosts, so would I not be better off creating a CDN on the other host, thereby creating a better parallel processing (as opposed to hitting twice the same machine)?

    Is there any research into this subject? So far I never saw such a setup recommended.



Viewing 3 replies - 1 through 3 (of 3 total)
  • Well, technically, a single machine isn’t really a CDN (content distribution network). A CDN works by caching data at multiple locations near the “edge” of the Internet (ie at the clients ISP). This achieves two things, first it cuts the latency involved in serving assets, which contributes to better page rendering times, second, it takes load off the central server.

    W3TC’s “CDN” functionality can also be leveraged to serve static assets off another server or hostname, which can still be useful but has some downsides as well.

    On the upside, it allows you to utilize capacity from another server or host. In the past it was also useful in enabling more parallelism in filling requests for assets on a web page, but that is less of an advantage these days with HTTP chunking and pipelining. Another upside is that putting those assets on another hostname or an entirely different domain means that one can eliminate the overhead of cookies on requests and responses.

    The main downside is that serving from a separate domain name or hostname means that the request for the assets involves an extra DNS lookup and extra round-trip times setting up the TCP connection. I’m sure there are numerous studies on front-end performance that examine the tradeoffs. I’d expect though that the overhead of using a separate hostname for static assets is offset by the reduced latency when using a CDN, an offset you won’t get using a single server.

    Bottom line for you though: There probably isn’t a major difference between the two options you are considering unless your primary machine is limited by a bottleneck, but there may also be no advantage to splitting off your static assets.

    Best bet is probably to experiment with a few different configurations.

    Plugin Author Frederick Townes


    @xberg, @especkman is correct. The real purpose of the self-hosted CDN considering the fact that it’s impossible to replicate the value of a true CDN with a single host (etc), is the ability to add additional pipelining and potentially a cookieless domain for static media in your site, which would realize a measurable performance improvement compared to doing nothing.

    Brilliant. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Self-hosted CDN: benefit of using another server as opposed to a sub-domain?’ is closed to new replies.