Friday, June 14. 2013
Couchbase Manager for Glassfish: Version 0.2
Going back with my couchbase-manager this week the new version 0.2 has been released. That was long ago when the first version of the manager was made public but I have been waited how several issues evolved. I have to admit that there has not been a lot of movement but I think it is a good time for the second version.
Let's start with the new features in the version:
Two new properties can be used inside the manager. The persistTo and replicateTo properties are two new features of the last versions of the couchbase Java client. In this new version you can configure the manager in order to assure that the session data is stored in disk or replicated to a defined number of nodes.
Remember that the couchbase-manager is asynchronous in nature so the properties are used in such a way. For example a session saved with persistTo=ONE assures that the next operation will wait for the set/cas operation which, in turn, will wait the operation to be saved in the disk of one node.
The special transcoder that the manager uses (it has to handle with the special ObjectStreams that glassfish uses) has been moved from being used in the operations (just another parameter) to be incorporated in a CouchbaseConnectionFactory. That was because of the previous new feature, both the transcoder and persist/replication options cannot be passed as the same time as arguments in all the operations.
Previous version has several problems shutting down the manager. Mainly it was because glassfish is quite restrictive about what managers can be configured (a bug was opened with this issue but there has been no progress), and the coherence-web name was reused (this manager is a memory manager for the so-named Oracle product).
In order to avoid the annoying ClassNotFoundException for com.tangosol.net.CacheFactory class, I have created an empty class with the same name and a shutdown method. Besides some other minor fixes were added to stop the manager flawlessly. Now the manager can be stopped and started as many times as it was needed (any application that uses the couchbase-manager can be undeployed without problems).
The main feature of this version is that it is now mavenized. Previously it was a common Netbeans project but the new version uses a maven project (it is easier to compile and the dependencies are more clear).
The main problem here is that glassfish, although it has a maven repository, it seems to be abandoned. Until now (current version 3.1.2.2) it is still usable but I am not very confident about the new versions (maven repository is not updated since May 2011).
Besides I have been added some tests which uses the manager-test web services application. Those tests just check normal operations (creation, update, refresh and deletion of a session) and the four performance tests I used to execute to measure performance. Obviously you need to install the couchbase-manager and the application in some glassfish to test the project.
Finally the manager has been updated and tested with the newer dependencies:
- GlassFish Server Open Source Edition 3.1.2.2
- Couchbase community edition 2.0.1
- spymemcached-2.8.12.jar
- couchbase-client-1.1.5.jar
- commons-codec-1.6.jar
- netty-3.5.5.Final.jar
- httpcore-4.1.1.jar
- httpcore-nio-4.1.1.jar
The new versions of the couchbase client library have added two new dependencies (httpcore and httpcore-nio). In my humble opinion too many dependencies for the library (maybe the new Java 7 nio implementation could be used instead all this mess but I really do not know).
In the period between the versions there was an attempt to use a different serializer technique. The manager now uses common Java Serializer and it is known that other implementations like Kryo give more performance. Some little tests in order to add Kryo were done but I finally gave up because a lot of internal classes of glassfish require special treatment (objects from cdi/weld, EJBs and so on). Objects of those types need to use the Java Serializer again and I simply thought that the change was not worthy.
The bug about the LDAP realm (the couchbase-manager cannot recover a principal which is stored inside an LDAP realm) was at least updated. Another guy experienced the same problem (but in a completely another way) and the bug was marked to be fixed in version 4.0.1. So I know this is a bug and I will not change the way the manager recovers the principal user from the store when logged.
And finally an annoying behavior still persists when using the non-sticky configuration in the manager. As I have commented several times the deletion of the session cannot be done if the session object had been previously locked (it returns an error). For that reason the only way to delete a session is performing an unlock first and then sending the deletion. Obviously if the session is unlocked weird things could happen and, in my tests, they really happen. I will try to insist on this to the couchbase guys, it should be a way to delete a locked object.
So now you already know, the version 0.2 of the couchbase-manager is out. I encourage all of you to test this new version and comment me or fill a bug in github. I need your comments to check if the manager is minimally usable.
Thanks!
EDIT: I have just discovered that the new glassfish maven repo can be found here. Nice! It is a pity the version 2.0 is just released.
Comments