Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

neo4j bolt driver is slower than http end point

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?

like image 974
v rokandla Avatar asked Jun 17 '16 22:06

v rokandla


1 Answers

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.

like image 52
Nigel Small Avatar answered Oct 22 '22 20:10

Nigel Small