WordPress
Optimization



  WordPress Optmization
             ben metcalfe | WP Engine
           @dotBen | ben@wpengine.com



               WordCampPhilly 20011




WP
WordPress
Optimization


                   Why?
 •   Um, why not?
 •   Keep readers/customers happy!
 •   Stay up under heavy load
 •   Save $$$




WP
WordPress
Optimization


                 Level 1
       Let‟s get the basics out the way :)




WP
WordPress
Optimization


     Keep WP up to date
               Why wouldn‟t you?




WP
WordPress
Optimization


   Caching plugins FTW!!
               W3-Total-Cache

        also: WPSuperCache, BatCache




WP
WordPress
Optimization
      Deactivate unused
           plugins
      + delete plugins you don‟t use at all




WP
WordPress
Optimization


       Avoid bad plugins
     Include (but not limited to)
     • backupwordpress
     • backwpup
     • broken-link-checker
     • dynamic-related-posts
     • file-commander
     • google-sitemap-generator
     • LinkMan (MyReviewPlugin Link Man)
     • MyRP (MyReviewPlugin)
     • wp-symposium-alerts

WP
WordPress
Optimization


       Review your theme
 HTML
 • does it validate?
 • CSS at the top, JS at the bottom (not inline)

 PHP
 • Any weird code (if it looks bad, it probably is)
 • file_get_contents() / fgets()

WP
WordPress
Optimization


       Is your host slow?




WP
WordPress
Optimization


               Level 2




WP
WordPress
Optimization


  Offloading (poor-mans CDN)
         Serve images via Flickr/etc




WP
WordPress
Optimization
 Feedburn your RSS feed

   How many requests to your blog are /feed?




WP
WordPress
Optimization


  Repair your MySQL DB
     Sometimes you need to tidy your room :)

      PHPMyAdmin, OptimizeDB, manually




WP
WordPress
Optimization
      Load from multiple sub-
             domains
                    good:
  foo1.yourdomain.com, foo2.yourdomain.com

                    better:
  foo1.otherdomain.com, foo2.otheromain2.com



WP
WordPress
Optimization


       Browser Caching
            HTTP Cache-Control
              Expires headers
                Entity Tags

      (W3-Total-Cache, WPSuperCache)



WP
WordPress
Optimization


               Level 3
        Mostly assumes SSH access




WP
WordPress
Optimization
       Log slow MySQL
           queries
  Good HOWTO: http://hackmysql.com/nontech




WP
WordPress
Optimization


 Check site with Profile Tools
                  WP-Tuner
                WPDB Profiling
         http://speed.wpengine.com
                    YSlow




WP
WordPress
Optimization


                   CDN
       MaxCDN (used @ WP Engine),
           Amazon CloudFront
               CloudFlare

     Use all the time or just „emergencies‟



WP
WordPress
Optimization


     „Smush‟ your images
               WPSmush.it plugin




WP
WordPress
Optimization


     APC/ opcode cache
         php-apc + W3-Total-Cache




WP
WordPress
Optimization


     Apache optimizations
       Disable .htaccess, use httpd.conf




WP
WordPress
Optimization
     Dedicated MySQLDB
             Box




WP
WordPress
Optimization


                 Level 4
               Hitting the big time




WP
WordPress
Optimization
      Reverse-proxy with
            nginx
            Run Apache on port 8080
                 Cache statics
     (good HOWTO on wp-performance.com)




WP
WordPress
Optimization


          Varnish cache
      Ideally don‟t run Varnish on port 80,
               Avoid cookie issues




WP
WordPress
Optimization


               Memcache
      Ideally run Memcache on separate box
     Use same datacenter, ideally same subnet




WP
WordPress
Optimization


               HyperDB
         Multiple database servers




WP
WordPress
Optimization


           Boss Level




WP
WordPress
Optimization
     Static site on Amazon
                S3
           “Movable Type” Model
             100% Static site




WP
WordPress
Optimization


               #Fails




WP
WordPress
Optimization


     DON‟T edit core files!
 No matter what “performance” benefit you think
                  it will make!




WP
WordPress
Optimization


         Amazon EC2
           … isn‟t a silver bullet




WP
WordPress
Optimization
               Q&A




WP

Optimizing WordPress (WordCamp Philly 2011)