Black Friday Optimisation Check List for Developers

Database

Basic database preparation and maintenance

Log in to phpMyAdmin, and look at the tables overview for your database.

  1. All tables should be InnoDB or MEMORY. All MyISAM tables should be converted to InnoDB
  2. Run “Analyze tables” on all tables in your database.** This will force indexes to be rebuilt and optimised, which will improve performance.
  3. While there is no traffic on your site, you may also run “Optimize tables”.

Warning! This is a very resource-heavy job and may stall your database, so use it with care. It will recreate tables and will lock the database while doing so. This optimizes the order and size of your tables and indexes and improves performance.

More Advanced Tasks

  • MySQL Slow Log.
    To generate a MySQL Slow Log, ask Support by chat or mail to check the mysqld.slow log for your website, and send you any slow queries.
  • Query optimisation – Make sure all frequent queries make proper use of database indexesLack of index usage is the most common cause of degraded database performance.
  • Limit the number of database queries.
    In your application, you should be able to track what queries are executed on every page. It is normal to run a few hundred queries for one page load, but sometimes developers make code that escalates this into thousand, or thousands. This will not perform well under any circumstances and should be fixed in your application.

Back End

Servebolt Control Panel – Site Settings tab

  • Developer mode must be switched off
  • Caching must be set to “Static” or “All”
    “All” only has an effect if your application provides correct headers for Full Page Caching. Caching should never be set to off in production environments.
  • Reduce the PHP Memory Limit setting Set it to the lowest possible working value. This increases scalability and allows for more concurrent traffic.

Log files

~/logs/AccessLog

The AccessLog file contains a list of all requests that are served by the backend server Apache. Cached elements are served directly from Nginx, and will only show up in this log file when they are read for the first time, or re-read later.

  • Check for Amplification requests.
    When a page is requested, this should not result in multiple PHP hits.
  • Fix 403 / 500 / 503 and other errors.
    Check the logs for occurrences of the error codes, and fix the bugs you find.
  • Fix 404 errors.
    Missing elements may not sound like a big deal, but it makes the front-end slower (the browser needs to figure out that this does not exist) – and more importantly, every 404 request is passed back to the backend server – taking up unnecessary resources
  • Limit Redirects.
    Make sure you link correctly on your pages. WordPress for instance, redirects with a trailing slash for all pages – so links should point directly there. This saves a round-trip and speeds up the user experience.

~/logs/ErrorLog

The rule of thumb is that the ErrorLog should not contain any errors.

  • Check and fix All PHP bugs.
    All PHP errors are logged here unless your application overrides this. 

Application logs

  • Make sure debug logging is disabled.
    Extensive debug logging may slow down your site
  • If your application provides its own logs, fix errors in them.
    For example, Magento has system.log, exeption.log and reports

Cron Jobs

  • Run Cron as real cron jobs, not using wget over http.
  • Reduce the frequency you run cron jobs.
    Do you run cron more often than strictly necessary? Running cron less often increases the resources available for page serving.

Front End

When all of the above is done, you have an optimised back-end – but there is more performance to gain by optimising your front end.

The importance of error-free HTML, CSS and JS should not be underestimated. Your page may look like it should, but it may spend way too many resources rendering it. 

The browser spends most of its time rendering your page. Any error will take extra time, compared to a bug-free site – slowing things down.

  1. Clean up – eliminate bloat
  2. Fix all bugs
  3. Fix HTML Bugs (use W3C Validator to check your various page types)
  4. Fix CSS Bugs (use CSS Validator)
  5. Fix JS Bugs (check the error console in your browser)