Showing results for 
Search instead for 
Did you mean: 

Load balancing in Causal Cluster consisting of only Cores


we have a simple cluster consisting of only 3 Cores.
On intensive WRITE operations, we observe significant CPU load on only one of the nodes, which is Leader. Which is OK I guess since only a Leader receives writes and communicates them to the others.
However, on intensive READ operations, the behaviour is similar - only Leader is loaded.
So my question is (I could not find a clear explanation of it in the docs) - should READ operations be load-balanced between all members if a cluster consists of only COREs, i.e. does not contain any READ_REPLICAs?

We tried to enable this in the configuration, but to no avail:





What version of Neo4j?
When connecting to Neo4j you can specify the URL to connect as either

when using Neo4j 3.5 either bolt://<Neo4j IP Address>:7687 or bolt+routing://<Neo4j IP Address>:7687

when using Neo4j 4.0 either bolt://<Neo4j IP Address>:7687 or neo4j://<Neo4j IP Address>

and to which if connecting as bolt://<Neo4j IP Address>:7687 then all transactions will be constrained to the cluster member defined at . However if you connect at either bolt+routing://<Neo4j IP Address>:7687 or `neo4j://:7687, for the respective version, then the connection is now cluster aware and as such if you send a session.readTransaction it should go to non Leader members and a session.writeTransaction then it will only go to the Leader.

So... what method are you using to connect and then are you utilizing session.readTransaction and session.writeTransactions where applicable

Thank you for the response.

We are using 4.0 version and connect using neo4j:// url.
For the querying method, we use the OGM's Session:

sessionFactory.openSession().query(DataType.class, cypher, parameters)

So I've wrapped the code into explicit transaction of type READ-ONLY, and looks like it helped - a few nodes now are being loaded instead of only one, and the load is smaller.
@dana.canzano Thanks a lot for your help!