Message-ID: <1778254899.6233.1369559291423.JavaMail.firstname.lastname@example.org> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_6232_97468959.1369559291422" ------=_Part_6232_97468959.1369559291422 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Jetty has been integrated with Terracotta, providing a great clu=
Since Jetty 6.1.12, the Jetty-Terracotta integration has been rewritten to = provide better performance.
The Jetty-Terracotta integration is not bundled by default; it must be buil= t from sources following the instructions below.
Configuring Jetty to use Terracotta consists of creating a single Terrac= ottaSessionIdManager per Jetty instance to generate unique session ids, and= then setting up a special TerracottaSessionManager per each webapp that yo= u want to be clustered.
One TerracottaSessionIdManager is configured per Jetty instance to gener=
ate unique session ids. These are the relevant lines to add to add to a sep=
The TerracottaSessionIdManager is stored as an attribute on the Server i=
nstance for later retrieval under the name
workerName is a unique name for the Jetty node. In the exa=
mple above it is "node1" but you can use any naming scheme you'd =
like. This is useful when hardware components such as load balancers can &q=
uot;stick" the requests to the same node to improve performances by li=
miting the session migrations among nodes.
Each web application whose sessions you want to cluster must use a Terra=
cottaSessionManager instead of the default HashSessionManager.
The easiest way to do this is to create individual context deployer config files for each web applicati= on, and include these lines:
These lines ensure that a TerracottaSessionManager is established for ea= ch web application, and has access to the Jetty instance's unique Terracott= aSessionIdManager we configured above.
You need one Terracotta configuration file for each Jetty instance.
In the Terracotta configuration file, part of the configuration is needed t= o setup correctly the Jetty-Terracotta integration, and the rest of the con= figuration is needed to setup the Terracotta server and the web application= s.
The base Terracotta configuration file that sets up the Jetty-Terracotta= integration is the following:
You can create a Terracotta configuration file wherever you prefer in th=
e file system. The file will be referenced by path in a system property to =
be passed on the command line (see below).
Copy and paste the example file content above into, for example,
There are few places that needs to be modified in order for the Terracot= ta configuration file to correctly cluster your web application.
hostattribute that needs to be mod= ified to point to the host name or host address of the Terracotta server. I= n most simple configurations this can be the local host, but in more advanc= ed configurations the Terracotta server is deployed in a separate host.
java.lang.Str= ing), then you do not need the instrumented-classes element.
com.acme.domain.Us= erclass), then you need to specify also those classes as instrument= ed, for example: You can also specify class expressions to match multiple classes, as specif= ied here= .
web-applicationelements in the T= erracotta configuration file, since the intention of clustering a context i= s already specified in the Jetty context configuration file.
The final steps require to start the Terracotta server and the Jetty ser= vers.
$JETTY_HOME/tc-config.xml, and that the Jetty con= figuration file
jetty-terracotta.xmlis in its usual location = under
Do not forget to change the
workerName of the TerracottaSes=
sionIdManager in each node you deploy (this is to help other hardware devic=
es such as load balancers).
You can inspect that the clustering is working by starting the Terracott= a administration console:
You should see one root named "sessionIds" and 2 roots for eac= h web application named "sessionData:<context>:<vhost>&quo= t; and "sessionExpirations:<context>:<vhost>".------=_Part_6232_97468959.1369559291422--