Message-ID: <1223944107.88451.1397773367943.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_88450_1306681247.1397773367943" ------=_Part_88450_1306681247.1397773367943 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 integratio= n has been rewritten to provide better performance.
The Jetty-Terraco= tta integration is not bundled by default; it must be built from sources fo= llowing 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.=20
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 ea= siest way to do this is to create individual context deployer config files for each web application, an= d 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.=20
You need one Terracotta configuration file for each Jetty instance.
In the Terracotta configuration file, part of the configuration is needed= to setup correctly the Jetty-Terracotta integration, and the rest of the c= onfiguration is needed to setup the Terracotta server and the web applicati= ons.
The base Terracotta configuration file that sets up the Jetty-Terracotta= integration is the following:=20 =20
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.=20
hostattribute that needs to be modified to point to t= he host name or host address of the Terracotta server. In most simple confi= gurations this can be the local host, but in more advanced configurations t= he Terracotta server is deployed in a separate host.
java.lang.String), then you do not need t= he instrumented-classes element.
com.acme.domain.Userclass), then you need to s= pecify also those classes as instrumented, for example:=20 You can also specify class expressions to match multiple classes, as= specified h= ere.
web-a= pplicationelements in the Terracotta configuration file, since the = intention of clustering a context is already specified in the Jetty context= configuration file.
The final steps require to start the Terracotta server and the Jetty ser= vers.=20
$JETTY_HOME/tc-config.xml, and that the Je= tty configuration file
jetty-terracotta.xmlis in its usual lo= cation 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:=20 =20
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>".