Click or drag to resize
PoolingOptions Class

Represents the options related to connection pooling.

For each host selected by the load balancing policy, the driver keeps a core amount of connections open at all times (GetCoreConnectionsPerHost(HostDistance)). If the use of those connections reaches a configurable threshold (GetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance)), more connections are created up to the configurable maximum number of connections (GetMaxConnectionPerHost(HostDistance)).

The driver uses connections in an asynchronous manner and multiple requests can be submitted on the same connection at the same time without waiting for a response. This means that the driver only needs to maintain a relatively small number of connections to each Cassandra host. The PoolingOptions allows you to to control how many connections are kept per host.

Each of these parameters can be separately set for Local and Remote hosts. For Ignored hosts, the default for all those settings is 0 and cannot be changed.

The default amount of connections depend on the Cassandra version of the Cluster, as newer versions of Cassandra (2.1 and above) support a higher number of in-flight requests.

For Cassandra 2.1 and above, the default amount of connections per host are:

  • Local datacenter: 1 core connection per host, with 2 connections as maximum if the simultaneous requests threshold is reached.
  • Remote datacenter: 1 core connection per host (being 1 also max).

For older Cassandra versions (1.2 and 2.0), the default amount of connections per host are:

  • Local datacenter: 2 core connection per host, with 8 connections as maximum if the simultaneous requests threshold is reached.
  • Remote datacenter: 1 core connection per host (being 2 the maximum).
Inheritance Hierarchy
SystemObject
  CassandraPoolingOptions

Namespace: Cassandra
Assembly: Cassandra (in Cassandra.dll) Version: 3.2.0
Syntax
C#
public class PoolingOptions

The PoolingOptions type exposes the following members.

Constructors
  NameDescription
Public methodPoolingOptions
Initializes a new instance of the PoolingOptions class
Top
Methods
  NameDescription
Public methodGetCoreConnectionsPerHost

The core number of connections per host.

For the provided HostDistance, this correspond to the number of connections initially created and kept open to each host of that distance.

Public methodGetHeartBeatInterval
Gets the amount of idle time in milliseconds that has to pass before the driver issues a request on an active connection to avoid idle time disconnections.
Remarks
A value of 0 or null means that the heartbeat functionality at connection level is disabled.
Public methodGetMaxConnectionPerHost
The maximum number of connections per host.

For the provided distance, this correspond to the maximum number of connections that can be created per host at that distance.

Public methodGetMaxSimultaneousRequestsPerConnectionTreshold

Number of simultaneous requests on all connections to an host after which more connections are created.

If all the connections opened to an host at HostDistance connection are handling more than this number of simultaneous requests and there is less than GetMaxConnectionPerHost(HostDistance) connections open to this host, a new connection is open.

Public methodGetMinSimultaneousRequestsPerConnectionTreshold
Number of simultaneous requests on a connection below which connections in excess are reclaimed.

If an opened connection to an host at distance distance handles less than this number of simultaneous requests and there is more than #GetCoreConnectionsPerHost connections open to this host, the connection is closed.

The default value for this option is 25 for Local and Remote hosts.

Public methodSetCoreConnectionsPerHost
Sets the core number of connections per host.
Public methodSetHeartBeatInterval
Sets the amount of idle time in milliseconds that has to pass before the driver issues a request on an active connection to avoid idle time disconnections.
Remarks
When set to 0 the heartbeat functionality at connection level is disabled.
Public methodSetMaxConnectionsPerHost
Sets the maximum number of connections per host.
Public methodSetMaxSimultaneousRequestsPerConnectionTreshold
Sets number of simultaneous requests on all connections to an host after which more connections are created.
Public methodSetMinSimultaneousRequestsPerConnectionTreshold
Sets the number of simultaneous requests on a connection below which connections in excess are reclaimed.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultHeartBeatInterval
The default heartbeat interval in milliseconds: 30000.
Top
See Also