Search code examples
javaneo4jin-memory-database

Small-scale in-memory graph Database in Java


I'm planning to write a Java application wich relies on a small (Around 3000 nodes) graph to represent its structure. The data should be loaded from a custom file at startup to create an in-memory graph database. I've looked into Neo4j but saw that you can't make it run directly as in-memory. Googling around a bit I found Google JIMFS (Java in-memory file system) may suit my needs.

  • Does anyone have experience with getting Neo4j to work on a JIMFS FileSystem?
  • Are there more suited alternatives wich work in Java (possibly in-memory out of the box like HSQLDB) for small-scale graphs and still provide a declarative query language like Cypher?

Note that performance is not so much of an issue to me, it's more of a playground to gather some experience with graph databases, but I don't want the application to create a Database file system on disk.


Solution

  • Note that performance is not so much of an issue to me,

    In that case you can go for ImpermamentGraphDatabase of neo4j, which is created like this:

    graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase();
    

    It doesn't create any files on filesystem.

    Source:

    http://neo4j.com/docs/stable/tutorials-java-unit-testing.html