1 / 28

WordPress Optimization

WordPress Optimization. markkelnar | WP Engine @renderandserve | howdy @wpengine.com wpengine.com/optimizing-WordPress WordCamp Atlanta 2012. Who is this guy?. Head of Technology, System Administration, database, product development at WP Engine

parley
Download Presentation

WordPress Optimization

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WordPress Optimization markkelnar | WP Engine @renderandserve | howdy@wpengine.com wpengine.com/optimizing-WordPress WordCamp Atlanta 2012

  2. 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();

  3. Why are you here? You want your site fast Keep readers/customers on your site Survive heavy visitor load Scale – When you're on techcrunch, mashable or daringfireball, you want to survive

  4. You are doing it wrong! But you don't know it.

  5. Who are you? Site admin, content contributor Designer, theme developer Plugin developer Backend developer, admin, dba, etc.

  6. What can I optimize? Hosting is about layers, but which one? Layman's term, not that techno-jargon ... HTML, CSS, JS, images, web server, database, WordPress, theme, plugin, cache, minify LAMP, TTL, CDN, cache, Apache, PHP, static content, dynamic content

  7. 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)

  8. 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

  9. 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

  10. 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

  11. Reduce, reuse WPSmush it plugin Everytime you add an image, it does it for you. Yahoo! Smush all your existing images. Do the other fun front end developer things Minimize HTTP requests – CSS sprites CSS at the top of the page, JS at the bottom Search for “Yahoo performance rules” Ads on your page Load them asynchronously or maybe iframe. Are your ads cache busting? Do they have to?

  12. Load from multiple sub-domains yourdomain.com good: foo1.yourdomain.com, foo2.yourdomain.com better: foo1.otherdomain.com, foo2.otheromain2.com Difficult to do. More overhead to configure and support.

  13. That's front end tweaks Now what? What good is a fast front end with a slow back end? What if the back end can't handle what still comes through?

  14. Review your theme Theme – know your theme. Did you buy it? Codex? Off the street? 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) - weary of file_get_contents() / fgets() - base64_decode() (injected malware or unnecessarily compressed code)

  15. Pull your data wisely What could possibly go bad here?

  16. Keep WP up to date Why wouldn’t you? Code optimizations, core changes, security

  17. Unused plugins - deactivate plugins you don’t use at all - delete plugins you don’t use at all

  18. Beware of poor performers Bad PHP code Poor use of DB calls, update/insert to DB on every page load Don't scale under load, cripple the back end Put stuff on wp-cron scheduler that pops too often. Ex: (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

  19. RSS feed How many requests to your blog are /feed? Are you using a service like feedburner?

  20. Show me the cache! Let's start with plugins W3-Total-Cache, WPSuperCache Has features to do CDN path rewrites, page and object and db caching, minification, cache purging/clearing WP-Minify JS, CSS – remove white space, comments sent to end user (browser)

  21. Browser Caching What is it? HTTP Cache-Control, Expires headers, Entity Tags (ETags) Already done for me? W3-Total-Cache, WPSuperCache Gzip compression on server and uncompressed in browser

  22. Server side caching What is it? saves bandwidth and improves performance HTTP Accelerator server– reverse proxy caching behind nginx Memcached server – object caching, persistent vs transients opcode: caching compiled PHP code bytecode object caching: in memory key-value storage for data, transients page caching: full caching of HTML page Tools for the job: APC, Eaccerator, Xcache, Zend Optimizer, ionCube

  23. 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

  24. 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

  25. If you're reading this, you're too geeky Server: metal server vs virtual or cloud instance OS: *nix, sun, MS Packages: compiled, package installed Hardware: CPU + cores, memory, SSD disk drives DB: MySQL, Percona,

  26. 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.

  27. Q&A

More Related