high performance wordpress

21
High Performance WordPress Gareth Davies

Upload: gareth-davies

Post on 09-May-2015

4.954 views

Category:

Technology


0 download

DESCRIPTION

My presentation from Wordconf 2011 about High Performance Wordpress. Covers tuning the whole LAMP stack, some stuff on Wordpress and Caching (both plugins and Varnish).

TRANSCRIPT

Page 1: High Performance Wordpress

High Performance WordPress

Gareth Davies

Page 2: High Performance Wordpress

Why performance?

•Speed

•so people don’t wait

•Scale

•serve as many requests to as many people as possible, concurrently

Page 3: High Performance Wordpress

LAMP

•A stack

•LAMP

•Linux

•Apache

•MySQL

•PHP

Page 4: High Performance Wordpress

WordPress

•Written in PHP

•Uses MySQL as the database

•Apache/nginx can be used for HTTP

Page 5: High Performance Wordpress

WordPress

•Core (installed)

•Themes

•Plugins

Page 6: High Performance Wordpress

OS Level Tuning

•You’re 64-bit by now

•Log errors, and nothing else

•TCP/IP settings

•Only run services that you need on a server

Page 7: High Performance Wordpress

OS Level Tuning

•Simple firewall to stop bots

•Read log files from logwatch -- hardware dies too

•vmem.sh

•Filesystem - XFS is best, EXT3, EXT4 are OK too

Page 8: High Performance Wordpress

Apache

•Tune Apache (httpd.conf)

•ab & httperf

•MaxClients

•Defaults are usually horrible

Page 9: High Performance Wordpress

MySQL•Defaults are terrible, use my.cnf

•mysqltuner.pl, tuningprimer.sh

•mytop

•Use maatkit + mk-query-digest

• See general & slow query log (for your plugin problems)

• InnoDB is better for concurrency, though by default you’re probably using MyISAM

•mysqlslap for benchmarking

Page 10: High Performance Wordpress

PHP

•Memory settings

•Opcode cache

•XCache, EAccelerator, APC

•php.ini

Page 11: High Performance Wordpress

WordPress

•Plugins are often horribly coded

•Themes can have direct calls to the database

Page 12: High Performance Wordpress

WordPress

•Look at wp_options tables

•Disable plugins

•Try the new Twenty Ten theme

•wp_config.php: WP_HOME, WP_SITEURL

Page 13: High Performance Wordpress

Still struggling?

•Content Delivery Networks (CDN)

•Minify

•Caching

Page 14: High Performance Wordpress

WP Caches

•WP Super Cache

•W3 Total Cache

Page 15: High Performance Wordpress

More you can do

•use mod_proxy and serve static content

•CDN: Amazon S3+CloudFront is affordable

•use browser cache (set long expires)

Page 16: High Performance Wordpress

Separate machines

•2 machines

•web server

•database server

•memcached servers?

Page 17: High Performance Wordpress

Varnish

•Varnish serves everything from memory

•httpd on a different port, run varnish on port 80 and point it to httpd port

Page 18: High Performance Wordpress

Further growth

•Its now time to think about MySQL replication (master-slave setups)

•memcached to keep caches of query results (up to 1M) in memory

•HyperDB supports data partitioning, and can read from multiple databases

Page 19: High Performance Wordpress

WordPress.COM

•several billion HTTP queries per day, billions of MySQL queries too

•HP hardware, all SSD

Page 20: High Performance Wordpress

HipHop from Facebook

•http://huichen.org/en/2010/06/wordpress-3-benchmark/

•http://huichen.org/en/2010/06/wordpress-3-benchmark-part-2/

•~2.7x improvement in performance

Page 21: High Performance Wordpress

Find Me

•@ShaolinTiger on Twitter

•http://www.shaolintiger.com – My Blog

•shaolintiger at gmail – Email me