Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Neo4j purely in memory without any persistence

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.

like image 891
cprsd Avatar asked Nov 10 '12 18:11

cprsd


2 Answers

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:

  • Loading all Neo4J db to RAM
like image 147
DNA Avatar answered Oct 31 '22 19:10

DNA


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.

like image 23
Mattias Finné Avatar answered Oct 31 '22 19:10

Mattias Finné