Terracotta Plugin

  • Tags : other frameworks
  • Latest : 0.1
  • Last Updated: 01 September 2008
  • Grails version : *
  • Authors : null
0 vote
Dependency :
compile ":terracotta:0.1"

Documentation

Summary

Description

Terracotta is a Java infrastructure that allows you to scale your application by clustering JVMs.

Author: Vincent Jorrand (vjorrand at yahoo dot com)

Features

  • Generation of a terracotta configuration file
  • Generation of terracotta enabled start up scripts for containers

Installation

grails install-plugin terracotta

Usage

  • Install the plugin
  • Run the start up script generation task
  • Run the terracotta configuration generation task
  • generate a war for the application and deploy in a container
  • start the terracotta server(s)
  • start the application servers

Components

  • Generate<ContainerName>Script: Generate the start up script for an application server
  • GenerateTcConfig: Generate the tc-config.xml file for terracotta

Generate<ContainerName>Script

Currently only 2 containers are supported: jboss and tomcat.

Edit TerracottaConfig.properties to set the parameters for the start up scripts: The terracotta install directory on the target jboss or tomcat server

terracotta.install.dir
The path place where the tc.config.xml will be made available to on the servers (this plugin does not remote copy it you have to do that)
terracotta.config.path

Run

grails generate-jboss-scripts

Copy the generated scripts in the startup script folders of the containers. You will later start the containers using these scripts instead of standard ones.

GenerateTcConfig

Generates the tc-config.xml required to run a terracotta enabled container. It enables the clustering of all the domain classes defined in the project and allows to add any additional classes to be made clusterable by including a user defined xml segment. It also clusters the http sessions across the container instances for your application.

Edit TerracottaConfig.properties to set the host names and ports for the terracotta servers to be used by the application.

Edit CustomIncludes.xml to specify any additional terracotta include rules required by your application.

Run

grails generate-tc-config

Copy the generated file on each container server, in the location specified when generating the container start up scripts.

Running the Clustered Application

Deploy your application on all the container instances. Start the terracotta server(s) Start the containers using the generated start up scripts. (Note that you will need a form of load balancing to witness the effects of the clustering, I used Apache with mod_jk)

Fun Note

Start one only one node of your cluster. Start a session (log in your app, ...). Stop that server instance, then start another one. Continue using your application without losing your session!

Looking Ahead

Future enhancements include support for more containers (easy), and support for running terracotta in development mode (more complex).