First experiments with Terracotta

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]

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">



/Users/peter/JavaApplications/sandbox/log/%D




true




[/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:

Two Tomcat servers and the Terracotta serverTwo connected nodes!Session statistics for one of the nodes.

So fare everything works as expected, session clustering works! Next steps will include EHCache, Hibernate, Lucene etc. I’ll keep you posted!

This entry was posted in java. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>