スケーラビリティカサンドラデータベースに問題があります。ノード数が2から8に増えても、データベースのパフォーマンスは向上しません。カサンドラスケーラビリティの欠如
Cassandra Version: 3.7
Cassandra Hardware x8: 1vCPU 2.5 Ghz, 900 MB RAM, SSD DISK 20GB, 10 Gbps LAN
Benchmark Hardware x1: 16vCPU 2.5 GHz, 8 GB RAM, SSD DISK 5GB, 10 Gbps LAN
デフォルト設定はcassandra.yamlで変更された:
cluster_name: 'tst'
seeds: "192.168.0.101,192.168.0.102,...108"
listen_address: 192.168.0.xxx
endpoint_snitch: GossipingPropertyFileSnitch
rpc_address: 192.168.0.xxx
concurrent_reads: 8
concurrent_writes: 8
concurrent_counter_writes: 8
鍵空間:
create keyspace tst WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : '2' };
例表:試験に使用
CREATE TABLE shares (
c1 int PRIMARY KEY,
c2 varchar,
c3 int,
c4 int,
c5 int,
c6 varchar,
c7 int
);
Examplaryクエリ:
INSERT INTO shares (c1, c1, c3, c4, c5, c6, c7) VALUES (%s, '%s', %s, %s, %s, '%s', %s)
私はhttps://github.com/datastax/java-driverを使用します。マルチスレッドでは、クラスタオブジェクトとセッションオブジェクトのいずれかを命令に従って使用します。接続:
PoolingOptions poolingOptions = new PoolingOptions();
poolingOptions.setConnectionsPerHost(HostDistance.LOCAL, 5, 300);
poolingOptions.setCoreConnectionsPerHost(HostDistance.LOCAL, 10);
poolingOptions.setPoolTimeoutMillis(5000);
QueryOptions queryOptions = new QueryOptions();
queryOptions.setConsistencyLevel(ConsistencyLevel.QUORUM);
Builder builder = Cluster.builder();
builder.withPoolingOptions(poolingOptions);
builder.withQueryOptions(queryOptions);
builder.withLoadBalancingPolicy(new RoundRobinPolicy());
this.setPoints(builder); // here all of the nodes are added
Cluster cluster = builder.build()
クエリのコード:
public ResultSet execute(String query) {
ResultSet result = this.session.execute(query);
return result;
}
試験作業中、すべてのノード上のメモリを使用して80%、およびCPU 100%です。私はモニターに接続を使用して驚いています(低すぎる):モニターの
[2016-09-10 09:39:51.537] /192.168.0.102:9042 connections=10, current load=62, max load=10240
[2016-09-10 09:39:51.556] /192.168.0.103:9042 connections=10, current load=106, max load=10240
[2016-09-10 09:39:51.556] /192.168.0.104:9042 connections=10, current load=104, max load=10240
[2016-09-10 09:39:51.556] /192.168.0.101:9042 connections=10, current load=196, max load=10240
[2016-09-10 09:39:56.467] /192.168.0.102:9042 connections=10, current load=109, max load=10240
[2016-09-10 09:39:56.467] /192.168.0.103:9042 connections=10, current load=107, max load=10240
[2016-09-10 09:39:56.467] /192.168.0.104:9042 connections=10, current load=115, max load=10240
[2016-09-10 09:39:56.468] /192.168.0.101:9042 connections=10, current load=169, max load=10240
[2016-09-10 09:40:01.468] /192.168.0.102:9042 connections=10, current load=113, max load=10240
[2016-09-10 09:40:01.468] /192.168.0.103:9042 connections=10, current load=84, max load=10240
[2016-09-10 09:40:01.468] /192.168.0.104:9042 connections=10, current load=92, max load=10240
[2016-09-10 09:40:01.469] /192.168.0.101:9042 connections=10, current load=205, max load=10240
コード:https://github.com/datastax/java-driver/tree/3.0/manual/pooling#monitoring-and-tuning-the-pool
私はいくつかのNoSQLデータベースのスケーラビリティをテストしようとしています。 Redisベースの場合、それは線形スケーラビリティでしたが、ここではまったくではありません。理由はわかりません。ご協力いただきありがとうございます!
パーティションキーにはどのような種類の値がありますか?データはどれくらいうまく分配されていますか?カッサンドラは主キーのハッシュを計算してデータを配信します。すべてのデータに少数のPK値がある場合、使用するサーバーの数は関係ありません。 – riwalk