Coder
Coder

Reputation: 3262

Connection pooling in apache cassandra

Using the same client instance (One for each keyspace) for all the queries in the application, Will this scale in Cassandra?

const client = new cassandra.Client({ contactPoints: ['172.30.56.60','172.30.56.61','172.30.56.62'], keyspace: 'qnapstat',
                                      policies : { loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy
                                                 } });

Or Is it recommended to use new client instance for every query?

Please show some light?

Upvotes: 1

Views: 135

Answers (1)

Alex Ott
Alex Ott

Reputation: 87234

No, you don't need to have client instance per query or keyspace - clients is very expensive to establish. Client automatically handles all queries in parallel, even for different keyspaces. You may tune the number of connection to local/remote DCs, but the default 1 per host is quite good choice.

Upvotes: 3

Related Questions