-
Notifications
You must be signed in to change notification settings - Fork 617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poor performance loading a moderate number of relationships #2782
Comments
Sorry for getting this issue slip through. But this does not explain to me why it suddenly gets much better when I move the target class to
There must be something in relation to the same node type pattern in the mapping bits as you have already pointed out. Investigating on this. |
"therefor the query needs fetch all other 10.000 entries." <- fast if done with the driver |
The thing is that Persons having Persons in Spring Data domains is a cycle. As described above, we can only assume the worst. Even if this is not your intention, SDN will load it this way specified by your domain model. But this was just an information on the behaviour of SDN. I think that the problem lies somewhere around the lines (or deeper down the stack) what you have figured out. I am currently benchmarking a few scenarios here to see in which cases we experience this drastic mapping performance degradation. Edit: Forgot to mention that I have a not yet more specified idea on how to explain SDN that the domain might look cyclic but the data won't ever be. |
To keep you updated and log my findings here. The problem is interesting because it works as intended.
Keep in mind that from its very nature of the result, we have this big bag of nodes, the same as your custom |
For a lot of relationships on a self-referencing type (10k+), the result will be in the format `n, collect(rel), collect(relNode)`. This brings the whole bucket of `relNodes` every time as a mappable option to the table. Prior to this change, SDN would have to check this complete bucket for potential matching nodes. Just to find out later that there is no relationship to map this one for. Checking the relationship bucket first to find if there is a relationship at all to find a target node for, improves the performance drastically. Closes #2782
For a lot of relationships on a self-referencing type (10k+), the result will be in the format `n, collect(rel), collect(relNode)`. This brings the whole bucket of `relNodes` every time as a mappable option to the table. Prior to this change, SDN would have to check this complete bucket for potential matching nodes. Just to find out later that there is no relationship to map this one for. Checking the relationship bucket first to find if there is a relationship at all to find a target node for, improves the performance drastically. Closes #2782
This got automatically closed by my commit to fix the obvious problem in the code. |
I am trying to load a number of relationships ~10.000 for a single node but I have found a poor performace of spring-data-neo4j while mapping the db response to objects in memory.
Example:
Loading Person node with
name0
ends up in 30+ secondsfindById - Read name0 with 10000 relations in 34048 msec
findByName - Read name0 with 10000 relations in 36735 msec
FullProject LoadTestApplication: https://github.com/adrianiacobghiula/load-performance-spring-data-neo4j
Loading Person node name0 having 15.000 (instead of 10.000)
findById - Read name0 with 15000 relations in 93009 msec
findByName - Read name0 with 15000 relations in 102189 msec
DefaultNeo4jEntityConverter.createInstanceOfRelationships
takes 97% of the timeThe text was updated successfully, but these errors were encountered: