Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

JVM Languages

Clustering with Java


DDJ: With us today is Ari Zilka, founder and CTO of Terracotta. Ari, what does the term "Java runtime clustering" mean?

AZ: Terracotta gives Java applications a distributed, network-aware heap. This shared heap becomes the basis for highly scalable clustering and work coordination services within the application server cluster. There is less code to develop and maintain, which means lower cost and faster time to market. There are also big gains in scalability using this approach, while maintaining greater operational visibility and control than with techniques based on application-level APIs.

We like to think of the Terracotta server as network-attached memory. For example, with network-attached storage (NAS), the file system is external to the physical machine where the application resides, yet the application need not be aware of this fact. Terracotta is analogous to this, except the Java heap itself is networked. If an object is needed by the application, yet not in the local heap, the object is seamlessly faulted in from the network heap, unknown to the application -- with no dependence on Java serialization. We also employ various caching algorithms to ensure that objects currently referenced within a given machine are kept in local heap, and we propagate fine-grained only field level changes among the application nodes and the Terracotta server, all for the sake of speed. Also, Terracotta handles all the locking and coordination across the application nodes to ensure everything stays consistent with no need to change the application code. This gives IT organizations a cleaner line between what developers need to write, application logic, and caching, clustering, and work coordination logic -- which are handled by Terracotta.

With Terracotta's network-attached memory, an application built to run only within a single JVM can be run in a clustered manner across many JVMs. This provides high availability and high scalability, all with minimal intrusion into the application itself.

This logically leads to the notion of "Java runtime clustering" and why we characterize Terracotta that way. "Clustering" because we are keeping heaps in sync across the network, and "runtime" in that it does not rely on Java's serialization interface, thus honoring Java's memory model all the way out onto the network.

DDJ: Scalability is fundamental to clustering. Is there a particular challenge to implementing it in Java?

AZ: Yes, the challenge with Java applications today is that everyone is faced with some stiff tradeoffs, since they only have two solutions to this problem:

  • Peer-to-peer networks.
  • A stateless approach using object-relational mapping.

The peer-to-peer approach bottlenecks on the network, since every node needs to know everything that the other nodes know. Peer-to-peer is also subject to data consistency issues in data that can have frequent changes, such as the well-known "split brain problem," unless the consistency is maintained in the application code itself. The stateless approach with OR-mappers bottlenecks on the database, since transient data with little durable business value is constantly being created in or read from a database that is many cases is already heavily taxed. Peer-to-peer and OR-mapping also, at least in current incarnations, burden application developers with code changes to make the technologies work, which means that not only will the application face scalability challenges, but also higher than necessary development and maintenance costs from this extra code.

That said, both of these technologies are quite useful in some cases, but what's needed is a capability that allows a more consistent continuum of clustering options for those cases where the peer-to-peer and object-relational mapping are inappropriate due to scalability concerns.

Terracotta provides this smoother scalability continuum by directly sharing the application heap itself. It's highly scalable since it sends only fine-grained, field-level, object changes across the network, and it only sends the changes to the nodes that need them -- with other nodes getting the updates on demand. There is no need to ensure that every node knows everything all the other nodes know, nor do you need to save transient data in a database when it can stay in a readily consumable object form, in the application's network-attached memory heap. Terracotta can scale at close to a linear rate, meaning that if the first application server in a cluster handles N transactions a second, each additional node will handle nearly N transactions per second as well. In the use cases we have seen, competitive solutions have difficulty matching Terracotta's scalability profile because of network or database bottlenecks.

Also, in many cases, there is no need to change the application code to use Terracotta, though some customers have made changes to their applications to get the most out of the performance benefits we can offer. This reduces development and maintenance costs significantly, and lets developers focus on building features that users need, rather than on writing infrastructure logic.

DDJ: A plug-in architecture seems to be central to Terracotta. Did it start out this way, or just end up as such?

AZ: There are two ways to answer this question.

From the perspective of plugging into Java as a runtime solution, it actually did start that way. Since we have a lot of large e-commerce site operational experience, we believed that to overcome the existing availability/scalability trade-offs a new approach to clustering was needed -- one that provided Java clustering as a runtime solution rather than a purely "development time" remedy. From the outset we looked for a new approach to this problem, since the traditional approaches had failed us, both from the technical and cost-effectiveness perspectives.

Also, looking at the notion of plug-in from a different angle, Terracotta has recently added a new feature called configuration modules, which lets users plug-in pre-packaged configurations for the developer tools they prefer to use. We have various configuration modules available now to include the Lucene search engine, iBatis OR mapper, RIFE for continuations, and the Wicket user interface framework. This is a new feature, so the product did not start with it, but given the demand we have seen for integration with various development frameworks, we felt it was a really good capability to add. Plus, people outside Terracotta can develop configuration modules for their favorite frameworks and contribute them back to the Terracotta developer and user communities.

DDJ: Is there a web site readers can go to for more information?

AZ: The best place to go is www.terracotta.org. This is the community web site for Terracotta, where readers can find a wealth of information about use cases, deployment, and configuration tips, and information about how the product works. They can also sign up for our forums, mail lists and bug-tracking database. For our enterprise support, there's www.terracottatech.com.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.