Basic database preparation and maintenance
Log in to PhpMyAdmin, and look at the tables overview for your database.
- All tables should be InnoDB or MEMORY. All MyISAM tables should be converted to InnoDB
- Run “Analyze tables” on all tables in your database.** This will force indexes to be rebuilt and optimised, which will improve performance.
- 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 with care. It will recreate tables and will lock the database while doing so. This optimizes order and size of your tables and indexes, and improves performance.
More Advanced Tasks
- Mysql Slow Log.
Ask service by chat or mail to check the mysqld.slow log for your website, and send you any slow queries by email.
- Query optimisation – Make sure all frequent queries make proper use of indexes. Lacking use of indexes is the most common cause for 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 some times 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.
Servebolt Control Panel – Site Settings tab
- Developer mode must be switched off
- Caching must be set to “Static” or “All”
“All” only has effect if your applications provides correct headers for Full Page Caching. Caching should never be set to off in production environments.
- Reduce the PHP Memory Limit setting Set ut to the lowest possible working value. This increases scalability and allows for more concurrent traffic.
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.
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 they your application overrides this.
- Make sure debug logging is disabled.
Extensive debug logging may slow down your site
- If your application provides it’s own logs, fix errors in them.
For example Magento has system.log, exeption.log and reports
- Run Cron as real cron jobs, not using
- 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.
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 to 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.
- Clean up – eliminate bloat
- Fix all bugs
- Fix HTML Bugs (use W3C Validator to check your various page types)
- Fix CSS Bugs (use CSS Validator)
- Fix JS Bugs (check the error console in your browser)