For web applications that require audit trails or session tracking across servers, the idea of deploying in the cloud where scaling up and scaling down is a regular occurrence is enough to instill panic into the hearts of many web ops engineers. Jon Brisbin, a java guru at NPC Internations, the world's largest Pizza Hut franchise, went through this panic and survived using JMX and RabbitMQ.
"I approached this problem in our own private cloud by writing a Tomcat LifecycleListener that hooks into our RabbitMQ servers to keep interested queue subscribers updated with the internal state of our SpringSource tcServer instances, as well as providing the ability to invoke JMX MBeans via asynchronous messaging. Since this system uses AMQP, any language that has an AMQP client that can talk to RabbitMQ can invoke JMX-managed MBeans."
Brisbin has open sourced the virtual cloud utilities that he wrote to create this Listener and released them this week on GitHub: http://github.com/jbrisbin/vcloud/tree/master/mbean-invoker/
Details on how to configure the Listener, manage the Event Exchanges and Queues and create the Subscribers is documented in his post on TomcatExpert.com here: http://www.tomcatexpert.com/blog/2010/06/04/how-scale-tomcat-cloud-rabbitmq-and-jmx
"The biggest issue I see with adopting anything like a cloud architecture is that task-oriented virtual machines can breed like rabbits. You quickly end up with virtual machines named "tomcat1", "tomcat2", ... "tomcat12" ad nauseum. Managing these servers using asynchronous messaging makes a lot of sense. Thanks to the way queue subscriptions work, you don't have to maintain lists of active connections to which you need to replicate data. Using routing keys that incorporate event names and hostnames means your AMQP clients can listen for only those events in which they're interested. One could partition hundreds of servers using a sane combination of RabbitMQ virtual hosts, exchanges, and routing keys.
"I'm excited by the opportunities Tomcat users have to deploy their applications into private, hybrid cloud architectures. Lightweight is the new black and Tomcat, RabbitMQ, and asynchronous messaging play right into that hand like the Jack of Spades."