Evaluating Coherence on Mac OS X

Coherence is a in-memory distributed cache system, usually sitting in between your application servers and your databases.
Coherence is designed to be extremely scalable and has no single point of failure.
It was originally developed by TangoSol and acquired by Oracle in March 2007.

Although usually used by large scale Internet web site and transactional system, Coherence happens to be very lightweight and easy to use for evaluation / development.

Coherence is fully developed in Java and runs on any Java-enabled platform, including Solaris, Linux, Windows and Mac OS X.  Coherence provides clients libraries for Java, .Net and C++ applications.

In this serie of articles, I will show how to test and evaluate Coherence on a Mac OS X system.

1. Get the package

You can freely download Coherence from Oracle Technology Network (free membership required)

2. Unzip the package

marsu:~ sst$ unzip coherence-java-3.6.0.0b17229.zip

3. Inspect the package and be sure the scripts are executable

marsu:~ sst$ ls coherence
bin		doc		lib		product.xml

Without surprises :

  • bin – will contains the executable
  • doc – contains the javadoc
  • lib – contains the JAR to be included with your application
marsu:~ sst$ chmod u+x bin/*.sh

4. Start a first cluster node

marsu:coherence sst$ ./bin/cache-server.sh

Many lines will be output on the console.  Be sure to read

Group{Address=224.3.6.0, Port=36000, TTL=4}
MasterMemberSet
(
ThisMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
ActualMemberSet=MemberSet(Size=1, BitSetCount=2
Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
)
RecycleMillis=1200000
RecycleSet=MemberSet(Size=0, BitSetCount=0
)
)
Group{Address=224.3.6.0, Port=36000, TTL=4}
MasterMemberSet  (  ThisMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)  OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)  ActualMemberSet=MemberSet(Size=1, BitSetCount=2    Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)    )  RecycleMillis=1200000  RecycleSet=MemberSet(Size=0, BitSetCount=0    )  )

And … that’s it.  The first cluster node is started.

5. Start a second cluster node

In another terminal, type  :

marsu:~ sst$ cd coherence
marsu:coherence sst$ ./bin/cache-server.sh

In the output, be sure to read

MasterMemberSet
  (
  ThisMember=Member(Id=2, Timestamp=2010-12-10 13:05:16.693, Address=192.168.0.2:8090, MachineId=26626, Location=machine:marsu,process:42023, Role=CoherenceServer)
  OldestMember=Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
	ActualMemberSet=MemberSet(Size=2, BitSetCount=2
	Member(Id=1, Timestamp=2010-12-10 13:02:01.121, Address=192.168.0.2:8088, MachineId=26626, Location=machine:marsu,process:42007, Role=CoherenceServer)
	Member(Id=2, Timestamp=2010-12-10 13:05:16.693, Address=192.168.0.2:8090, MachineId=26626, Location=machine:marsu,process:42023, Role=CoherenceServer)
   )
RecycleMillis=1200000
RecycleSet=MemberSet(Size=0, BitSetCount=0
)
)

6. Troubleshooting startup issues

By default, Coherence uses multicast to communicate between servers.  In some rare cases, Multicast might fail, preventing the second node to join the cluster.

Be sure to check the documentation and these troubleshooting notes if you run into a problem.

7. Using the cache interractively

Coherence has a command line interface to manipulate objects in the cache,

marsu:coherence sst$ ./bin/coherence.sh ** Starting storage enabled console **
(many lines suppressed)
2010-12-10 13:26:02.066/1.264 Oracle Coherence GE 3.6.0.0 <D5> (thread=Invocation:Management, member=3): Service Management joined the cluster with senior service member 1
Map (?):

Let’s first create a cache :

Map (?): cache currencies
2010-12-10 13:31:30.019/329.217 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=3): Loaded cache configuration from "jar:file:/Users/sst/coherence/lib/coherence.jar!/coherence-cache-config.xml"
2010-12-10 13:31:30.151/329.350 Oracle Coherence GE 3.6.0.0 <D5> (thread=DistributedCache, member=3): Service DistributedCache joined the cluster with senior service member 1
<distributed-scheme>
<scheme-name>example-distributed</scheme-name>
<service-name>DistributedCache</service-name>
<backing-map-scheme>
<local-scheme>
<scheme-ref>example-binary-backing-map</scheme-ref>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
Map (currencies):
Map (?): cache currencies2010-12-10 13:31:30.019/329.217 Oracle Coherence GE 3.6.0.0 <Info> (thread=main, member=3): Loaded cache configuration from "jar:file:/Users/sst/coherence/lib/coherence.jar!/coherence-cache-config.xml"2010-12-10 13:31:30.151/329.350 Oracle Coherence GE 3.6.0.0 <D5> (thread=DistributedCache, member=3): Service DistributedCache joined the cluster with senior service member 1<distributed-scheme>  <scheme-name>example-distributed</scheme-name>  <service-name>DistributedCache</service-name>  <backing-map-scheme>    <local-scheme>      <scheme-ref>example-binary-backing-map</scheme-ref>    </local-scheme>  </backing-map-scheme>  <autostart>true</autostart></distributed-scheme>
Map (currencies):

Populate the cache :

Map (currencies): put USD "US Dollar"
null

Map (currencies): put EUR "Euro"
null

Map (currencies): put CHF "Swiss Franc"
null

Map (currencies): put GPB "British Pound"
null

Play with the cache :

Map (currencies): size
4

Map (currencies): get CHF
Swiss Franc

Map (currencies): remove CHF
Swiss Franc

Map (currencies): size
3

Map (currencies): list
GPB = British Pound
USD = US Dollar
EUR = Euro

8. Next Step

In the next article, I will show you how to programmatically interact with Coherence from a Java application.

, , ,

No Comments

Out of the box integration

One year ago, when I tried to run Oracle’s Enterprise Linux 5 within VirtualBox, I ran into many configuration issues to get folder sharing, mouse integration and full screen correctly working.

Today the story is different.

I just tried Enterprise Linux 5 update 4, with the latest VirtualBox 3.2.12.  Everything is working out of the box.  Everything.

I have to admit I am impressed how Oracle manage to integrate all its product line.

Enjoy !

, , , ,

2 Comments

An easy way to evaluate Oracle SOA / BPM offering

One of the big pain when willing to evaluate the SOA or BPM offering from Oracle is the installation process.  These are not simple toys to play with, they require some hundreds of Mb to download and some patience to carefully install all components and their dependencies.

Unless you have a good tutorial or book at hands, the result is likely to fail, believe me.  I’ve been there, I’ve done that.

The good news, is that we are helping you out by providing Virtual Machines images, ready to run and pre-installed with all the software you will need : the database, the application server, the SOA suite with BPM and BAM.

Patience is only required during the 6Gb download now.

Be sure to have the latest version of Virtual Box installed on your machine and a few Gbs (2-3 at least) available for the virtual machine.

Enjoy !

, , , , , ,

No Comments

YaJuG General Assembly

YaJuG‘s next General Assembly will be hosted at Espace Reunion, Leudelange on December the 14th.

YaJuG will welcome David Delabassee, Oracle‘s Java Ambassador for the region and JavaOne speaker.

David will do a recap of the recent changes around the various Java platforms.

Then, to follow YaJuG’s tradition, we will have some fun with electronic devices programmation – David will make you discover the world of Arduino.

Registration is now open !

, ,

No Comments

GlassFish v3.1 High Availability screencast

A couple of weeks ago, during Devoxx 2010 conference, I was answering questions and demonstrating several new and upcoming products, amongst others : GlassFish v3.1

I created a very simple session fail over demonstration, involving two instances of GlassFish and a simple, open source, software load balancer.

The screen cast is available on YouTube in HD quality and from this post.

My colleague, Arun Gupta, from GlassFish engineering, also posted a similar screencast a couple of days ago. The more, the better.

Software mentioned in this screencast :

The source code for the demo application is available as a NetBeans project.

Enjoy !

, , , , ,

2 Comments

Google’s memory, bitnet, listserv …

Yesterday night I wasn’t in the mood to be too productive, after all, the week end was just starting.  I was randomly browsing the Internet, looking for food for thoughts.

I came across Steven Noel‘s personal blog and notice at the bottom of the page some links, including one to its first usenet post in 1994.

I immediately asked myself, when was my first post on the Internet ? Or, at least, what is the oldest trace of me that Google can find ?

A few minutes later I found

April, 4th 1992 : I answered a question about Stacker (a disk compression utility) compatibility with Windows 3.1 (still in beta at that time)

Same day : I explained how to send FTP commands to an internet server, using a proxy BITnet email server.

My BITNET email address was INFSTDSTORM@BNANDP51.BITNET

Are these my first posts on BITNet’s LISTSERV system ? I can’t remind.  These are the oldest one Google can find.

I can’t resist to add a third one, this one dated from October 1995, I asked on comp.lang.c++ on USEnet how to get the day from a given date.  I received many answers but the one I like most is the last one from the thread :

(23*m/9+d+4+(m<3?y--:y-2)+y/4-y/100+y/400)%7

It is applicable to the Gregorian calendar, with m=month, d=day, y=year

Today, because this post is not business related, because it is the week end, because my friends and family in the US just celebrated Thanksgiving, I would like to finish this post “a la” Doc Teger, i.e. with a song.

It’s a french song from author Alain Chamfort : “Trace de Toi” (traces of you)

, ,

No Comments

First run of OpenJDK 1.7 for Mac OS X

My colleague Alexis recently shared a couple of links on Twitter to DMG files containing recent builds of OpenJDK for Mac OS X.

These builds are created by the community for the community – they are experimental and are probably not stable.  Thanks Gildas and Henri for your work !

I downloaded the 64 bits version (32 bits version also available) and installed it in a couple of minutes.  These builds install in Apple proposed location : /Library/Java/JavaVirtualMachines

First test is obviously :

marsu:~ sst$ /Library/Java/JavaVirtualMachines/openjdk-1.7-x86_64/bin/java -version
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-henri_2010_11_25_16_22-b00)
OpenJDK 64-Bit Server VM (build 20.0-b02, mixed mode)

Then I configured Netbeans to use that JDK to compile and run projects :

Netbeans 6.9 has build in modules to support some upcoming Java SE 7 syntax, such as the language simplifications proposed by project Coin.

BTW, should you want to create the builds yourself, everything is documented – you can even start a continuous build with Hudson. You can then download specific scripts to build OpenJDK on MacOSX and to create the installation packages (Will require Apple’s Developer Tools to be installed)

Enjoy !

, ,

4 Comments

JavaFX Client for JAX-RS Tutorial

Last week, during the Devoxx conference, Alexis (Java and GlassFish dude) and Antonio (book author and Paris JUG Leader) gave a Java EE 6 hands-on training session.

They based their labs and samples on the Java EE 6 Tutorial code sample project available on Kenia.com

I modestly contributed to Demo 11, JAX-RS and Jersey.  The demo already included several clients (web based, android,…) and we added a JavaFX application to the set.

You can get the source code from Kenai and experiment with it (this a NetBeans project that should compile just fine with NetBeans 6.9)

Have fun !

, ,

No Comments

Devoxx unofficial videos posted

Nicolas, the french guy behind Le Touilleur Express blog, just posted three Devoxx videos, these are great 3 minutes show giving you a sense of what Devoxx really is.

Day 1

Day 2

Day 3

, ,

No Comments

Custom components in JavaFX 1.3 – revisited

Last year, I posted some details about creating your own UI control using JavaFX, by subclassing the Node class and extending it the way you like.  For the sake of this example, I created a custom Search Control based on JavaFX’s TextBox

Last month, Oracle did release a new version of JavaFX, version 1.3.1.  This version includes a whole bunch of welcome changes but, unfortunately, some incompatible APIs changes.

Net result : my search text box sample is not compiling anymore.

When subclassing Node class, it is not longer permitted to override the create method.  Instead, developers must now use the children property.  This property contains an Array of Node instances.  You just rip and replace the component’s original array or you add your nodes into the array.

JavaFX 1.3 also introduces some subtile changes in the CSS properties names.  Specific JavaFX properties names are now starting with “-fx-

My modified sample application is available to download or you can just Java Web Start it by clicking on the “Launch” button below.

As usual, comments and remarks are welcome. Have fun !

1 Comment