Hector Tuning
WSO2 MB uses Hector which is a Java based client to connect to the Cassandra cluster. The CassandraHostConfigurator class in Hector provides several fine grained configuration parameters which can be used to tune the Hector client. The following tuning parameters can be configured from WSO2 MB.
<hector> <loadBalancingPolicy>DynamicLoadBalancingPolicy</loadBalancingPolicy> <maxWaitTimeWhenExhausted>3000</maxWaitTimeWhenExhausted> <maxActive>4000</maxActive> <useHostTimeoutTracker>true</useHostTimeoutTracker> <hostTimeoutCounter>5</hostTimeoutCounter> <hostTimeoutUnsuspendCheckDelay>5</hostTimeoutUnsuspendCheckDelay> </hector>
Parameter | Description |
---|---|
loadBalancingPolicy | Hector provides three types of load balancing mechanisms out of the box - LeastActiveBalancingPolicy, RoundRobinBalancingPolicy and DynamicLoadBalancingPolicy. LeastActiveBalancingPolicy routes requests to the pools with the lowest number of active connections. RoundRobinBalancingPolicy implements a simple round-robin distribution algorithm. DynamicLoadBalancingPolicy uses the fastest performing hosts to send the next requests. By default, WSO2 MB comes with DynamicLoadBalancingPolicy. |
maxWaitTimeWhenExhausted | This is the maximum amount of time to wait if there are no clients available for the next request. By default, this is set to 3 seconds in MB. |
maxActive | The maximum number of active clients to allow. Default value used in MB is 4000. |
useHostTimeoutTracker | If enabled, this property will track HTimeoutExceptions received from specific hosts over a period of time. Default is set to true. |
hostTimeoutCounter | If HostTimeOutTracker is enabled, this value will decide how many times each host will be retried before suspending the host for a number of seconds. This is currently set to 5. |