3
votes

I'm using Spring Data Neo4j in my project and I've noticed it takes too much time while saving my node entity classes (>300ms/node), which actually are pretty simple (they only contain one property, a simple long id). The relationships between nodes are also quite simple (I'm simply trying to represent a social network). For the rest, I use cypher queries and the timings are pretty much faster and acceptable (~3-30ms).

This turns out to be a huge problem, since a basic part of my project is populating the graph and only then "trigger" queries. Any suggestions what the reason(s) could be? The Spring Data Neo4j version I'm using is 2.1.0.RELEASE and I'm using the repositories approach.

Thank you in advance!

1
I've finally solved this issue. Every save call from the repository was introducing a huge overhead as it's considered a single transaction, as explained here: stackoverflow.com/questions/9568203/…. By using the Neo4j-Core API the execution time was highly improved satisfying my app needs!jarandaf

1 Answers

1
votes

It depends on the mapping mode you use, simple mapping is much slower as it has to merge your object graph back to Neo4j. Advanced mapping is much faster as it is a thin layer on top of Neo4j (read and write through).

You should create the transaction on a higher level anyway that spans a business operation.