email iconemail phone iconcall

DataStax C/C++ Driver: 2.5 released!

By Michael Penick -  October 20, 2016 | 0 Comments

We are excited to announce the 2.5 release of the C/C++ driver for Apache Cassandra. This release brings with it a couple new features and several bug fixes.

What's new

Speculative execution

For certain applications it is of the utmost importance to minimize latency. Speculative execution is a way to minimize latency by preemptively starting several of the same query against different nodes. The fastest response is then returned to the client application and the other requests are cancelled. This is a fundamental trade-off between overall throughput for better latency. Speculative execution is disabled by default.

Speculative execution is enabled by connecting a CassSession with a CassCluster that has a speculative execution policy enabled. The driver currently only supports a constant execution policy, but may support more in the future. The following will start up to 2 more executions after the initial execution with the subsequent executions being created 500 milliseconds apart:

CassCluster* cluster = cass_cluster_new();

cass_int64_t constant_delay_ms = 500; /* Delay before a new execution is created */
int max_speculative_executions = 2;   /* Number of executions */

/* ... */


Idempotent queries

Speculative execution will result in executing the same query several times. Therefore, it is important that queries be idempotent (i.e. a query can be applied multiple times without changing the result beyond the initial application). Queries that are not explicitly marked as idempotent will not be scheduled for speculative executions.

The following types of queries are not idempotent:

  • Mutation of counter columns
  • Prepending or appending to a list column
  • Use of non-idempotent CQL function (e.g. now() or uuid())

The driver is unable to determine if a query is idempotent therefore it is up to an application to explicitly mark a statement as being idempotent.

CassStatement* statement = cass_statement_new( "SELECT * FROM sometable", 0);
cass_statement_set_is_idempotent(statement, cass_true);

Beyond speculative execution, marking a query as idempotent allows the C/C++ driver to more eagerly retry requests in the face of spurious failures. In previous releases of the driver any failure of a query after being sent to Cassandra would result in a failure being returned to the client application. The driver is now able to use query's idempotence to make more intelligent decisions about retrying a request instead of always returning a failure.


More detailed information about all the features, improvements and fixes included in this release can be found in the changelog. Let us know what you think about the release. Your involvement is important to us and it influences what features we prioritize. Use the following resources to get involved:

DataStax has many ways for you to advance in your career and knowledge.

You can take free classes, get certified, or read one of our many white papers.

register for classes

get certified

DBA's Guide to NoSQL


Your email address will not be published. Required fields are marked *

Subscribe for newsletter: