Friday, November 9, 2007

Quick look at Terracotta

Terracotta is a cool open source clustering technology for Java. Using Terracotta you can easy share objects across JVMs. You can easy write and test your application running in a single JVM. And after that make application scalable and highly available and run on more than one JVM.
Terracotta allows threads in a cluster of JVMs to interact with each other across JVM boundaries using the same built-in JVM facilities extended to have a cluster-wide meaning. These clustering capabilities are injected into the bytecode of the application classes at runtime, so there is no need to code to a special clustering API.
What does DSO (distributed shared objects) do?
Terracotta DSO extends the Java Memory model from one to multiple JVMs. It layers in at the bytecode level and requires no Java API. It maintains object identity, wait, notify and synchronize and creates a virtual heap for the parts of your object graph that you mark as in need of sharing. You mark a part of your application as in need of sharing by specifying Roots.
You can shared variable in class, mark fields as transient if you don't want them shared or just lock them. The main feature is that you don't need write specific code and can clustered any stand alone application. Creating a tc-config.xml file that defined all roots and fields. You can easy clustered you application, with out any code modifications. If you avoid writing XML by hand use the Terracotta DSO EclipsePlugin. Once the configuration is complete, running the application in a cluster can be done from the Eclipse "Run As -> Terracotta DSO Apllication" or from the command line using a script called dso-java.bat instead of starting it with regular Java. Here you can see how Terracotta work. For detail information start the tc-admin console. So as we can see at diagram, Application should have configuration file and server. The first step is to start the Terracotta server. Once the server is started, the instance of your application can be started. Every new instance of application work with server. Terracotta uses a client/server architecture where the JVMs running the clustered application connect to a central Terracotta server at startup.
DSO maintains a virtual heap so only the parts of the object graph that are needed in each JVM are actually there. As your code reaches into your object graph DSO will dynamically start pulling in the needed data. This allows one to have heaps that are much bigger than your memory space. Of course if one is cycling through all the data all the time one will end up with thrashing but if what you are really doing is having various JVM's acting on some part of the data for some part of the time this is a really useful feature.
Official Terracotta home page

Wednesday, November 7, 2007

Adopting OSGi in Java Application Frameworks

Adopting OSGi in Java Application Frameworks: A Case Study — Migration of software systems to the OSGi platform is gaining momentum with wide acceptance of the OSGi technology as the dynamic module system for Java. This transition is of special interest when it comes to popular Java application frameworks, which attract a growing number of Java developers around the world. Although the technical merits of the OSGi platform are broadly recognized, the migration of existing application frameworks is slow due to significant redesign and re-implementation efforts involved. We present an alternative lightweight approach - an adaptation of existing Java application framework for component based OSGi environment. Adaptation, as opposed to migration, eliminates the necessity of modularizing or redesigning the existing framework. This is particularly important when existing software platform and the associated programming model is mature and has already penetrated into the market place. As a general adaptation solution we introduce a thin layer between the OSGi Service Platform and the existing framework. Furthermore, we present the case study of an OSGi adaptation of a popular open source Java platform developed by IBM Research for integration of software analytics. Our results demonstrate that the adaptation approach is not limited to the presented case, but is broadly applicable to a variety of Java application frameworks.

Thursday, November 1, 2007