Professional Documents
Culture Documents
WordPress Optimization
markkelnar | WP Engine @renderandserve | howdy@wpengine.com wpengine.com/optimizing-WordPress
WordPress Optimization
Who is this guy?
Head of Technology, System Administration, database, product development at WP Engine
I'm not a power-point guy, please excuse my mistakes. If I had my way, this presentation would look like this
class WCATL extends presentation { protected $name; function __constructor() { parent::__constructor(); $this->name = 'Word Camp Atlanta'; $this->bg_color = '#808080'; } } $p = new WCATL(); $p->scroll();
WordPress Optimization
WordPress Optimization
WordPress Optimization
WordPress Optimization
WordPress Optimization
Where do I start?
Use profiling tools to find your bottleneck WP-Tuner WPDB Profiling WPspeedometer.com Yslow webpagetest.org yougetsignal.com (reverse IP address) Command line fun: `ab -n 100 http://wpengine.com` (Apache Benchmark) `curl -I wpengine.com` (that's a dash-eye)
WordPress Optimization
WordPress Optimization
CDN
Content Delivery Network
Have another service serve your static files (jpg, js, css) from their domain Say that again? Off-load statics (jpg, png, css, js) so it doesn't load from your web server Store static files closer to end user global proximity Paths in your HTML point the browser to the CDN service: cdn.yourdomain.com/wp-content/themes/image.png Cloud cache service (CloudFlare), Amazon S3, etc
WordPress Optimization
CDN
Paths It's all in what your HTML tells the browser
Without CDN <img src="http://markkelnar.com/wp-content/uploads/family.jpg" alt="shredder" /> With CDN <img src="http://mark.some-cdn-service.com/wp-content/uploads/family.jpg" alt="shredder" /> When the service mark.some-cdn-service.com needs the image, after TTL has expired, the cdn service loads (pulls) a fresh copy from markkelnar.com
WordPress Optimization
Off-loading content
Poor-man's CDN, serve images from Flickr Amazon S3 host entire site there, or even just statics Use external source for comments, like disqus-comment-system Popular posts / related content metrics outbrain, nrelate
WordPress Optimization
Reduce, reuse
WPSmush it plugin
Everytime you add an image, it does it for you. Yahoo! Smush all your existing images.
WordPress Optimization
WordPress Optimization
WordPress Optimization
PHP
- Any weird code (if it looks bad, it probably is) - weary of file_get_contents() / fgets() - base64_decode() (injected malware or unnecessarily compressed code)
WordPress Optimization
WordPress Optimization
Keep WP up to date
Why wouldnt you? Code optimizations, core changes, security
WordPress Optimization
Unused plugins
- deactivate plugins you dont use at all - delete plugins you dont use at all
WordPress Optimization
WordPress Optimization
RSS feed
How many requests to your blog are /feed? Are you using a service like feedburner?
WordPress Optimization
WP-Minify
JS, CSS remove white space, comments sent to end user (browser)
WordPress Optimization
Browser Caching
What is it?
(ETags) HTTP Cache-Control, Expires headers, Entity Tags
Already done for me? W3-Total-Cache, WPSuperCache Gzip compression on server and uncompressed in browser
WordPress Optimization
WordPress Optimization
Web server
- Move as much as possible out of Apache - Stand up Nginx in front of Apache (reverse proxy) - Don't run your PHP in Apache at all, use PHP Fast CGI, lighthttpd, etc. - Server static files from disk in Nginx - Put known redirects (301/302 in Nginx config) - Move .htaccess rules to Apache httpd.conf or better yet Nginx config. - Google Page Speed Apache module
WordPress Optimization
MySQL DB
- Optimize tables, clean house - PHPMyAdmin, OptimizeDB, manually - Tables, Innodb (transactional, faster for writes) vs MyISAM (can be less memory) - Master/Slave replication + HyperDB - dedicated server(s) - turn on log and investigate mysql-slow.log - database caching - mysqltuner.pl
WordPress Optimization
WordPress Optimization
No-Nos
- Don't edit WP-core files (wp-includes, wp-admin) - Amazon EC2 not silver bullet - Beware of plugins that update database tables on every page load. Use external resources.
WordPress Optimization
Q&A