Cassandra Non-Default Durability Test

29 Nov 2015

Let's test Cassandra running on one node with durability settings where Cassandra only acknowledges writes after they've actually been fsynced to the commit log.

In a root terminal, use the script (detailed above) to guarantee our hard drive writes when it says it writes, rather than caching to the drive's RAM:

# ./

In user terminal 1, edit cassandra.yaml so that commits actually sync to disk before acknowledging the write to the client.

$ cd ${HOME}/apache-cassandra-3.0.0/conf
$ vim cassandra.yaml
commitlog_sync: periodic  ==>  #commitlog_sync: periodic
commitlog_sync_period_in_ms: 10000  ==>  #commitlog_sync_period_in_ms: 10000

#commitlog_sync: batch  ==>  commitlog_sync: batch
#commitlog_sync_batch_window_in_ms: 2  ==>  commitlog_sync_batch_window_in_ms: 2

Also remove any data left around by previous durability tests:

$ rm -rf cd ${HOME}/apache-cassandra-3.0.0/data/*
$ cd ${HOME}/apache-cassandra-3.0.0/bin
$ ./cassandra -f

In user terminal 2:

$ cd ${HOME}/apache-cassandra-3.0.0/bin
$ ./cqlsh -e "create keyspace foo with replication = {'class':'SimpleStrategy', 'replication_factor':1};"

$ ./cqlsh -k foo -e "drop table t;"
$ ./cqlsh -k foo -e "create table t (i int primary key);"

In user terminal 3:

$ cd go/src/
$ ./insert-ints
inserted 1047
inserted 1048
inserted 1049
inserted 1050
Did not insert 1051

In user terminal 4:

$ ./ 

In terminal 1:

$ ./cassandra -f

In terminal 2:

$ ./cqlsh -k foo -e "select count(*) from t;"


(1 rows)

$ ./cqlsh -k foo -e "select max(i) from t;"


(1 rows)

Looks like those durability settings work as advertised!