Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordPress at Peak Performance

WordPress at Peak Performance

A presentation by Jared Smith at the Charleston WordPress User Group meetup, August 13, 2013

More Decks by WordPress Charleston User Group

Other Decks in Technology


  1. Three Factors in Speed • Where and how you host

    your site and its static assets • How you cache WordPress’s generated pages so it can work a little less • How well your theme and plugins are optimized Tuesday, August 13, 13
  2. Hosting is Everything • Shared hosting is very hard to

    optimize for lots of traffic -- it’s not impossible, but after a while, you’ll need more • Virtual private servers give a lot more flexibility for just a little more a month • Larger sites may want to consider a dedicated server • Managed WordPress hosting is a great option for budgets between VPS and dedicated servers; a LOT less to think about Tuesday, August 13, 13
  3. Managed WordPress Hosting • They take care of (most) of

    the technical stuff for you! • Often no caching plugins to deal with, other benefits such as a content delivery network (CDN) Tuesday, August 13, 13
  4. Popular Managed Hosts • WordPress.com is the most popular hosted

    service • WPEngine: Managed WordPress hosting that gives much more flexibility than WordPress.com. Pricing tiered by bandwidth usage. http:// www.wpengine.com • DreamPress: New service from DreamHost; very beta, I haven’t tested it yet. Pricing flat at $19.95/ mo. http://dreamhost.com Tuesday, August 13, 13
  5. A Fast, Modern WordPress Stack • nginx: a stable, lightweight,

    and extremely fast Web server, used in place of or in front of Apache (though I like to use it in place of Apache); http://nginx.org • PHP-FPM (PHP FastCGI Process Manager); server process that handles all PHP requests; http://php- fpm.org • MySQL 5.5 uses InnoDB, a more robust database engine, by default; http://www.mysql.com Tuesday, August 13, 13
  6. Benefits to nginx • Serves up static files very quickly

    with a very minimal memory footprint (great for small VPS setups) • Only runs PHP when it is needed, saving on memory usage overall • Well-supported in the WordPress community • http://wordpress.org/plugins/nginx-helper/ Tuesday, August 13, 13
  7. Tuning PHP • Make sure APC (Alternative PHP Cache) is

    installed • APC is an opcode cache -- it basically stores WordPress in memory, helping WordPress run much faster than being reinterpreted from disk • http://php.net/manual/en/book.apc.php Tuesday, August 13, 13
  8. Caching • Helps WordPress do less work to serve pages,

    makes things much faster both on the front end of the site as well as on the back end (more resources available for administration) • A necessity for busy sites Tuesday, August 13, 13
  9. Caching plugins • WP Super Cache is a great start

    and works fairly well on most shared hosts; it’s easy to configure and typically trouble-free; http:// wordpress.org/plugins/wp-super-cache/ • W3 Total Cache is the most comprehensive; you can get a lot out of it especially on a VPS or dedicated server, but it requires fine-tuned configuration; http://wordpress.org/plugins/w3- total-cache/ Tuesday, August 13, 13
  10. Tuning W3 Total Cache • On shared hosts, there’s not

    typically much you can do. Disk (enhanced) caching for pages will get you some gains. • Use APC where you can to store things like the object cache and database cache, but watch that memory usage if you’re on a low- memory VPS • W3 Total Cache can integrate with many content delivery networks including CloudFront and MaxCDN (more on CDN in a few) • Ensure browser caching options are enabled • Installation guide: http://wordpress.org/plugins/w3-total-cache/ installation/ Tuesday, August 13, 13
  11. nginx FastCGI Cache • With nginx’s FastCGI cache, you don’t

    need a caching plugin; just make sure you have the nginx Helper plugin installed, and it will be sure to purge nginx’s cache at the appropriate time • http://rtcamp.com/wordpress-nginx/tutorials/ single-site/fastcgi-cache-with-purging/ Tuesday, August 13, 13
  12. Frontend Optimization • Tuning the server and caching WordPress is

    great, but if you are loading jQuery three times... • Check for and deactivate any plugins you don’t use -- these often litter every page load with scripts, some unnecessary • Make sure plugins and themes are using wp_enqueue_script to load JavaScript; this ensures WordPress only loads certain scripts once Tuesday, August 13, 13
  13. Mind Your Scripts and Styles • Generally, most scripts should

    load at the footer of the page. Loading scripts in the header or body (with the exception of a few, notably Google Analytics) can block page load • Don’t use inline CSS if you can at all help it • Minify your CSS and JavaScript files; W3 Total Cache can do this • Make sure gzip compression is turned on to reduce the amount of bandwidth you use; again, W3 Total Cache makes this easy to take care of • Test your frontend with tools like YSlow (http://developer.yahoo.com/ yslow/) and Google Page Speed (https://developers.google.com/ speed/pagespeed/) Tuesday, August 13, 13
  14. Hosting Static Assets • Static assets include theme files, images

    you upload to blog posts/the media library, etc. • Moving static assets to a content delivery network will improve performance and reduce load on your server Tuesday, August 13, 13
  15. CDN Services • Photon; part of Jetpack, free to use:

    distributes your media library images over WordPress.com’s CDN, but it does not distribute your theme files. http://wordpress.org/plugins/ jetpack/ • MaxCDN: Well supported by W3 Total Cache and overall in the WordPress community. Many large blogs use MaxCDN and costs are reasonable (using flat monthly fees). http:// www.maxcdn.com • Amazon CloudFront: Distribute your static files over Amazon’s network; costs are reasonable but aren’t flat -- you pay for the bandwidth you use. http://aws.amazon.com/cloudfront/ Tuesday, August 13, 13