0
votes

I wanted to create Cassandra as datasource on application server which will have connection pooling capacity similar to OracleDataSource. Is this feature supported on any of the application servers?

My application will be deployed on 2 nodes, as of now I am creating a static 1 cluster on each node and getting 1 session created per keyspace I want to add the connection pooling capacity to this setup. I got to know that there is an option to set he connection pooling using PoolingOptions.

cluster = Cluster
            .builder()...
            .withPoolingOptions(poolingOptions).build();
session = cluster.connect("keyspace");

Below are my doubts

  1. How to dynamically increase/decrease the number of connections.
  2. My requests are synchronous requests at max how many requests can be severed from each host simultaneously.
  3. Whether increasing the number of connections on 1 node will affect the connection on other nodes? as data center being used by both the nodes is same.
  4. What is the default pooling mechanism provided by cassandra
1

1 Answers

2
votes

This page in our docs covers it in detail (you didn't say which version you're using, so use the dropdown at the top left to select the relevant documentation).

Quick answers to your questions:

  1. Configure a different core/max pool size.
  2. Numbers of connections * number of requests per connection (both vary depending on driver version, Cassandra version and your configuration, see the doc for details)
  3. Nodes are categorized by "distance" (determined by your LoadBalancingPolicy, but that will generally relate to cluster topology). Nodes at the same distance get the same pool configuration, so if your hosts are in the same datacenter they will use the same pooling strategy.
  4. The defaults depend on the driver/Cassandra versions (again, see the doc for full details).