6

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?

QoP
  • 27,388
  • 16
  • 74
  • 74
v rokandla
  • 61
  • 2

1 Answers1

3

It's unclear from your description what aspects of Bolt you are comparing with what aspects of HTTP and what metrics you are measuring. Maximum throughput? Individual query latency? And for what workload? Have you taken into account cache warming in your tests?

Given that Bolt is stateful and HTTP stateless, there is no value in including session acquisition and release in your measurements; indeed, this will skew your readings. Instead, compare only the query and result parts.

Nigel Small
  • 4,475
  • 1
  • 17
  • 15
  • Nigel, I am comparing time taken process a query. Time compared include opening a session, executing the query and closing the session. Just query and result part is same for BOLT and also with HTTP and the database cache is warmed up. Observation is opening and closing a session for each query is overhead when compared to HTTP end point. Is there a way to avoid it? – v rokandla Jun 20 '16 at 16:57