I have a big graph search algorithm which has implemented through Neo4j 
java API (Using as a Neo4j Procedure). I am trying to use threads 
(thread-pool) in order to improve the performance of the algorithm. The 
algorithm is totally a read-only but each thread needs to be a transaction 
in Neo4j to satisfy the ACID properties.

try (Transaction tx= db.beginTx()) {
            ......
            tx.success();
}

Since this is a transaction, I think a node can be accessed by a single 
thread at once. Please correct me if I am wrong.

   - Is there a way to avoid this and access the same node by multiple 
   threads at once because the algorithm performs read-only operations? 
   (Otherwise, I cannot achieve significant performance improvement)

At the end of the execution, I have to collect all the results from threads 
and use *Stream<Object>*  to retrieve search results. So, threads are not 
totally executed independently because a common data structure is needed to 
collect all thread results after threads execution. To address that, I have 
used *Callable<Object>* interface. The problem with this approach is, it 
waits to all thread results sequentially. Some threads which start later 
can be finished the execution earlier compared to some other older threads. 
Since results are collected sequentially, already finished threads have to 
wait until get their chance.

   - Is there a way to overcome this issue or any alternate for *Callable 
*interface 
   that we can collect results to a common data structure as soon as threads 
   complete their work?


-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to neo4j+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/neo4j/ff75b166-bcce-4b89-ac1c-2a4102ad90b5%40googlegroups.com.

Reply via email to