Jetty Session Clustering with Terracotta
Terracotta is an infrastructure that allows you to pretty much transparently cluster any code in a jvm. We've already successfully used it to cluster the channels in Jetty's Bayeux (aka Cometd) implementation, so we thought it was high time we used it to cluster HTTP sessions.
Jetty already has a WADI-based solution for HTTP session clustering, so providing a terracotta-based solution provides an alternative for users to be able to choose the most appropriate solution for their needs.
The code is hot-off-the-press, so thus requires a little more polishing and testing, however it's ready to try out, so give it a spin. Here's the instructions:
Building
-
There are some changes to Jetty that have not yet been incorporated into trunk, so first you'll need to check out this branch:
https://svn.codehaus.org/jetty/jetty/branches/terracotta.
Build it with:mvn clean install
I'll refer to the location where you've done the checkout as $JETTY-BRANCH. -
Check out the session clustering code from the jetty-contrib repo at:
https://svn.codehaus.org/jetty-contrib/jetty/trunk/extras/terracotta.
Build it with:mvn clean install
I'll refer to the location where you've done the checkout as $TC_EXTRAS.
- Copy the terracotta-sessions-6.1-SNAPSHOT.jar you just built into $JETTY-BRANCH/lib/ext.
-
Check out terracotta trunk from:
http://svn.terracotta.org/svn/tc/dso/trunk
Follow the instructions on the terracotta site to build it and produce a bootjar. I'll refer to the root of the build results (usually in code/base/build/) as $TC-BUILD.
Configuration
- You can setup all your webapps to use terracotta-based session clustering by copying the example jetty config file in $TC-EXTRAS/src/main/resources/jetty.xml to your $JETTY-BRANCH/etc/ directory.
- You might want to copy the example webapps from $TC-BUILD/dist/terracotta-trunk/samples/sessions into $JETTY-BRANCH/webapps to play with.
Running
Start the terracotta server:
$TC-BUILD/dist/terracotta-trunk/bin/start-tc-server.sh \
-f $TC-EXTRAS/src/main/resources/tc-config-jetty.xml
Start jetty:
cd $JETTY-BRANCH
java -Dtc.install-root=$TC_BUILD/dist/terracotta-trunk/ \
-Xbootclasspath/p:[path to your boot jar] \
-Dtc.config=$TC-EXTRAS/src/main/resources/tc-config-jetty.xml \
-jar start.jar \
etc/jetty.xml
Job done!
Any webapps you deployed should have their session instances clustered. Don't forget, you'll need to start more than one jetty instance in order to see session clustering actually happening :-)
Many thanks are due to the guys at Terracotta for their expert help in the integration, in particular Tim Eck who was outstandingly helpful - thanks Tim!
Java OneIf you're attending Java One, we'll be hanging out and demo-ing the session clustering at the Terracotta booth (booth #828) so drop by, eyeball the demo and come and have a chat to us.
Re: Jetty Session Clustering with Terracotta
Re: Jetty Session Clustering with Terracotta
The new hotness is here:
http://docs.codehaus.org/display/JETTY/Session+Clustering+with+Terracotta
Re: Jetty Session Clustering with Terracotta
Greetings to you,
Even though i am going to use this great tool, i am really worriying about my bad knowledge both on jetty as well as terracota,
now we use jetty 6.1.5 on the prod, since we need to bring up the clustered session management i was recommending terracota in place, but when they ask me to show the demo, i couldnt succeed?
I wanted to use the SessionIDManager which our developers had done as clustered env.
how to go about? can anyone there pls help me?
Re: Jetty Session Clustering with Terracotta
All the info is on the wiki page at http://docs.codehaus.org/display/JETTY/Session+Clustering+with+Terracotta
The Terracotta guys have recently been doing a bit of work to make integration even easier, so stay tuned for some new announcements in this area soon.
If you've followed all of the instructions on the wiki page and still having trouble, then you could either try the jetty community mailing lists at jetty-support@lists.sourceforge.net or contact Webtide at info@webtide.com for private commercial support.
best regards
Jan
