Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-02-2019 12:35 AM
I am using the official JS Neo4j driver with "bolt+routing" and I can see that you can queries using run
, writeTransaction
or readTransaction
. My question is if there is any magic going on in the run
method that lets the driver automatically discern if a query is read or write, since it seems to support both, even when sending the queries through a FOLLOWER instance.
If it isn't able to find out if things are read or write, what are the consequences then of that? Do all queries end up executing on the LEADER even if they are read queries or does it slow down performance?
Solved! Go to Solution.
08-02-2019 01:18 PM
The driver does not detect whether your query is read or write. You need to use explicit transactions via readTransaction and writeTransaction. If you just do session.run() on everything, the driver will always route your query to the leader to ensure that it can be answered whether it's read or write, but this will place extra strain on just the leader.
For this reason, the recommendation is to always use bolt+routing and explicit transactions to distribute load.
Much more information on querying clusters here:
08-02-2019 01:18 PM
The driver does not detect whether your query is read or write. You need to use explicit transactions via readTransaction and writeTransaction. If you just do session.run() on everything, the driver will always route your query to the leader to ensure that it can be answered whether it's read or write, but this will place extra strain on just the leader.
For this reason, the recommendation is to always use bolt+routing and explicit transactions to distribute load.
Much more information on querying clusters here:
All the sessions of the conference are now available online