Implementing multiple CDNs

Stuart Wright

Well-known member
So Xenforo helpfully gives us the ability to enter the location of images so we can use a CDN.
But it's been suggested that we use multiple CDNs to further speed things up.
Is it worth, for example, putting images on one and JS on another?
 
I think it's good if you just use a single domain/sub-domain for all static content.
What is the advantage of separating images and js?
 
What is the advantage of separating images and js?
Well if you spread the resources over several CDNs, then the website will load faster, right?
So splitting the resources between two CDNs, one for images, another for JS seems like a simple way of doing it.
 
I tried this, and always found it loaded slower when putting JS on a different domain, so I only initially served the /data directory via the CDN. I've even turned that off now I've gone nginx/SPDY.
 
I assume you meant multiple subdomain CDN names ? And not multiple CDN providers i.e. maxcdn + cdn77 ?

Matt makes a good point for page loading speed the most important thing to do is trial and error testing so test it out and find out for yourself for your specific site and forum layout design whether it works or not. This is where online tools with multiple geographic test locations and multiple browser and internet speeds such as gtmetrix.com and webpagetest.org come in. And yes, if you use Google SPDY protocol, you no longer need a CDN in general due to SPDY multiplexing etc. But still you can go one step further and setup a GeoIP based CDN with Google SPDY based locations :)

I've had forums and sites which were faster if css and js were on different CDN hostnames and then had some where it wasn't as fast due to how the site and forums layout rendered. Remember there's pure page loading times and then there's visual rendering time (TTFB, time to start render, and visual page completion etc).

For example, your forums and front page are crazy huge in terms of http requests and size see index and forum index comparisons at http://gtmetrix.com/compare/r6NJ0WI3/EKT6DGts 4.8+ MB and 2.8MB sized respectively with 409 and 332 http requests and 13 and 36 js files ! No CDN usage will make that any faster unless you start bringing down page size and http request and js files numbers!
 
Last edited:
Yes I mean CDN names-
static.avforums.com (currently in use)
static-2.avforums.com
static-3.avforums.com
all located at the same place as the current one.
 
Yes I mean CDN names-
static.avforums.com (currently in use)
static-2.avforums.com
static-3.avforums.com
all located at the same place as the current one.
Just extra DNS lookups, with all traffic still going to the same place. Can't see it improving page speeds, but the opposite.
 
The way I understand it, if it's requesting everything from static.avforums.com then it all comes down one after the other.
If it's getting stuff from a second location, it's getting stuff from both at the same time. So twice as fast.
Is that not correct?
 
Yes I mean CDN names-
static.avforums.com (currently in use)
static-2.avforums.com
static-3.avforums.com
all located at the same place as the current one.
Right there is is a performance issue. You should use a cookieless domain, like avstatic.com, not static.avforums.com. Did you managed to switch from Apache to Nginx?
 
Tim reports that he has made the cdns cookieless. Or given them a long timeout. Tests with NGINX are under way on our sandbox. Does NGINX handle things differently?
 
For example, your forums and front page are crazy huge in terms of http requests and size see index and forum index comparisons at http://gtmetrix.com/compare/r6NJ0WI3/EKT6DGts 4.8+ MB and 2.8MB sized respectively with 409 and 332 http requests and 13 and 36 js files ! No CDN usage will make that any faster unless you start bringing down page size and http request and js files numbers!
He could cache statically the entire frontpage and refresh it every 10min...
I don't know, for some reason, I never liked CDN's. I always setup data to be served locally. I'm talking about forums with over 50mil posts.
 
Tim reports that he has made the cdns cookieless. Or given them a long timeout. Tests with NGINX are under way on our sandbox. Does NGINX handle things differently?
Nginx is event based driven so handles static file serving way more efficiently than the usual Apache prefork worker based setups. But nothing beats better page loading speed than a more efficient and manageable sized web pages. 4800KB web page versus a 800KB sized web page. Which will load faster across all different internet connection speeds? :) Try loading your forums from a mobile device net connection and see.

He could cache statically the entire frontpage and refresh it every 10min...
I don't know, for some reason, I never liked CDN's. I always setup data to be served locally. I'm talking about forums with over 50mil posts.
really depends on the forum and layout hence why I suggested Stuart test for himself and see :)

I've worked with forums around that size too 30-60+ million posts range and the use and benefits of CDNs vary between forums. It also comes down to geography and knowing your traffic make up. For example, if 50% of your forum audience is Sout-East Asia located but your servers are on the US East coast, then a CDN does help especially as the number of http requests per page increase. Whereas, if your audience is mainly located in US, the benefits of offloading to a CDN aren't as great.

I think sometimes we forget to view a site's page loading performance beyond our own location and internet setup. I frequently break down my site page speed stats by geographical location (country and city) and it's always interesting to see while my site's page may load for me and some visitors in <2.5 seconds with visual rendering between 500ms - 1400ms, that some geographical locations have much slower connections or further distance from my servers and can take anywhere between 30-300 seconds to load.

Put Google Analytics to use and dig into your site's page speed stats and have a looksy :)
 
Last edited:
Top Bottom