By default Pelops will have 20 connections per node
-
I was thinking to modify that to have around 40 connections per node
. So how can I do that in Pelops? Currently, I am creating pool like this-
private void createPool() {
Pelops.addPool(getPoolName(), getCluster(), getKeyspace());
}
/**
* Gets the cluster information
*
* @return
*/
private Cluster getCluster() {
Config casconf = new Config(ModelConstants.CASSANDRA_PORT, true, 0);
Cluster cluster= new Cluster(nodes, casconf, ModelConstants.NODE_DISCOVERY);
return cluster;
}
/**
* Get the keyspace name
*
* @return
*/
public String getKeyspace() {
return keyspace;
}
/**
* Get the pool name
*
* @return
*/
public String getPoolName() {
return poolName;
}
Can anyone provide an example for that so that I can modify that to hold 40 connection per node? Thanks for the help.
Updated Code:-
CommonsBackedPool.Policy pt = new Policy();
pt.setMaxActivePerNode(40);
OperandPolicy op = new OperandPolicy();
Pelops.addPool(getPoolName(), getCluster(), getKeyspace(), pt, op);
I was not sure whether I did the right thing above or not? let me know if it looks right.
Looking at the JavaDocs for Pelops you would use the other Pelops.addPool()
method that allows you to supply an instance of CommonsBackedPool.Policy which is what controls that.