First experiments with Terracotta
Published by peter June 14th, 2007 in java.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:
-
-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
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 version="1.0" encoding="UTF-8"?>
-
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
-
<servers>
-
<server host="%i" name="sample" />
-
</servers>
-
-
<clients>
-
<logs>/Users/peter/JavaApplications/sandbox/log/%D</logs>
-
</clients>
-
-
<application>
-
<spring>
-
<jee-application name="*">
-
<session-support>true</session-support>
-
</jee-application>
-
</spring>
-
</application>
-
</tc:tc-config>
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!




















0 Responses to “First experiments with Terracotta”
Please Wait
Leave a Reply