15

I don't want to persist any data but still want to use Neo4j for it's graph traversal and algorithm capabilities. In an embedded database, I've configured cache_type = strong and after all the writes I set the transaction to failure. But my write speeds (node, relationship creation speeds) are a slow and this is becoming a big bottleneck in my process.

So, the question is, can Neo4j be run without any persistence aspects to it at all and just as a pure API? I tried others like JGraphT but those don't have traversal mechanisms like the ones Neo4j provides.

cprsd
  • 473
  • 4
  • 13
  • 3
    Did you find a feasible solution yet? – jagamot Dec 20 '12 at 17:09
  • so Neo4j does not support this? I also would like to run Neo4j in memory, without any backup in the file system, just for its graph traversing capabilities. – Sergio Nov 16 '15 at 14:59

3 Answers3

4

As far as I know, Neo4J data storage and Lucene indexes are always written to files. On Linux, at least, you could set up a ramfs filing system to hold the files in-memory.

See also:

Community
  • 1
  • 1
DNA
  • 42,007
  • 12
  • 107
  • 146
  • we are planning to do an in-memory implementation of Neo4j, but first after 1.0, simply no bandwidth right now :( I'm using 1.8 and don't see in memory support in the docs anywhere. – cprsd Nov 11 '12 at 06:22
  • Yep, I guess nobody found that bandwidth yet ;-) – DNA Nov 11 '12 at 10:48
  • 2
    Also, you could try ImpermanentGraphDatabase for testing? https://github.com/neo4j/community/blob/master/kernel/src/test/java/org/neo4j/test/ImpermanentGraphDatabase.java – Peter Neubauer Nov 11 '12 at 12:09
2

How many changes do you group in each transaction? You should try to group up to thousands of changes in each transaction since committing a transaction forces the logical log to disk.

However, in your case you could instead begin your transactions with:

db.tx().unforced().begin();

Instead of:

db.beginTx();

Which makes that transaction not wait for the logical log to force to disk and makes small transactions much faster, but a power outage could have you lose the last couple of seconds of data potentially.

The tx() method sits on GraphDatabaseAPI, which for example EmbeddedGraphDatabase implements.

Mattias Finné
  • 3,034
  • 1
  • 15
  • 7
  • I switched over to the batch inserter now, slight improvement but not a lot. So no transactions to worry about. – cprsd Nov 11 '12 at 06:21
0

you can try a virtual drive. It would make neo4j persist to the drive, but it would all happen in memory https://thelinuxexperiment.com/create-a-virtual-hard-drive-volume-within-a-file-in-linux/

Laurent Picquet
  • 1,147
  • 11
  • 12