1. A new Ruby driver for Cassandra

    For the last months I’ve been working on a driver for Cassandra’s new native protocol, and today I released version 1.0.

    Before 1.2 all Cassandra drivers used Thrift, but in 1.2 a new binary protocol was introduced. The Ruby Thrift libraries have never worked well, especially not in JRuby, and because of that using Cassandra with your Ruby application has never been a great experience. Hopefully that will change now.

    cql-rb is pure Ruby, works with both MRI and JRuby and has no other dependencies. It has support for most of the features of CQL3 and Cassandra 1.2, including prepared statements and authentication. It’s built around a non-blocking IO reactor to make full use of the binary protocol’s support for request pipelining, and maximize performance.

    For version 1.0 the focus has been to support the features needed for most applications, to be stable enough for production and to provide good performance. Now when 1.0 is out I will try to implement some of the more advanced features that exist in Datastax Java driver, for example automatic peer discovery, reconnection on node failures, support for tracing requests and compression.

    Finally, here’s a snipplet to demonstrate basic usage, there are many more examples in the README, and in the API docs.

    require 'cql'
    client = Cql::Client.connect
    result = client.execute('SELECT * FROM peers')
    result.each do |row|
      p row