Friday, April 3, 2009

Clustering with Terracotta

When we talk about clustering, it is always known as a hard mission to accomplish. Configuring collections in entity relations, clustering databases, http sessions and such attempts always requires an experience that gained with failures. However according to Terracotta you achieve this without any experience in 30 minutes. Terracotta’s motto is if you know Java you know Terracotta. Terracotta is the name of both the JVM clustering technology product and the company name.

Terracotta is an open source technology (also there is a commercial version) that allows you to make clustering at JVM level. So you do not need to do anything actually except running your application in several JVM and connecting them together with Terracotta. You do not need to do any special change in your code because Terracotta uses ASM to instrument bytecode on the fly for you. Although you run a cluster with terracotta you can think that your application is working on one JVM.

Terracotta relies on their technology called Network-Attached Memory (NAM), so that they can even dare to recommend using memory for entities instead of using a database since NAM is durable to disk and runs at in-memory (according to Terracotta) speeds. Although this can be discussed, if you think that Terracotta is transactional (synchronized blocks form transactions of modified objects) this should make you eager to put this alternative in your designs.

Most suspicious developers may think the best approach would be keeping long term data in database but keeping all the value objects in memory. For example, in a web application, all the basket and basket items, any registration data, big query results and such items (so we can summarize as data in user session) can be kept in memory until user ends his conversation. When user completes his shopping, order can be committed to database and removed from memory.

But it is being discussed if you need a RDBMS unless you need to open your database to other non-java applications. While the market is demanding for simplicity (like Ruby on Rails, Grails), Terracotta seems to be a valuable design solution to be considered in suitable cases and I am sure there will be more JVM clustering frameworks will appear.

Go to Terracotta web page for more.

No comments:

Post a Comment