Performance & Caching


When we talk about “performance” we’re ultimately talking about how fast from the time someone clicks a link to your site or types it in the address bar of the browser and hits “enter” does your site take to fully load. i.e. How efficient is your site + server setup to deliver content to your users? This is important because if your site loads too slowly it can only have negative impacts on you and your visitors.

One of the key factors Google and other top search engines grade your sites overall usefulness on is how quickly your site loads. This means, if your site loads slowly or inconsistently they will show you in their search results less often. They are in business to make money by pointing people towards relevant data as quickly as possible.

Live Performance Metrics Tools

These tools can help you understand how your sites are performing from the outside and what to do about poor performance.

Caching and Performance Metrics Software

The software listed here will help you solve performance and caching issues with your site. The majority of it will need to be run on a VPS, elastic or dedicated server you have full control over. Most of these methods will not work with shared hosting. If performance is important to you, shared hosting will not suit your needs.

  1. Code optimization
  2. Often there are many ways to accomplish a given outcome, some can be extremely inefficient or cumbersome. This step starts from the first line of code you write or include in your project and deserves proper forethought and planning.

  3. Code minification / combination
  4. We’re mostly talking about css and js files that can have whitespace and redundant code removed to reduce file size, as well as being concatenated into a single file to reduce requests to the server.

  5. Database optimization
  6. Test and refine your setup: mysql-tuning-primer-script (right click and “save as..”)
    Currently the script handles recommendations for the following:

    • Slow Query Log
    • Max Connections
    • Worker Threads
    • Memory Usage
    • Key Buffer
    • Query Cache
    • Sort Buffer
    • Joins
    • Temp Tables
    • Table (Open & Definition) Cache
    • Table Scans (read_buffer)
    • Table Locking
    • Innodb Status
  7. Image optimization
  8. Image optimization is one of the most forgotten or ignored areas. Many people often upload images full-sized from a camera without first preparing the images for use on websites. For 99% of all purposes, full-sized images are not required and and significantly increase load times or make a site impossible to view normally without abnormally long waits.

    Some tools to help with this




    PNG Quantizer:



    The Yeoman team have a Node.js wrapper called node-gifsicle that makes this available as a local dependency on OS X, Linux and Windows in case you’re interested.We have wrappers for optipng, jpegtran, pngquant too.


  9. Code caching
  10. This is a multi-level issue that also includes the above items. Below is a list of some of the most popular methods for achieving this.

    Caching can be done on the server with:

    • Varnish – Standalone caching HTTP reverse proxy.
    • Memcached – An in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
    • Redis – In-memory data structure store, used as database, cache and message broker.
    • Google mod_pagespeed – A Google Apache httpd / nginx module.
    • nginx reverse proxy caching server – A method of using nginx as a caching server in front of Apache httpd or other webservers.
    • PHP OPcache / PHP APC / APCu – Various PHP caching methods.
      • APC is opcode cache and data store.
      • APCu is only data store.
      • OPcache is only opcode cache.
    • Or with 3rd party / remote services:
      • CDNs / Content Delivery Networks – Remote data and resource storage / delivery / caching.
      • DOS Arrest – DDoS protection, caching proxy, CDN, and more.
      • CloudFlare – DDoS protection, caching proxy, CDN. and more.
      • Clients web browser: Google Chrome, Firefox, Safari, etc.
    • Apache httpd mod_cache, mod_expires, mod_gzip, mod_deflate and mod_headers

    • mod_expires

      ETags are difficult because they take precedence for caching in most browsers. You can change all the headers you want, but if the ETag associated with a file is always the same, caching will never work how you expect. In most situations, you should turn your ETag headers off to control this behavior.




  11. Or with caching plugins:
  12. As a last resort where the above options are not possible due to limitations of hosting or control, there are several plugin options at, none of which are recommended.

    For these reasons:

    • These plugins are trying to handle things too late in the process and often break perfectly working code or slow the site even more.
    • Many of these plugins use inefficient or cumbersome methods which may or may not work and may or may not benefit you.
    • Most people do not understand caching and these plugins are loaded with options that can break your site if you do not know what they’re doing.
Last Modified: 6 Nov, 2017 at 15:17:08