Insights into what moves us. Contributions from the Structr team and guests. The Structr Blog

Axel Morgner
14. January 2016

New Database Abstraction API

First, the Structr team wishes everyone a Happy New Year!

You might have noticed that we were a bit quiet over the last couple of weeks, not much tweeting and no new blog articles or updates on our website. Don't be worried, we were and are as productive and busy as ever, and you can see it on the amount and frequency of commits that there's a lot of development work going for our upcoming major release 2.0.

Structr on Neo4j 2.3 - finally available and faster than ever

You might also have noticed that Structr's most recent snapshots (as well as the master branch) still compiled only against Neo4j 2.2 despite the latest stable version of Neo4j being 2.3. The reason was that we experienced a major drop in performance in the way that read access to graph objects and properties was about 60% (!) slower compared to Neo4j 2.2. We did some research and came to the conclusion that the removal of the JVM-based object cache in Neo4j 2.3 is to blame. Apparently, Structr benefits a lot from Neo4j's object/property cache which was removed in favor of a new page cache which was introduced in Neo4j 2.2.

The good news is that from today, Structr supports any (recent) Neo4j version, and provides optimal performance with any version.

New database abstraction layer

Not only to provide the same performance regardless of the underlying embedded Neo4j version, but also to decouple the ongoing development of Structr in general from any particular Neo4j version, we decided to develop a new database abstraction API and drivers for Neo4j 2.2 and 2.3, implementing the mentioned API. It was just merged into the master branch, and there's a new project named structr-neo4j-driver which has to be cloned and compiled against the desired Neo4j version before compiling Structr with the driver as a new dependency.

The following picture illustrates the new architecture:

Performance Boost: 30% up

To ensure optimal performance on any Neo4j version, we built a new (second-level) object cache into Structr's new Neo4j driver to compensate for the removed cache in Neo4j, boosting up the overall performance by about 30% from the level we reached with Neo4j 2.2.

The new database abstraction does not only provide better performance and a certain independence from Neo4j release cycle, but it will also make it possible to implement different types of drivers, for instance using Neo4j embedded, in a remote server setup, or even as in-memory or read-only database. In the long term, the new database abstraction layer will make it possible for Structr to support even other databases with an OpenCypher API.

Please feel free to test the latest Structr snapshot based on the new abstraction layer, available on Maven Central as always: https://oss.sonatype.org/content/repositories/snapshots/org/structr/structr-ui/2.0-SNAPSHOT/.