SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Scaling Dynamic WordPress Sites - WordCamp US 2015
Page caching doesn’t work for everyone! Sites that handle a large number logged-in users like Membership sites, Multisite networks, BuddyPress sites, or bbPress forums need special treatment to scale effectively. I’ll share my experience in building and managing large Multisite networks to give tips and tricks to speeding up your dynamic websites and coding for scale.
Page caching doesn’t work for everyone! Sites that handle a large number logged-in users like Membership sites, Multisite networks, BuddyPress sites, or bbPress forums need special treatment to scale effectively. I’ll share my experience in building and managing large Multisite networks to give tips and tricks to speeding up your dynamic websites and coding for scale.
Scaling Dynamic WordPress Sites - WordCamp US 2015
1.
Scaling Dynamic
WordPress Websites
WordCamp US Dec. 5th, 2015
2.
Who am I?
Aaron Edwards
@UglyRobotDev
https://profiles.wordpress.org/uglyrobot
, , and CAMPUSPRESS
• CTO of Incsub
• WordPress developer
since 2.6, specializing in
Multisite
• Creator of lots of plugins
and services
3.
One size doesn’t fit all
• Most caching plugins and performance talks
focus on Full Page Caching
• Does nothing for dynamic websites!
Membership Sites
WordPress Multisite
4.
Page Generation Time (ms)
0 100 200 300 400 500 600
29ms200ms300ms
PHP Database Web External
Google Pagespeed recommends 200ms max!
Page Generation Time
5.
Database Optimization
• Limit and optimize queries
• https://wordpress.org/plugins/query-monitor/
• Optimize MySQL config
• Query cache
• MySQLTuner
• Convert high-write tables to InnoDB
• Switch to MariaDB (10-20%) or AWS Aurora (2-3x)
or keep the queries from ever getting to your DB…
7.
Object Caching Plugins
• Memcached - Recommended
• http://wordpress.org/extend/plugins/memcached/ or W3TC
• Redis - Recommended
• https://wordpress.org/plugins/redis-cache/
• APC
• https://wordpress.org/plugins/apc/ or W3TC
• File Based - not recommended
wp-content/object-cache.php
8.
PHP Optimization: Code Profiling
• Beginners: P3 (Plugin Performance Profiler)
• https://wordpress.org/plugins/p3-profiler/
• Advanced: Xdebug + (web/win/k)cachegrind
• Easiest way is the VVV local development
environment
• On Production:
9.
PHP Optimization: Worst Offenders
1. Unnecessary/unoptimized queries
1. Use wp_cache_* functions (object cache required)
2. Per-pageload database writes (stats, redirection, logging
plugins)
2. Watch out for remote requests!
1. Use low timeouts
2. Cache as long as possible, not in transients
3. Flushing rewrite rules poorly
4. Direct filesystem access
10.
Speeding Up PHP
• Use NGINX instead of Apache
• In Multisite use a CDN or Varnish
• Move Session storage to RAM
• Upgrade PHP to 5.5 or 5.6
• Enable and configure OPcache
• Make sure code base fits in cache size:
• opcache.memory_consumption
• opcache.max_accelerated_files
• Increase revalidation frequency:
• opcache.revalidate_freq
11.
Switch to HHVM or PHP7!
http://talks.php.net/fluent15#/wpbench