私は、apache-cassandra-3.10とCassandraCSharpDriverバージョン3.2.1を使用して、Cassandraの概念証明を行っています。
C#で大量のダニデータをカッサンドラに入れたいです。
現在のスキーマは次のようになっています。
CassandraインサートパフォーマンスC#
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);
私は次のように準備されたステートメントを使用しています:
//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);
をI /秒約600のインサートの挿入のパフォーマンスで立ち往生しています。このコードでは - 私のdevのマシン上で両方( i7)と私のマシン(16コアの獣)のようなプロダクト。
スキーマまたはC#コードのパフォーマンスが向上していますか?それとも、カッサンドラの設定をさらに微調整するだけですか?
私はカサンドラについて何も知らないが、「カサンドラ一括挿入のC#をグーグルサイト:stackoverflow.com "興味深い結果をたくさん生成する – Lanorkin
あなたが挿入するたびにSession.Prepareを使用していますか? –
いいえ - コード例を適宜更新します。 – weismat