Cassandra Drivers


Java Driver for v2.2

Documentation

How Driver Works

Prepare

Parsed the statement in advance and then hashed it and cached it.

Bind

Anti-Pattern

Do not put perpare and bind process in the loop. It will lead the system cache the data over and over again.

for (int i = 1; i < 100; i++) {
    PreparedStatement userSelect = session.prepare("SELET * FROM user WHERE  id = ?");
    BoundStatement userSelectStatement = new NoundStatement(userSelect);

    session.execute(userSelectStatement.bind(1));
}

Execute Async

Async

  • Request pipelining
  • One connection for requests
  • Respnses return whenever