We are using http end point for read queries so far and planning to move to java bolt driver. But in initial tests it is observed that bolt driver is slower than http end point. following is the java driver code we are using.
Driver instance created at Application context level: Driver neo4jReadDriver = GraphDatabase.driver("bolt://xyz.com", AuthTokens.basic("neo4j","neo4j" ), Config.build().withMaxSessions(20).toConfig());
Application code for executing query:
Session session = neo4jReadDriver .session();
StatementResult result = session.run( "MATCH(p:GOE) return count(p) as cnt");
while ( result.hasNext() )
{
Record record = result.next();
System.out.println("Total number of GOEs:"+ record.get( "cnt").asInt());
}
result.consume();
session.close();
driver.close();
This query consistently takes double the time than http endpoint. Most of the time taken at driver.getSession(). Am i doing any thing wrong here? How to get high throughput using bolt java driver with concurrent users executing the read queries?