hi,

   Sorry for disturb you , I am a chinese engineer , Excused for my bad english 
:) .


   Recently, I am learning Neo4j and trying to use it in my project . But When 
I make a Pressure on neo4j with 5 theads , 10 theads, 20 and 30, I found the 
nodes inserted to the Neo4J is not change obvious (sometimes not change ~ ~! ). 
Does it not matter with threads ? the kenerl will make it Serial ? Is there any 
documents or something about The performance of Neo4j ? thanks for your help


   
   The program as follows:
   I put this function in ExecutorService ,with 5/10/30 threads. then test for 
the nodes inserted into at same time .(The counts have not changed obviously)


Transaction tx = null;
                Node before = null;
                try {
                        for (int i = 0; i < 1000000; i++) {
                                if(stop == true){
                                        return;
                                }
                                if (graphDb == null) {
                                        return;
                                }
                                try {
                                        if (tx == null) {
                                                tx = graphDb.beginTx();
                                        }
                                        // 引用计数加1
                                        writeCount.addAndGet(1);
                                        int startNodeString = name.addAndGet(1);
                                        Node start = 
getOrCreateNodeWithOutIndex(""
                                                        + startNodeString);
                                        if (before == null) {
                                                // 根节点.哈哈哈 I got U
                                                Node root = 
graphDb.getNodeById(0);
                                                
root.createRelationshipTo(start, LEAD);
                                        }
                                        if (before != null) {
                                                
before.createRelationshipTo(start, LOVES);
                                        }
                                        int endNodeName = name.addAndGet(1);
                                        Node end = 
getOrCreateNodeWithOutIndex("" + endNodeName);
                                        start.createRelationshipTo(end, KNOWS);
                                        before = end;
                                        // 每一千次 commit一次
                                        if (i % 100 == 0) {
                                                tx.success();
                                                tx.finish();
                                                tx = null;
                                        }
                                } catch (Exception e) {
                                         System.out.println("write : = " + e);
                                }
                        }
                } catch (Exception e) {
                } finally {
                        tx.finish();
                }
        }
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to