Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

### Topics

InfoQ Homepage News Article: Introduction to OpenTerracotta

# Article: Introduction to OpenTerracotta

This item in japanese

OpenTerracotta is an open source (MPL-based license) enterprise-class JVM clustering solution that can take multi-threaded single-JVM apps and have them run across multiple JVMs with no code changes.  In this latest InfoQ article, Orion Letizi goes super-indepth on Terracotta and how it works, explaining how to do session replication, distributed caching, master/worker, Spring clustering, and more.

See also InfoQ's coverage of Terracotta going open source this past December including an interview with Terracotta CEO Ari Zilka.

OpenTerracotta’s DSO (distributed shared objects) allows the transparent clustering of user-defined classes, Java primitives, and even core Java class libraries, including its concurrency abstractions. DSO is a hub and spoke architecture, with a central server replicating data across JVMs as needed. Objects retain identity across a cluster, and the central data store (which itself can be replicable) ensures smooth failover.  Terracotta replicates changes from one heap to heaps in other VM's. Terracotta also coordinates synchronization between threads, and can migrate threads across server instances. Bytecode instrumentation of classes declared clusterable is also used, resulting in fine-grained replication field-level changes across the cluster, without the need to declare objects as serializeable.

Style

## Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

• ##### Open Source?

by Dalibor Topic,

• ##### Re: Open Source?

by Floyd Marinescu,

• ##### Very good tutorial. A couple of questions.

by Martin Perez,

• ##### Re: Very good tutorial. A couple of questions.

by Martin Perez,

• ##### Re: Very good tutorial. A couple of questions.

by Jonas Bonér,

• ##### Re: Very good tutorial. A couple of questions.

by Martin Perez,

• ##### Re: Very good tutorial. A couple of questions.

by Jonas Bonér,

• ##### VERY Exciting

by Jonathan Locke,

• ##### I've recently used Terracotta to build a message bus

by Mark Turansky,

• ##### Differences with JBoss PojoCache for instance

by Fabien Coppens,

• ##### Open Source?

Your message is awaiting moderation. Thank you for participating in the discussion.

I must have missed the OSI decision about granting the 'Open Source' seal of approval to the Terracota license. Is there a link for that?

• ##### Re: Open Source?

Your message is awaiting moderation. Thank you for participating in the discussion.

The open-sourceness of Terracotta has been discussed in depth in other places, I suggest looking there and keeping this thread for technical discussion only.

Also, for those interested in learning more about how & when Terracotta went open source (and some licensing details), see also InfoQ's coverage: Terracotta Open Sources JVM clustering. (Dec, 2006).

• ##### Very good tutorial. A couple of questions.

by Martin Perez,

Your message is awaiting moderation. Thank you for participating in the discussion.

A couple of questions come into my mind after reading the tutorial and taking a look in the terracotta web page.

It seems that WebLogic 9.x and WebSphere 6.x aren't supported, at least for the documentation I was able to find (www.terracotta.org/confluence/download/attachme...). Any technical reason?

• ##### Re: Very good tutorial. A couple of questions.

by Martin Perez,

Your message is awaiting moderation. Thank you for participating in the discussion.

Forgot the other one. Would it be possible to know the method applied for instrumentation? (jvmti agents, custom vm options like the ones in jrockit, custom classloader and launcher at startup, ...)

• ##### Re: Very good tutorial. A couple of questions.

by Jonas Bonér,

Your message is awaiting moderation. Thank you for participating in the discussion.

Hi Martin.

It seems that WebLogic 9.x and WebSphere 6.x aren't supported, at least for the documentation I was able to find (www.terracotta.org/confluence/download/attachme...). Any technical reason?

No. We simply have limited resources and are aiming for the "biggest bang for the buck".

There are might be minor differences in how we would have to implement support for different versions of WSL (or Tomcat for that matter), but nothing really technically challenging.

Simply more code to implement, test, maintain and support.

Care to help out?

/Jonas

• ##### Re: Very good tutorial. A couple of questions.

by Jonas Bonér,

Your message is awaiting moderation. Thank you for participating in the discussion.

Forgot the other one. Would it be possible to know the method applied for instrumentation? (jvmti agents, custom vm options like the ones in jrockit, custom classloader and launcher at startup, ...)

We are putting a hook into the java.lang.ClassLoader class. Exactly the way we did it with AspectWerkz. For you as a user it means that you have to feed your invocation to 'java' with the '-Xbootclasspath' option. Here is a sample of what you have to do to enable Terracotta in your application:

java -Xbootclasspath/p:<path to terracotta boot jar>     -Dtc.config=path/to/your/tc-config.xml     -Dtc.install-root=<path to terracotta install dir>      ? <your regular options> ?

If you are interested in tech details, here is the class that is patching the class loader:
svn.terracotta.org/fisheye/browse/Terracotta/ds...

It would be simple to do a javaagent for Terracotta, but it has so far not been any need.

/Jonas

• ##### Re: Very good tutorial. A couple of questions.

by Martin Perez,

Your message is awaiting moderation. Thank you for participating in the discussion.

Thanks for the details Jonas!

It seems easy and straightforward.

• ##### VERY Exciting

Your message is awaiting moderation. Thank you for participating in the discussion.

I'm quite excited about Terracotta's potential. It feels to me like a major component of the growing arsenal of technologies that are going to replace the old J2EE world over time. As originator of Wicket, I think it's especially interesting and wonderful that Terracotta can be used to transparently cluster Wicket applications out of the box. The combination of Terracotta and Wicket 2.0 session scalability features may make Wicket a very interesting option even for very large sites with fault tolerance requirements. It also makes me think I might actually enjoy working on a distributed system at some point!

• ##### I've recently used Terracotta to build a message bus

Your message is awaiting moderation. Thank you for participating in the discussion.

blog.markturansky.com/archives/26

It's been a fun product to work with and our initial stress tests shows that it will support the load. I'm curious to see how many message consumers we can connect to it before we need to replicate our cluster, but consider that our messages take longer to process than to route, I think it'll be at least several dozen.

• ##### Differences with JBoss PojoCache for instance

Your message is awaiting moderation. Thank you for participating in the discussion.

Hi.
A layman's question from someone who has never used Terracotta, and which you have probably been asked many times :
what are the main differences between Terracotta and a distributed transactional POJO-based cache such as JBoss PojoCache ?

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p