WordCamp Tampa – WordPress Performance Workshop by Mark Jaquith
Why does performance matter?
People hate lag. Amazon projects that 1 sec translates to 1.6 billion a year
WordPress has a bad rap. Lots of plugins. Complex front-ends.
WordPress is dynamic.
WordPress has no persistent caching in the core and is hands-off in regards to caching.
Chrome HTML render time is everything (server, network, browser, etc) and isn’t just WordPress specifically.
You can use WordPress to time how long the rendering takes.
- 3+ is emergency
- 1-3 is slow
- 500ms to 1sec is okay
- 250ms to 500ms is good
- <100 ms is amazing
Your web host maters. “Commodity hosts” are bad. They cost cheap but are going to be slow. No caching engine or low-level access.
WordPress managed hosts do performance better and some have caching built in.
Managed WordPress hosts:
- WP Engine
The best is to have your own VPS. Look for a company that has been around for a while and has good performance. Cost? Tools?
Linode and Digital Ocean are good WordPress companies.
- nginx – config: http://bit.ly/jaquith-nginx
- PHP-FPM – http://php-fpm.org/
- Make sure to use the latest version of PHP
- Check into http://hhvm.com/ for performance (but might be unstable)
- Make sure to use query cache
- Use mysqltuner.pl for tuning
- HyperDB for scaling large sites and DB replication
Least elegant but most effective is to cache the HTML output.
You can do caching right in nginx, you can use Varnish or WordPress plugins.
APC & APCu are two caching engines. Fast, in-memory data store. Good for running one server.
If you’re using multiples servers, you need redis or memcache.
WordPress core can use these cache layer, but there are wp_cache_* commands that you can use to program.
- PHP-FPM & nginx: nginx -> nginx -> php
- Or: nginx -> varnish -> nginx -> php
Tools to use
- Chrome inspector
- Firefox inspector
- New Relic
- P3 (WordPress Plugin)
- WP Top (WordPress plugin – on github)
- Use time_stop(true, 5) (wrapped in comments)
- Apache Bench / Siege / Blitz.io