我们正在使用Cassandra database in production environment. 我们有一个single cross colo cluster of 24 nodes意义12 nodes in PHX和12 nodes in SLC colo。我们有一个replication factor of 4which 的意思2 copies will be there in each datacenter。
以下是我们keyspace的.column familiesProduction 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.Murmur3Partitionerwith和enabled 。Cassandra 节点部署在SSD 上。KeyCachingSizeTieredCompactionStrategyVirtual NodesHDD instead of
我正在使用从usingAstyanax client读取数据。我在生产集群中插入(在 24 个节点上总共大约 285GB 的数据),在压缩完成后,我开始做.Cassandra databaseconsistency level as ONE50 Millions recordsAstyanax clientread 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。任何帮助将不胜感激。
谢谢您的帮助。