neo4j - Slow CRUD @RelationshipEntity in SDN 4.0 -


i try save properties on relathionentity

as read here

how crud @relationshipentity in sdn 4.0

this possible saving 1 of start/end node, notice extreme slow instead of saving node deth 0 (saving node depth 0 takes 2ms, saving node depth 1 takes 1000ms). node i'm trying save has 4 relationships

i've tried session.save(...) (org.neo4j.ogm.session.session) on object annotated @relationshipentity, nothing

i use spring-data-neo4j 4.0.0.release , neo4j 2.2.5

follow code entities , relationships:

@nodeentity public class entitya{    @graphid    private long             nodeid;    private string               propertya;    @relationship(type = "relationshipab", direction = relationship.outgoing)    private set<relationshipab>  entitiesb   = new hashset<relationshipab>(); }  @nodeentity public class entityb{    @graphid    private long nodeid;    private string   propertyb; }  @relationshipentity(type = "relationshipab") public class relationshipab{    @graphid    private long nodeid;    @startnode    private entitya  entitya;    @endnode    private entityb  entityb;    @property    private string   propertyab;  } 

follow simple test case checking performace:

    entitya entitya = new entitya();     entitya.setpropertya("propertya");     entityarepository.save(entitya);      (int = 0; < 100; i++) {         entityb entityb = new entityb();         entityb.setpropertyb("propertyb-" + i);         entitybrepository.save(entityb);          relationshipab rel = new relationshipab();         rel.setentitya(entitya);         rel.setentityb(entityb);         rel.setpropertyab("propertyab-" + i);          entitya.getentitiesb().add(rel);          date startdate = new date();         entityarepository.save(entitya, 1);         date enddate = new date();         system.out.println("time adding " + (i + 1) + " node: " + (enddate.gettime() - startdate.gettime()) + " ms");     }      iterator<relationshipab> iter = entitya.getentitiesb().iterator();     (int = 0; < 10; i++) {         iter.next();     }     iter.next().setpropertyab("newproperty1");     date startdate = new date();     entityarepository.save(entitya, 1);     date enddata = new date();     system.out.println("time cahnge first relationship property: " + (enddata.gettime() - startdate.gettime()) + " ms");      (int = 0; < 20; i++) {         iter.next();     }     iter.next().setpropertyab("newproperty2");     startdate = new date();     entityarepository.save(entitya, 1);     enddata = new date();     system.out.println("time cahnge second relationship property: " + (enddata.gettime() - startdate.gettime()) + " ms");      (int = 0; < 10; i++) {         iter.next();     }     iter.next().setpropertyab("newproperty3");     startdate = new date();     entityarepository.save(entitya, 1);     enddata = new date();     system.out.println("time cahnge third relationship property: " + (enddata.gettime() - startdate.gettime()) + " ms"); 

the adding nodes takes less 100ms, first update (the save after setpropertyab("newproperty1")) takes 1s, next update takes 4s , last 1 7s

as suggested michael hunger, performance problems fixed in version:

<dependency>     <groupid>org.neo4j</groupid>     <artifactid>neo4j-ogm</artifactid>     <version>1.1.3-snapshot</version> </dependency> 

until 1.1.3 released, you'll need add dependency snapshots repository:

<repository>     <id>neo4j-snapshots</id>     <url>http://m2.neo4j.org/content/repositories/snapshots</url>     <snapshots>         <enabled>true</enabled>     </snapshots> </repository> 

we tested our solution.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -