litiales
litiales

Reputation: 171

Guidelines for implementating database manager layer (neo4j) in Java

I am developing a java application that has to handle multiple uers and their requests: ie. a user can be created (registered), can be updated (change avatar,...), or add information to his account (like describing his launch).

For do this I have decided to use neo4j, mainly because of its good performance in relationships (the application is "social").

What I would like to understand, and I'm sure you know the answer, is how to implement multithreading in neo4j.

Here is a little information about my software architecture:

I have neo4j server, then, in my javaApplication I have the neo4j jar that allows me to communicate with the server. The application is divided into layers, each one of which one is a library that is included in the next layer. This means that I just have to re-write a layer and expose the same interface, and no other layer will be affected.

The problem is that with MySql I had a Pool of connections from where I got one and used it in the higher layer; everything was hidden and the JDBC handled concurrency for me.

In neo4j, however I don't understand how to implement parallelism: is it automatically handled from neo4j? Is that a connection pool?

I think I understand that that I must create a "connection" and that I share the same one with all requests. Is it right?

Are there some best practices to do that?

Upvotes: 0

Views: 616

Answers (1)

Peter Neubauer
Peter Neubauer

Reputation: 6331

In a Java application and embedded mode, Neo4j is running as part of your application process. You handle threads, and can spawn multiple threads for your traversals and treat Neo4j as a singleton. I you want automatic thread handling, you could use Neo4j Server (over REST) that gives you webserver-liek functionality, including multiple threads.

Upvotes: 1

Related Questions