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:
  1. -Dcom.sun.management.jmxremote
  2. -Dcom.sun.management.jmxremote.port=8092 // [8091 for node1]
  3. -Dcom.sun.management.jmxremote.authenticate=false
  4. -Dcom.sun.management.jmxremote.ssl=false
  5. -Dtc.node-name=Node2 // [Node1 for node1]
  6. -Dtc.install-root=/Users/peter/downloads/terracotta-2.4-stable0/
  7. -Xbootclasspath/p:/Users/peter/downloads/terracotta-2.4-stable0/lib/dso-boot/dso-boot-hotspot_osx_150_07.jar
  8. -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:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <tc:tc-config xmlns:tc="http://www.terracotta.org/config"
  3.                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.               xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-3.xsd">
  5.   <servers>
  6.     <server host="%i" name="sample" />
  7.   </servers>
  8.  
  9.   <clients>
  10.     <logs>/Users/peter/JavaApplications/sandbox/log/%D</logs>
  11.   </clients>
  12.  
  13.   <application>
  14.     <spring>
  15.       <jee-application name="*">
  16.         <session-support>true</session-support>
  17.       </jee-application>
  18.     </spring>
  19.   </application>
  20. </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:

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!


0 Responses to “First experiments with Terracotta”

  1. No Comments

Leave a Reply





About

Welcome to the weblog of Peter Maas. Here you'll find various posts related to stuff I like (like my kids and espresso) and stuff I do (like developing software).

JavaOne 2008 Pictures


Moscone Center - JavaOne Tim Bray introducing the (J)Ruby panel Rudie Stage being build in the nearby park Hotel room nearby hotel Java + You on a cab javaone 2008 goodybag pub golden_gate_warning_sign Greenland Charles Nutter & Guillaume Laforge Okke en Rudie alcatraz Cable Car line Community One Keynote Joshua Bloch at JavaOne2008 Golden Gate Scribbled Sun Logo smashmouth
View more photos >

Categories



Meld u aan voor PayPal en begin direct met het accepteren van creditcardbetalingen.