Performance using Grunt tasks, WP plugin, .htaccess, mod_pagespeed, CDN, et al?

Trying to optimize the site performance on one or two of my projects which I’m using Roots, I realize there are a lot of options to use. Here’s what I understand about the available options:

  1. Grunt tasks - this is pretty obvious, where it includes minifying. Good first step
  2. Caching/compressing/concat plugins like Supercache, W3TC., etc are now not recommended, as pointed out to me here even though it’s still listed at the bottom of the Starter theme page. Then we have the homegrown plugins on Roots own page, which leads to…
  3. .htaccess plugin - Obviously built and optimized for Roots/WP, it seems the obvious choice and should cover everything the above plugins could handle. So right now, I’m defaulted to this. But then you have more options available for further tweaking such as…
  4. mod_pagespeed - My host gives me the option to turn this on. Considering the above plugin already does this, and we have Grunt tasks to handle some other parts of this, is there any benefit to using this? Would it be incompatible with another process Roots uses?
  5. CDN - My host also gives us access to Cloudflare (or it could be Akamai, Amazon, MaxCDN, etc.) . Using any or all of the above, could this further help us tune the site? Maybe just use Cloudflare for images? Run the whole site through Cloudflare after all these tasks?
  6. So then there are techniques like using BootstrapCDN, Google CDNs for JS, and others. What about incorporating UnCSS to get rid of unused CSS? It seems irresponsible to use the complete Bootstrap library but also quite daunting to figure out which modules in both JS and CSS to lose.

I’m really curious what best practices that you follow that speed your sites up that I’m missing or don’t know. Performance should be just as important and written up on here as installation and configuration.

1 Like

I’ve had too many headaches when trying to use wp cache plugins and CDNs, so I don’t bother with those any more.

Honestly with the following you should have your site going at a fair clip:

For Apache setup:

  • php5-fpm
  • varnish
  • apc

For Nginx:

  • php5-fpm
  • apc
  • tune some of the nginx.conf settings for gzip and other types of caching (there’s various guides out there for tuning and testing this).

Nginx will typically outperform Apache - hence why most here would now use Nginx in preference to Apache.

I would also use Modernizer for selecting which pages to load certain scripts, instead of loading everything on every page.

1 Like

I found it pretty painless to integrate UnCSS with Grunt: Getting rid of unused CSS