Scaling WordPress in the JoyentCloud Part 1

In my role as a Solution Architect at Joyent, I get asked about ways to increase performance and scale of WordPress sites in the cloud. In this article, I discuss things you can do to get your WP site optimized at the server and database levels.

Here are a few easy prescriptive solutions for your Joyent SmartMachines:

1. APC

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

2. Memcached

Memcached is a 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 in your php.ini file. Restart the Apache process.

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

4. Use NewRelic Application Monitoring agents

Joyent provides NewRelic application performance monitoring agents that are lightweight at the “Standard” level for free of charge to 1G or greater 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. To sign up for your free account, click the SignUp button from this URL:

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

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

In my next article, I will discuss solutions for more than one WordPress Server in a cluster and database scaling.

Posted in Foundations, Technology | Tagged as: , , , , , , | Leave a comment

Leave a Reply