Scaling WordPress on Joyent Cloud: Part One

The following is a repost of Peter Yorke's original blog at peteryorke.net. Peter is a Solution Architect at Joyent with a passion for performance and scalability -- he's the man with a bucket of awesome-sauce and a big paint brush in hand.

In my role as a Solution Architect at Joyent, I get asked about ways to increase performance and scale of WordPress sites running on Joyent Cloud. In this article, I discuss things you can do to get your WP site optimized at the server and database levels. Here are just a few easy prescriptive solutions for your Joyent SmartMachines:

APC: APC or Alternative PHP Cache compiles and caches your PHP code so that it doesnt need to be rerun each time a page is requested. This provides 2x-to-5x performance increase to page load times. To enable, uncomment the extension=apc.so line in your php.ini file. Restart the Apache process.

Memcached: Memcached is a free and open source, high performance, distributed memory object caching system that is used to remediate high database loads in WordPress sites by caching database results in memory. To enable, uncomment the extension=memcache.so in your php.ini file. Restart the Apache process.

W3 Total Cache: W3 Total Cache is a WordPress plugin that works well in the Joyent environment for caching various elements of WP sites. It can be used to leverage APC and memcached. Page and Object caches use APC and database uses memcached in the configuration.

Use NewRelic Application Monitoring agents: Joyent provides the NewRelic Standard application optimization and performance monitoring agents for free to our customers. Using NewRelic to validate system or code changes can tell you what your end user experience is as well as current load conditions of the various application layers like PHP, memcached or database.

  • Step 1: Sign up for your free account.
  • Step 2: Download the agent and follow the instructions to begin monitoring your app from the NewRelic dashboard. If you need more advanced features, you can upgrade to Professional or Business and enjoy a 15% discount as a Joyent customer.

Optimize your Apache config: Tuning your mpm and file descriptors will help with scaling your sites. The Joyent Wiki has a has an excellent article on tuning the Apache mpm.conf and increasing file discriptors.

Give your MySQL database enough memory Use the innodb database format and giving as much of your memory as you can without causing your machine to swap. I use a simple formula of 75% of memory to the MySQL config parameter innodb_buffer_pool_size on a dedicated MySQL server. This will cache most of your tables in memory thereby increasing the database response times. Watching this in NewRelic, you should be able to see if your are driving down the latency times. Then you can slowly bump up the memory until performance doesn't improve any more.

Read more on scaling Wordpress in posts two and three.



Post written by badnima