Hi, Keep in mind that Neo4j is a fully ACID database. As such, it is safe to use in the same manner as any other ACID database, since it makes use of locking over primitives, deadlock detection, isolation between transactions etc. Having said that:
Yes, the API Neo4j exposes is suitable for manipulation by concurrently running threads. Each thread will run in its own transaction - the XA standard that Neo4j implements enforces a 1-1 correspondence between transaction context and thread. Yes, the API is thread safe. Of course, objects that maintain state, such as Iterators, are still not safe to publish outside the thread. The advantage of having multiple threads is dependent on your use case. If you have lots of I/O blocking operations, read-only threads that work with the memory resident set will progress faster. Or if you have multiple cores to dedicate, it probably makes sense to have one thread per such. Or simply if you want the transaction isolation offered by working in discreet threads such as when serving client requests. Or whatever other scenario you might have where multiple threads make sense. For example, building a web site over Neo4j is a good use case for having multiple threads, one per request. Creating a bulk data import tool on the other hand is not a good case to apply parallelism - since it will be constantly writing to disk, a single thread is fast enough, adding more does not increase throughput. The reasoning behind multithreaded access to Neo4j is pretty much the same as for any other use case. Whatever you choose however is well supported. cheers, CG On Fri, Jun 17, 2011 at 3:23 PM, Norbert Tausch <w...@ntausch.de> wrote: > Hi, > > is it possible to traverse on a Neo4J graph DB using the Java API in > parallel threads? Is this possible within one transaction or does every > thread has to use its own transaction? Is the API thread-safe concerning > read-only access? > Is there any advantage of concerning parallelism when using Neo4j as an > embedded DB? > > Best regards > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user