Call us: +1-415-738-4000
Web Sessions version 4.0
Web Sessions 4.0 works with the latest version of the Terracotta Server Array, which backs your sessions with BigMemory resource management, nonstop, rejoin, and many other features. For more information, refer to the Terracotta Server Array page.
Follow these steps to get a sample clustered web sessions application running with Terracotta on your machine.
Download the BigMemory Max kit, which includes Terracotta Web Sessions.
Unpack the distribution into a directory on your system. In the following instructions, we will refer to the directory as <terracotta>/. Where forward slashes ("/") are given in directory paths, substitute back slashes ("\") for Microsoft Windows installations.
Copy the license key to the terracotta distribution directory. This file, called
terracotta-license.key, was attached to an email you received after registering for the download.
%> cp terracotta-license.key <terracotta>/
We'll use the "Cart" sample in the sessions samples directory of the Terracotta distribution to demonstrate clustered Web Sessions.
%> cd <terracotta>/sessions/code-samples/cart %> bin/start-sample-server.sh
The Shopping Cart 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:
Note: These links will not work unless you have the sample running.
After Jetty loads the sample application, select an item to place in the cart. It should look something like this in your browser:
Notice that your item is stored in the session and displayed on the page.
To see the session data automatically made consistent and available in the other application server, click the Server link in the colored box.
Notice that your product browsing history is intact, even on the other application server. Web Sessions is automatically and transparently clustering your session data and sharing it between the two server instances on demand. Make another change to your cart and then click the other server link. You will observe that the session data is shared across the two server instances at a fine-grained, field-change level, independent of the application code.
Go to the Web Sessions Installation Guide to learn how to install Web Sessions with your application, configure Terracotta clustering, and view runtime statistics.