13

Is it possible to run Neo4j in memory only without any persistent database/file storage?

The data coming from several xml/json files, and we have to load them into jvm heap memory by using ConcurrentHashmap. Since the data objects have dependencies (parent-child, child can link back to parent), we want to maintain an object graph. Is there any way to use Neo4J in this case; or can you suggest any framework that can support maintaining this kind of object graph.

Thanks you.

user3246920
  • 131
  • 1
  • 4

2 Answers2

9

Neo4j has is an ImpermanentDataBase that is intended for unit testing, but it runs in memory.

See http://docs.neo4j.org/chunked/stable/tutorials-java-unit-testing.html.

cybersam
  • 63,203
  • 6
  • 53
  • 76
  • 1
    Are you aware of any shortcoming regarding the usage of this in-memory database in production? In certain scenario, I would like to use Neo4j for its graph traversal features, but I do not need to persist the database to the file system. I am wondering if it is a good idea to use the ImnpermanentDataBase in that case. – Sergio Nov 16 '15 at 15:04
  • With the the impermanent DB, you would lose all your data if neo4j crashes or gets killed. So, after you restart neo4j, the DB will be empty. That is normally not acceptable for a prduction environment. – cybersam Nov 17 '15 at 02:07
  • 1
    I know. I just want to query using the Neo4J API and cypher some graph like structure I have in memory. If I do not care about persistance for this, is a good idea to do this in a production system? (e.g., memory footprint and performance wise?) – Sergio Nov 17 '15 at 09:28
3

Now, neo4j has first-class support for embedded database unlike the one used only during testing. More details at https://neo4j.com/docs/java-reference/current/tutorials-java-embedded/include-neo4j/.

Vikdor
  • 23,934
  • 10
  • 61
  • 84
  • I see that with embedded database, there is a need for providing a path, the path will be used for writing, what if the application doesn't has the required permission ? – Noor Aug 13 '19 at 09:55