Skip to main content

M&M - Magnolia and ModeShape

Posted by rah003 on January 3, 2011 at 5:27 AM PST

End of the last year and beginning of this I've spent trying to get Magnolia work with ModeShape. There were issues with both of the apps. On one end, Magnolia had issues with the Modeshape session data refresh strategy, on the other one, Modeshape was sometimes stricter then JCR spec required it to be when it came to queries. All of those were elementary issues that were relatively easy to overcome and I got Magnolia on ModeShape running and working fine.

The next task was to create a bundled webapp so that anyone who wants to try this combo can just grab it and run. Again, this was easily achieved ... few exclusions in poms necessary, but apart from that smooth ride.

Last but not least task before the release was to choose persistence configuration. During my testing, I was happy to use in-memory persistence which of course meant I had to re-install on restart, but was also pleasantly fast.

The default bundle of Magnolia with JackRabbit as a repository comes with Derby to make configuration as simple as posssible (of course for production use you will reconfigure the DB to something else, but to get you quickly started, Derby is small, fast and seamless to get running in the embedded mode).

Obviously, I choose to do the same for ModeShape, but unfortunately, current version of ModeShape doesn't run on Derby (see MODE-XYZ and HHH-3434 for details). Having failed to use Derby I moved on to the next embedded DB - HSQLDB. There i ran into an unexpected issue. I could get the configuration that would perform well, but would not persist data, or I could get the configuration that would persist, but performance would be awful. It was all about the configuration string. Using jdbc:hsqldb:mem:... made DB perform well, but would not persist any data. Using jdbc:hsqldb:file:... or just jdbc:hsqldb:... would persist the data, but would be terribly slow. :(

The next I moved on the H2 DB, but run into same issue as with the HSQLDB - either fast or persistent. Somehow I don't think that this feature is specific to the DB implementation, but has to do something with the hibernate configuration. Searching Hibernate docu, however didn't reveal any obvious solution to the problem.

And just so you know I'm not exaggerating when I claim that the DB is slow - with Derby & JackRabbit, I get Magnolia CE + STK installed in few minutes. In-memory ModeShape config takes about 2 minutes, however HSQLDB or H2 & ModeShape, it takes about 1.5 hour.

So at the moment I'm stuck in trying to make out some working configuration that doesn't require external DB and yet is still persistent. For those interested, here's the config file used to run against HSQLDB, the one for other databases is nearly identical, barring the different dialects, connection strings and drivers.

Latest updates:

  • Using MySQL the installation runs for about 10-15 minutes, so it is much better then other DBs, but still few times slower then same config with JackRabbit.
  • Other people confirmed in IRC (#modeshape @ freenode) performance issues with importing middle to large amounts of data.
  • I somehow suspect that my issues have something to do with the fact that Magnolia keeps multiple sessions open and performs refresh on change.




M&M - Magnolia and ModeShape

And to reply to myself - there seems to be also some issue with the JPA connector itself. All is probably connected since the issue occurs only after system slows down. See MODE-1066 for details.
Maybe the safest config would be to run ModeShape in memory only and back it by Infinispan as described here. :)