Down to San Francisco this week for Game Developers Conference, see you at the Joyent booth
Load Balance by domain name

Wrote this little bit of TrafficScript for some clients today and published to the Joyent wiki. I think it’s pretty readable.
$hostHeader = http.getHostHeader();
if( $hostHeader == "domain.com" || $hostHeader == "www.domain.com"){
pool.select( "domain.com-pool" );
}
else if( $hostHeader == "another-domain.com" ){
pool.select( "another-domain.com-pool" );
Enjoy
Karanda – Infectious (Original Mix)
I am feeling this at the moment
Mat Zo – Back In Time
Dancing to this at this at the moment
Scaling WordPress in the Joyent Cloud Part 3
You have hit the big time with your WordPress blog, GigaOM and Nikki Finke think you are the most influential blogger on the planet.
Congratulations, your mysql database is about ready to crash or worse, it already has.
In this post I discuss what you need to do with your database to keep this beast running smoothly and your blogging empire humming along.
Besides your users reporting the blog is slow, what objective measures are there? I use the NewRelic Std feature that lets me see database latency. Here an example of a database that needs help.
Site latency is almost 700ms or .7 seconds, visitors to the site will notice some lag.
The database latency between the application and database server is terrible, averaging about 500ms or 1/2 seconds.
Looking at the CPM(calls per minute) vs database response time, the database response seems reasonable.
This WordPress has a few forum message board plugins on it so we need to either shard the database or create a read/write database pool. Sharding is great I am opting for the latter to solve this.
Here is how to create a read/write database pool using the HyperDB plugin
The HyperDB plugin allows you set set up multiple slave mysql servers for read access and split write access to a master mysql servers.
Some additional features: Configurable priority for reading and writing, Different tables on different databases/hosts, Failover for downed host, and Advanced statistics for profiling.
Here is a sample of the config of 3 mysql servers, 1st one is a read/write and 2nd/3rd are read only:
$wpdb->add_database(array(
‘host’ => DB_HOST-1, // If port is other than 3306, use host:port.
‘user’ => DB_USER,
‘password’ => DB_PASSWORD,
‘name’ => DB_NAME,
‘write’ => 1,
‘read’ => 1,
‘dataset’ => ‘global’,
‘timeout’ => 0.2,
));
$wpdb->add_database(array(
‘host’ => DB_HOST-2, // If port is other than 3306, use host:port.
‘user’ => DB_USER,
‘password’ => DB_PASSWORD,
‘name’ => DB_NAME,
‘write’ => 0,
‘read’ => 1,
‘dataset’ => ‘global’,
‘timeout’ => 0.2,
));
$wpdb->add_database(array(
‘host’ => DB_HOST-3, // If port is other than 3306, use host:port.
‘user’ => DB_USER,
‘password’ => DB_PASSWORD,
‘name’ => DB_NAME,
‘write’ => 0,
‘read’ => 1,
‘dataset’ => ‘global’,
‘timeout’ => 0.2,
));
For those that are unfamiliar with read/write splitting, you can send read requests to a pool of mysql slave database servers while sending the write requests to the master. Additionally, if you have a failure of one of the slaves, HyperDB can detect and send the read request to another slave in the pool.
After adding a few more slaves to the pool latency was lowered by 300ms and added another 2000 cpm, Your blogging empire is back in business
Too cool Nokia 4D projection system w/deadmau5
This is something special to watch
Node.js Ad hoc and anonymous chat
Do you ever need a quick chat room without the need for exchanging your skype, aim, msn, google chat id’s? Tried of installing a ton of chat clients.
Joyent had the 2nd annual NodeKnockOut coding competition this weekend.
One app I found and implemented was Speeka. A node.js anonymous chat system. Re-skinning it was a breeze. Feel free to give a drive.
Let me know what you think
Scaling WordPress in the JoyentCloud Part 2
To continue building on the foundation of a single WordPress server implementation.
In this article, I discuss how to bring in a second server and cluster them behind a Zeus Load Balancer.
Here is a typical 2 webnode with database, I recommend a Master/Slave MySQL config, but for simplicity, I have just one pictured.
Joyent can clone the first WordPress via a support ticket, you will need to set up replication via a rsync script:
rsync wp-content/* jill@2nd-wordpress-server:/home/wordpress/wp-content
Next we need to create a Zeus load balanced pool with our two servers
Use caching on the Zeus, even 200mb will help with images, css and javascript files.
A few cavets,
When doing upgrades to WordPress or WP plugins, you will need to drain/disable webnodes in your Zeus configuration one at a time during your normal maintenance windows. So drain/disable, upgrade, then repeat.
If you are running Multisite, you will need to update similar to the above instructions.
In my 3rd and final article, I will attack issues related to scaling databases when performance gets sluggish.
Steve Brian and Noel Gitman – Luna System (Tritonal Remix)
Today’s musical mix – Dancing and cheerful
Craig Connelly – Absolute Electric (Tritonal Club Mix) [Garuda]
Been diggin on this little tune.
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 extension=apc.so 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 extension=memcache.so 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: http://newrelic.com/joyent.html
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.
NodeFly Revisited

Playing with the new and improved NodeFly systems monitoring and reporting.
Based on the new application framework node.js
NodeFly has a broad range of support for system and applications, such as MySQL, Memcache, Apache. Additionally, NodeFly supports all the major cloud providers, Joyent, AWS, Rackspace and Softlayer.
Installation of the agents are simple and lightweight.
Check them out, you will be glad you did.
The machine is not capable of hatred. It loves everyone, especially you.
Paraphrased from Issac S.
Playing with QR Codes
Having a bit of fun with QR Codes
Solaris Nagios Install at Joyent
I wrote this document to assist JoyentCloud customers with their Nagios install and configurations.
Brendan Gregg – mpstat
Brendan is on fire with more videos
Brendan Gregg – Unix Load Explained
Anyone interested in understanding unix system performance should watch.






