简体   繁体   中英

Neo4J Poor Object Creation Performance

I am fairly new to Neo4j, but I managed to get it working fairly well...or so it seemed. I created an embedded database and it worked fine when the graph was incredibly small (a few hundred nodes), however, when it hit around a thousand nodes, it started having lag issues with db object creation (aka nodes or edges). It went from around 10 ms for creation of single objects at smaller db sizes to about 100 ms for creation of single objects with a thousand nodes in the db.

This kind of lag won't work for my project and, honestly, at that size it shouldn't be happening I wouldn't think. I have done my research and can't seem to find too much that helped. I have found mentions of speed differences between Cypher and the Java core API, but have tried both and can't seem to get the speed any better. I was also thinking maybe there was too much transaction overhead, but I don't think that's the case since it doesn't seem to be a problem with the smaller database sizes.

Like I mentioned though, I am new to this so I'm assuming that there is just something I'm missing.

Here is a piece of my current code for uploading for reference:

    try (Transaction tx = graphDb.beginTx()) {
        // Perform DB operations

        Node node = graphDb.createNode(NodeTypes.WORD);

        Label label = DynamicLabel.label("word");
        node.addLabel(label);

        node.setProperty("word", graphWordNode.getWord());

        tx.success();
    }

If I missed any significant details let me know.

Thanks in advance for your help!

为您感兴趣的属性设置适当的索引将极大地加快neo4j的速度,就像对任何数据库一样。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM