This site hosts historical documentation. Visit www.terracotta.org for recent product information.

Terracotta Web Sessions Tutorial

Follow these steps to get a sample clustered web sessions application running with Terracotta on your machine.

Download and Install the Terracotta Enterprise Suite

Use the links below to download the Terracotta Enterprise Suite and a 30-day trial license. Run the installer and tell it where to unpack the distribution. We'll refer to this location as `<terracotta>`. In the following instructions, where forward slashes ("/") are given in directory paths, substitute back slashes ("\") for Microsoft Windows installations.

Download

Enterprise Ehcache (including BigMemory, Ehcache Search and the Hibernate distributed cache plugin), Web Sessions, Quartz Scheduler and the Terracotta Server Array all come bundled with the Terracotta Enterprise Suite.

Important: Make sure to download the trial license key in addition to the software bundle.

Download the Terracotta Enterprise Suite ›

Install

Run the installer (your installer version may vary):

%> java -jar terracotta-ee-3.7.4-installer.jar

Copy the license key to the terracotta distribution directory:

%> cp terracotta-license.key <terracotta>/

Start the Townsend Web Sessions Tutorial

We'll use the "Townsend" sample in the sessions samples directory of the Terracotta distribution to demo clustered web sessions.

Start the Terracotta Server

%> cd <terracotta>/sessions/samples/townsend
%> bin/start-sample-server.sh

Start the Sample

%> bin/start-sample.sh

View the Sample

The Townsend sample starts up two instances of Jetty, each connected to the Terracotta server for access to shared session data.

The sample application uses Terracotta to store session data for scalable high availability. Any session can be read from any application server.

Once the Jetty instances have started, you can view the sample application by visiting the following links:

http://localhost:9081/Townsend ›
http://localhost:9082/Townsend ›

Note: these links will not work unless you have the sample running.

After Jetty loads the sample application, it should look something like this in your browser:

Click around the cameras in the sample. As you do so, your product browsing history is stored in the session and displayed on the page.

View the Session in Other JVMs

To see the session data automatically made consistent and available in the other application server, click the link in the hint box.

Notice that your product browsing history is intact, even on the other application server.

View Runtime Session Data and Statistics

Terracotta comes with a console that lets you inspect the runtime statistics and contents of your sessions. To see it in action, start the console:

%> <terracotta>/bin/dev-console.sh

When the console starts, you will see a splash screen prompting you to connect to the Terracotta server. The Terracotta server coordinates all of the statistics gathering of the sessions cluster.

Click the "Connect..." button to connect the console to the cluster.

Once connected, click on the "Sessions" button in the tree-control menu to see web sessions statistics and browse live sessions data:

Click on the "Runtime Statistics" tab to view the runtime statistics graph for the cluster. You can also see discrete statistics for each application server.

Click on the "Browse" tab to view runtime sessions data.