を使用してCassandra database in production environment
います。single cross colo cluster of 24 nodes
意味が12 nodes in PHX
あり12 nodes in SLC colo
ます。というreplication factor of 4
意味があり2 copies will be there in each datacenter
ます。
以下は、keyspace
とcolumn families
が作成された方法Production DBA's
です。
placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy' および strategy_options = {slc:2,phx:2} でキースペース プロファイルを作成します。
create column family PROFILE_USER with key_validation_class = 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type' and gc_grace = 86400;
私たちは実行Cassandra 1.2.2
しておりorg.apache.cassandra.dht.Murmur3Partitioner
、 、 with KeyCaching
、SizeTieredCompactionStrategy
およびVirtual Nodes
enabled も持っています。Cassandra ノードはHDD instead of
SSD にデプロイされます。
を使用Astyanax client
してデータを読み取るためにCassandra database
使用していconsistency level as ONE
ます。50 Millions records
を使用して実稼働クラスターに (24 ノードで合計約 285GB のデータ)を挿入Astyanax client
し、圧縮が完了した後、実行を開始しread against the Cassandra production database
ました。
以下は、次を使用して接続構成を作成するコードですAstyanax client
-
/**
* Creating Cassandra connection using Astyanax client
*
*/
private CassandraAstyanaxConnection() {
context = new AstyanaxContext.Builder()
.forCluster(ModelConstants.CLUSTER)
.forKeyspace(ModelConstants.KEYSPACE)
.withConnectionPoolConfiguration(new ConnectionPoolConfigurationImpl("MyConnectionPool")
.setPort(9160)
.setMaxConnsPerHost(100)
.setSeeds("cdb03.vip.phx.host.com:9160,cdb04.vip.phx.host.com:9160")
.setLocalDatacenter("phx") //filtering out the nodes basis on data center
)
.withAstyanaxConfiguration(new AstyanaxConfigurationImpl()
.setCqlVersion("3.0.0")
.setTargetCassandraVersion("1.2")
.setConnectionPoolType(ConnectionPoolType.ROUND_ROBIN)
.setDiscoveryType(NodeDiscoveryType.RING_DESCRIBE))
.withConnectionPoolMonitor(new CountingConnectionPoolMonitor())
.buildKeyspace(ThriftFamilyFactory.getInstance());
context.start();
keyspace = context.getEntity();
emp_cf = ColumnFamily.newColumnFamily(
ModelConstants.COLUMN_FAMILY,
StringSerializer.get(),
StringSerializer.get());
}
ほとんどの場合、私は95th percentile read performance
動き回ってい8/9/10 ms
ます。
私は、私がより良くなる方法があるかどうかを見ようとしていread performance
ますCassandra database
. 私は 95 パーセンタイルを取得するという印象を受けました1 or 2 ms
が、実稼働クラスターでいくつかのテストを行った後、私の仮説はすべて間違っていました。クライアント プログラムを実行している場所から Cassandra 本番ノードへの ping 時間は です0.3ms average
。
以下は私が得ている結果です。
Read Latency(95th Percentile) Number of Threads Duration the program was running(in minutes) Throughput(requests/seconds) Total number of id's requested Total number of columns requested
8 milliseconds 10 30 1584 2851481 52764072
優れた読み取りレイテンシーパフォーマンスを達成するために他に試してみることができることについて、誰かが光を当てることができますか? 私と同じ状況で、Cassandra を本番環境で使用している同様の人がいる可能性があることはわかっています。どんな助けでも大歓迎です。
助けてくれてありがとう。