#wcnyc: Performance & Optimization

Matt Martz (@sivel) and Scott Taylor led one of the first sessions on WordPress performance and optimization.

“High performance is not high availability.”

Matt manages five personal servers, including one load balancer, two web servers, and two database servers. The Nginx load balancer is a 512 MB slice from Slicehost, web servers are Nginx with FastCGI and 1 GB a piece, and the MySQL database servers are 512 MB. HyperDB is a WordPress plugin which allows you to partition out your database. Matt has it configured such that reads are done from all of his databases, while writes are only to the master database.

Caching is done with Memcached, PHP APC caching, and Batcache. WordPress.com is Memcached, HyperDB and Batcached. LoadImpact.com allows you to load test your site with between 10 and 50 concurrent users and will give you the page load times based on the number of users. Matt’s load times start at about 1.75 seconds and actually go down over time because caching kicks in.

GlusterFS is a system utility to replicate data across all of your production web servers. Upload an image to one, copy to every. GlusterFS is nice because it works on both physical and virtual machines. Matt has the WordPress directory, PHP directory, and Nginx configuration syncing across his web servers.

In total, he easily handles 4 million pageviews/month across all of the machines.

“If it appears slow, it’s often because of the front-end.”

Scott Taylor discussed front-end optimization.

First, ensure the HTML code you write is semantically correct. The TwentyTen theme packaged with WordPress is a good example to follow. Overrides follow the rule of IDs first, then classes, then elements.

Combine scripts from different plugins to just one script to improve load times.

YSlow and Google Page Speed are good tools for front-end development. YSlow will tell you to make less HTTP requests, add expires heads, use Gzip (same thing as deflate), reduce the number of DOM elements, specify absolute image dimensions and a favicon, and cache AJAX requests.

Recommended resources from Scott include: Rasmus Lerdorf at Digg, anything from Steve Souders, and writing from Douglas Crockford.

Leave a comment

Your email address will not be published. Required fields are marked *