Varnish and CDN but which one first?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
JeremyFrench's picture

I am working on a site, which will eventually use both varnish and a CDN and I am going to implement both of these solutions.

What I am unsure about is which one first. The server at the moment can handle the load that it is getting, so my thoughts are which will get the page into the hands of the user quickest.

I am sure that this could be argued either way, but do people have guidelines or weighing factors as to which way round these should be implemented.

Comments

Varnish then CDN

skwashd's picture

In order to implement Varnish or a pull CDN you need many of the same features enabled.

Varnish can sit in front of your site as an act as the caching gate keeper. A pull CDN will cache content/assets on the edge of the network. When a CDN node doesn't have a copy of the page or asset it will call back to the origin (aka your server) for that item. If you don't have Varnish in place and are using a CDN with many POPs (points of presence) your server will still get hammered with requests when adding new content.