![Page 1: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/1.jpg)
Speed up your WordPress siteAlan Lok WirelessLinx Inc.
![Page 2: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/2.jpg)
Motivations
User experience1
Search engine optimization2
Your wallet
Less on-call issues!
1: http://www.webperformancetoday.com/2012/02/28/4-awesome-slides-showing-how-page-speed-correlates-to-business-metrics-at-walmart-com/ 2: http://googlewebmastercentral.blogspot.ca/2010/04/using-site-speed-in-web-search-ranking.html
![Page 3: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/3.jpg)
What is a LAMP stack
Database PHP Engine
Your app
Operating System
Web Server
Performance gains can be found in each layer
Reverse Proxy
Cache
![Page 4: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/4.jpg)
Internal Tune-upsDigging into your WordPress site to make it better
![Page 5: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/5.jpg)
The simple stuff
Update your plugins
Remove unused themes and plugins
404 errors
![Page 6: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/6.jpg)
WordPress plugins to speed things up
W3 Total Cache
Super Cache
Zen Cache
![Page 7: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/7.jpg)
Redu
ceIm
ages
, JS
, CSS
Reuse
Code
(CSS, JS,
HTML, PHP)
RefactorHTTP Response Content Body
![Page 8: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/8.jpg)
Profile your applicationAnalyze your application with a PHP profiler such as BlackFire.io or xdebug/cachegrind
Look for high number of apply_filters, mysql calls, and wp_cache_get
![Page 9: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/9.jpg)
Profile your DOMMake your page render faster too
![Page 10: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/10.jpg)
Database
Check your slow query log
Debug: log your database queries
Try to “explain” your query
Trim un-needed data (comments, deleted posts, etc…)
![Page 11: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/11.jpg)
Have you been hacked?
Hacked instances are typically slower because of additional JS/PHP payload
Check your installation / hosting environment
Some command line tools: wp-cli, findbot.pl
Online tools: https://sitecheck.sucuri.net/ and Google Webmaster Tools
![Page 12: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/12.jpg)
Operational ImprovementsImprovements you can make outside WordPress
![Page 13: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/13.jpg)
You get what you pay forThere is no such thing as “unlimited” hosting or space
Ensure you are paying for the level of performance you expect given the traffic estimates
Diminishing returns on performance when buying more resources
![Page 14: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/14.jpg)
DatabaseMySQL versions and variations (MariaDB, Percona, Community)
DB Engine: Convert tables from MyISAM to InnoDB
Some* my.cnf tuning
InnoDB buffer size, Query Caching
HyperDB for database splitting*
Some performance references: http://www.liquidweb.com/kb/mysql-5-1-vs-5-5-vs-5-6-performance-comparison/ https://www.percona.com/blog/2011/10/10/mysql-versions-shootout/ http://vbtechsupport.com/657/
![Page 15: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/15.jpg)
Web Server TechnologyWeb server technologies:
nginx vs Apache
PHP process management in Apache
php-fpm vs mod_php vs hhvm
prefork, vs worker/event
mod_pagespeed, php-opcache
When does it matter?More food for thought: http://blog.bitnami.com/2014/06/performance-enhacements-for-apache-and.html https://www.digitalocean.com/community/tutorials/apache-vs-nginx-practical-considerations http://hhvm.com/blog/9293/lockdown-results-and-hhvm-performance
Credit: Digital Ocean
![Page 16: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/16.jpg)
HTTP changes
Content compression
Expiry headers for content type
Cache directive
References:https://tools.ietf.org/html/rfc7234 http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching?hl=en
![Page 17: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/17.jpg)
Content DeliveryReducing number of access to your web server will reduce your costs (bandwidth and CPU needs)
Consider using public CDN for shared JS/CSS
Pay for a cheap CDN and use a plugin to rewrite your assets to the CDN
![Page 18: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/18.jpg)
Web Application Protection*SaaS: Sucuri / CloudFlare / Incapsula / Akamai
Plugins: WordFence / Better WP Security
Spam Protection: Akismet
PHP: suhosin
Server: mod_security
*not an exhaustive list or endorsement
![Page 19: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/19.jpg)
Monitor your siteApplication Performance Monitor (eg. New Relic, AppDynamics)
Server Monitoring (eg. LongView, CloudWatch, DataDog)
Last mile / Page Health (eg. Pingdom, New Relic Synthetics, Gomez)
![Page 20: Speeding up your WordPress Site - WordCamp Toronto 2015](https://reader033.vdocuments.mx/reader033/viewer/2022042906/589dc6fc1a28abf45d8b4857/html5/thumbnails/20.jpg)
Thanks!Twitter: @alan_lok Web: http://wlx.ca
Slideshare: www.slideshare.net/alanlok1