C# Driver 1.0 for Apache Cassandra

Connection options

There are three classes the driver uses to configure node connections.

Protocol options

Protocol options configure the port on which to connect to a Cassandra node and which type of compression to use.

Description

Table 1. Protocol options
Option Description Default
Port The port to connect to a Cassandra node on. 9042
Compression What kind of compression to use when sending data to a node: either no compression or snappy. Snappy compression isoptimized for high speeds and reasonable compression. CompressionType.NoCompression

Pooling options

The C# driver uses connections asynchronously, so multiple requests can be submitted on the same connection at the same time.

Description

The driver only needs to maintain a relatively small number of connections to each Cassandra host. These options allow you to control how many connections are kept exactly. The defaults should be fine for most applications.

Table 2. Connection pooling options
Option Description Default value
CoreConnectionsPerHost The core number of connections per host. 2 for HostDistance.LOCAL, 1 for HostDistance.REMOTE
MaxConnectionPerHost The maximum number of connections per host. 8 for HostDistance.LOCAL, 2 for HostDistance.REMOTE
MaxSimultaneousRequestsPerConnectionTreshold The number of simultaneous requests on all connections to an host after which more connections are created. 128
MinSimultaneousRequestsPerConnectionTreshold The number of simultaneous requests on a connection below which connections in excess are reclaimed. 25

Socket options

Socket options configure the low-level sockets used to connect to nodes.

Description

These properties represent low-level socket options.

Table 3. Pooling options
Option Description
ConnectTimeoutMillis The connect timeout in milliseconds for the underlying I/O channel.
KeepAlive The amount of time before you send your peer a keepalive probe packet with no data in it and the ACK flag turned on.
ReceiveBufferSize A hint on the size of the buffer used to receive data.
ReuseAddress Whether to allow the same port to be bound to multiple times.
SendBufferSize A hint on the size of the buffer used to send data.
SoLinger When specified, disables the immediate return from a call to close() on a TCP socket.
TcpNoDelay Disables Nagle's algorithm on the underlying socket.