I am doing a proof of concept on Cassandra using the apache-cassandra-3.10 and CassandraCSharpDriver version 3.2.1.
I want to put in a large amount of Tick data into Cassandra with C#.
My current schema looks like this.
CREATE TABLE my_keyspace.ticks (
instrumentcode int,
timestamp timestamp,
type smallint,
exchange smallint,
price decimal,
volume int,
PRIMARY KEY (instrumentcode, timestamp, type, exchange)
) WITH CLUSTERING ORDER BY (timestamp ASC, type ASC, exchange ASC);
I am using a prepared statement in the following way:
//setup
Cluster = Cluster.Builder().AddContactPoints("localhost").Build();
Session = Cluster.Connect("my_keyspace");
ps = Session.Prepare("Insert into ticks (instrumentcode, timestamp, type, exchange, price, volume) values(?,?,?,?,?,?)");
//repeated re-using the same prepared statement
var statement = ps.Bind(tickCassandra.Instrumentcode, tickCassandra.Timestamp, tickCassandra.Type, tickCassandra.Exchange, tickCassandra.Price, tick.Volume);
var x = Session.Execute(statement);
With this code I am stuck at an insert performance of around 600 inserts/second - both on my dev machine (i7) and my prod like machine (16 core beast).
Do you see any performance improvements in my schema or my C# code? Or do I just need to tweak more the Cassandra configuration?