1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.


Discussion in 'Server Configuration and Hosting' started by Mouth, Nov 5, 2012.

  1. Mouth

    Mouth Well-Known Member

    If the majority of your users/visitors come from from one geographic country, how much better is a CDN compared to getting a VPS as close as possible to those users?

    I've been researching the CDN providers, but am finding it difficult to pinpoint exactly where a CDN service had it's servers located - what point is a CDN if it's closest servers are in a different country or continent?

    So then I started to think about a VPS on a good backbone right in the heart of where the majority of my sites userbase is - that would be just as good, if not better?

    Note: I cannot even come close to affording to have the main server close to the main userbase. Local server hosting/charges are gigantic, and data charges even worse :(

    Is this sort of thinking accurate, or am I missing something?
  2. SchmitzIT

    SchmitzIT Well-Known Member

    Our host actually offers both. We have a VPS from thm, and can optionally get a CND to compliment it.

    In our case, the CDN hosts images and the javascripts :)
  3. Sim

    Sim Well-Known Member

    Hey Mouth - great to see another Aussie XenForo user here.

    I face a similar problem with my forums, I ended up using both.

    Most of my sites are Australian-centric, so I wanted them hosted as close as possible to here - but as you said, local VPS is prohibitively expensive.

    I ended up going with Linode for my VPS - my Australian based sites are hosted in Tokyo. I tested all of their server locations and found that Tokyo was by far the fastest from most ISPs in Australia.

    To further enhance performance, I use Amazon S3+Cloudfront to host static files (images / JS / etc). They now have an edge-location in Sydney.
    DRE and Mouth like this.
  4. hellreturn

    hellreturn Active Member

    I would suggest to get "faster" VPS. If your forums is slow to begin with then CDN will not do much.
  5. Mouth

    Mouth Well-Known Member

    My forums aren't slow now - but every site could do with putting static content closer to their users without it having to traverse the pacific every time it's requested :)
    DRE likes this.
  6. hellreturn

    hellreturn Active Member

    How much time it takes to travel around the globe? 1-3 seconds at most?

    Most of the static content is cached by browser on first load. So why you need CDN for it if you have fast loading websites near to your audience?

    For some reason, I feel CDN is sometimes over hyped. That being said you site really loaded fast for me.
    DRE likes this.
  7. Sim

    Sim Well-Known Member

    1+ seconds is an eternity for user experience. Makes a site feel very sluggish if you have to wait that long for things to start loading in the browser.

    Ideally you want < 200ms to make site response feel snappy.

    First visit load times are critical for engagement with the site and for SEO ... Google now measures these things and penalises slow sites.

    I believe Amazon did some studies on their own website on load times and found that even a 100ms delay in load times lead to a dramatic drop in sales. Similarly, Google found that adding more search results to a page (at the cost to a 500ms delay in load times) resulted in far fewer searches being performed, and a substantial drop in revenue from search traffic.

    Here is a page that summarises some of the reports about page load times (see reference links at the bottom of that page for sources).

    Page load times and responsiveness do matter.
    DRE and Mouth like this.
  8. Mouth

    Mouth Well-Known Member

    Oh cool, finally a .au cloudfront location.
    Thanks, I'll take a look!
  9. melbo

    melbo Well-Known Member

    Has someone created a tutorial (hint hint) on how exactly to set up Amazon S3+Cloudfront and use it with XF?
  10. Mouth

    Mouth Well-Known Member

    I just did it, took around 5 minutes :)

    1. Go to aws.amazon.com and activate the Cloudfront service. Configure it so that your origin is your existing XF site URL
    2. Using the domain name that Amazon assigns to you from the above step (eg.abc123zyx987.cloudfront.net), add the x2 below entries at the bottom of your library/config.php file (replacing 'abc123zyx987.cloudfront.net' for your .cloudfront.net domain name).

    // CDN support
    $config['externalDataUrl'] = 'http://abc123zyx987.cloudfront.net/data';
    $config['javaScriptUrl'] = 'http://abc123zyx987.cloudfront.net/js';
    melbo and Sim like this.
  11. melbo

    melbo Well-Known Member

    Thank you. I see that your avatars and image attachments are coming from cdn.netrider but your logo and header background images are being served from your server. How does Amazon know which to serve via Cloudfront?
  12. Mouth

    Mouth Well-Known Member

    Cloudfront serves anything you request from it, basically.

    The 2 lines in config.php tell XenForo to return to the client browser anything it is retrieving from /data/* and /js/* to come from your CDN instead. It would be great for XF to add a third line to be able to deliver static images from within /styles/* too. Presently, it's just the two (/js and /data). I will possibly edit my CSS and templates shortly so that the logo and bg images come from CDN too.
  13. DBA

    DBA Well-Known Member


    Mouth likes this.
  14. melbo

    melbo Well-Known Member

    So Cloudfront has basically grabbed your entire site and then XF just requests what it wants from it?
    Seems like a lot of waste for Amazon to store everything when you are only using a portion.
  15. Mouth

    Mouth Well-Known Member

    No, think of CloudFront as a globally dispersed proxy server. If a browser requests an object from CDN (as directed by your site), then the CDN will deliver from it's local storage. If it does not have it, then it will retrieve it from your server (origin). The CDN only retrieves the object from your server when it's requested by a browser, and it does not already have it. I doesn't 'mine' or 'scrape' your site looking for content, only specific objects a browser requests.

    Then add in some cache expiry control for being able to designate how often the CDN should refresh from your site.
    melbo likes this.
  16. melbo

    melbo Well-Known Member

    Wow. The toughest part was navigating the AWS site...
    Created and everything is working fine. I then made my logo served from CF as well as some custom forum description images that load on my forum home. Using Tinthe Image Attachment Optimization and also utilizing the CDN feature has every one of my image attachments on the edge servers. Can't wait til I see the bill next month :)
    Mouth likes this.
  17. melbo

    melbo Well-Known Member

  18. Mouth

    Mouth Well-Known Member

    Yes, worked fine for me.

    Did you enter cdn.survivalmonkey.com into CloudFront in the Alternate Domain Name (CNAME) field?
    I don't see a CNAME entry for cdn.survivalmonkey.com at your NS1.survivalmonkey.com though. Won't work if DNS lookup for cdn. fails ;)
  19. melbo

    melbo Well-Known Member

    Thanks. I removed the CNAME after thinking I had it wrong. I just added them back and will wait awhile and check again.
  20. Mouth

    Mouth Well-Known Member

    FYI ... still no cname appearing within your domain

Share This Page