During the J-Spring conference yesterday I visited the session on Terracotta; I liked what I saw and started experimenting with it right away. Probably shouldn’t have started with a complex application… had a lot of problems there.
I decided to step back a bit and set up two simple webapplications which put something in the session. Enabling terracotta requires a bit of JVM flag voodoo; I extended the VM arguments in Tomcats’ launch configuration with the following:
[code]
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=8092 // [8091 for node1]
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dtc.node-name=Node2 // [Node1 for node1]
-Dtc.install-root=/Users/peter/downloads/terracotta-2.4-stable0/
-Xbootclasspath/p:/Users/peter/downloads/terracotta-2.4-stable0/lib/dso-boot/dso-boot-hotspot_osx_150_07.jar
-Dtc.config=/Users/peter/JavaApplications/sandbox/tc-config.xml
[/code]
The referenced boot jar was generated using the make-boot-jar.sh script; it takes care of actually starting Terracotta when Tomcat starts. The config file (tc-config.xml) looks like this:
[xml]
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
[/xml]
Before starting the Tomcat instances part of the cluster I started the Terracotta server, which administers the cluster by using the start-tc-server.sh script supplied in the Terracotta bundle.
Since everything is wired up for JMX we can now view all statistics en statuses using JConsole:
So fare everything works as expected, session clustering works! Next steps will include EHCache, Hibernate, Lucene etc. I’ll keep you posted!