Skip to content
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

Performance issues on graph to entity mapping #403

Closed
gusehr opened this issue Sep 13, 2017 · 3 comments
Closed

Performance issues on graph to entity mapping #403

gusehr opened this issue Sep 13, 2017 · 3 comments

Comments

@gusehr
Copy link

gusehr commented Sep 13, 2017

Hi there!
I'm experiencing some performance issues when I'm mapping a query to a Java entity list.
My query results 17k nodes containing 11 properties each one.

Expected Behavior

I know that we pay an overhead for dynamic mapping entities when use meta programming (eg. reflection), but the current implementation of GraphEntityMapper.java is too much expensive.
The GraphEntityMapper.java seems to spend a lot of CPU on Metadata.classinfo().

Current Behavior

1.3s -> When I map the result to a @QueryResult class (SingleUseEntityMapper)
18s -> When I map the result to a List<Entity> (GraphEntityMapper)

Possible Solution

I think that GraphEntityMapper could cache some metadata if the mapping process groups the nodes by its labels. The mapping could run on "Labels batches".

My current workaround is to use @QueryResult classes.

Your Environment (updated)

Java 8
Spring Boot 2.0.0.M3
Neo4j 3.2.3
Spring Data Neo4J 5.0.0.RC3
Linux Ubuntu
Neo4J-OGM 3.0.0-SNAPSHOT (2017-09-14)

Thanks in advance.

@frant-hartm
Copy link
Contributor

Hi,

thank you for reporting this. Could you retest this with SDN 5 RC3 and latest OGM 3.0.0-SNAPSHOT?

Would it be possible for you to share a reproducible use case? Or at least share the domain classe(es) and the query?

@gusehr
Copy link
Author

gusehr commented Sep 14, 2017

Hi Frant.

I can confirm the same behavior on SDN 5 RC3 and OGM 3 SNAPSHOT.
I will update de environment information.

I will provide some classes for a reproducible use case.

@gusehr
Copy link
Author

gusehr commented Sep 15, 2017

Hi Frant.

Please use this repository as a reproducible use case.
https://github.com/gusehr/neo4j-ogm-mapping-test

frant-hartm added a commit that referenced this issue Sep 20, 2017
frant-hartm added a commit that referenced this issue Sep 20, 2017
Fixes #403, performance issue when mapping large number of rows
returned.
frant-hartm added a commit that referenced this issue Sep 20, 2017
Fixes #403, performance issue when mapping large number of rows
returned.
frant-hartm added a commit that referenced this issue Sep 25, 2017
Fixes #403, performance issue when mapping large number of rows
returned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants