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:
For older Cassandra versions (1.2 and 2.0), the default amount of connections per host are:
Namespace: Dse
public class PoolingOptions
The PoolingOptions type exposes the following members.
Name | Description | |
---|---|---|
PoolingOptions |
DEPRECATED: It will be removed in future versions. Use Create(ProtocolVersion) instead.
Creates a new instance of PoolingOptions using defaults suitable for old server versions (Apache Cassandra 2.0 and below) for compatibility reasons. It's recommended that you use Create(ProtocolVersion) providing the server protocol version. |
Name | Description | |
---|---|---|
Create |
Creates a new instance of PoolingOptions using the default amount of connections
and settings based on the protocol version.
For modern server versions (Apache Cassandra 2.1+) the amount of core connections are set to 1, setting 2 for max local connections. | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GetCoreConnectionsPerHost | 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. | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetHeartBeatInterval |
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.
| |
GetMaxConnectionPerHost |
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. | |
GetMaxRequestsPerConnection |
Gets the maximum amount of requests that can be in-flight on a single connection at the same time.
This setting acts as a fixed maximum, once this value is reached for a host the pool will start rejecting requests, throwing BusyPoolException instances. This setting should not be mistaken with GetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance). | |
GetMaxSimultaneousRequestsPerConnectionTreshold | Number of simultaneous requests on each connections to a host after which more connections are created. If all the connections opened to a host 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. | |
GetMinSimultaneousRequestsPerConnectionTreshold |
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. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
GetWarmup |
Gets whether all connections to hosts in the local datacenter must be opened on connect. Default: true.
| |
SetCoreConnectionsPerHost |
Sets the core number of connections per host.
| |
SetHeartBeatInterval |
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.
| |
SetMaxConnectionsPerHost |
Sets the maximum number of connections per host.
| |
SetMaxRequestsPerConnection |
Sets the maximum amount of requests that can be in-flight on a single connection at the same time.
This setting acts as a fixed maximum, once this value is reached for a host the pool will start rejecting requests, throwing BusyPoolException instances. This setting should not be mistaken with SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance, Int32). | |
SetMaxSimultaneousRequestsPerConnectionTreshold |
Sets number of simultaneous requests on all connections to an host after
which more connections are created.
| |
SetMinSimultaneousRequestsPerConnectionTreshold |
Sets the number of simultaneous requests on a connection below which
connections in excess are reclaimed.
| |
SetWarmup |
Sets whether all connections to hosts in the local datacenter must be opened on connect. Default: true.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Name | Description | |
---|---|---|
DefaultHeartBeatInterval |
The default heartbeat interval in milliseconds: 30000.
| |
DefaultMaxRequestsPerConnection |
Default maximum amount of requests that can be in-flight on a single connection at the same time after
which the connection will start rejecting requests: 2048.
|