ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Server
  • Cloud
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Download
ScyllaDB Docs ScyllaDB C# driver Features Connection pooling

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 host. The PoolingOptions allows you 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 depends on the Cassandra version of your cluster, because 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 is:

  • Local datacenter: one core connection per host, with two connections as maximum if the simultaneous requests threshold is reached.

  • Remote datacenter: one core connection per host (being one also max).

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

  • Local datacenter: two core connection per host, with eight connections as maximum if the simultaneous requests threshold is reached.

  • Remote datacenter: one core connection per host (being two the maximum).

Simultaneous requests per connection¶

The driver limits the amount of concurrent requests per connection to 2048.

When the limit is reached for all connections to a host, the driver will move to the next host according to the query plan. When the query plan is exhausted, the driver will yield a NoHostAvailableException containing BusyPoolException instances per each host in the Errors property.

You can use SetMaxRequestsPerConnection() on PoolingOptions to set the limit for the request rate.

Get status of the connection pools¶

You can use GetState() extension method to get a point-in-time information of the state of the connections pools to each host.

ISessionState state = session.GetState();
foreach (var host in state.GetConnectedHosts())
{
    Console.WriteLine($"Host '{host.Address}': " +
                      $"open connections = {state.GetOpenConnections(host)}; " +
                      $"in flight queries = {state.GetInFlightQueries(host)}");
}

Was this page helpful?

PREVIOUS
Connection heartbeat
NEXT
CQL data types to C# types
  • Create an issue
  • Edit this page

On this page

  • Connection pooling
    • Simultaneous requests per connection
    • Get status of the connection pools
ScyllaDB C# driver
  • master
    • master
  • Features
    • Address resolution
    • Authentication and Authorization
    • Automatic failover
    • Column Encryption
    • Driver components
      • ADO.NET
      • Core component
        • Statements
          • Batch statements
          • Per-query keyspace
          • Prepared statements
          • Simple statements
      • Linq component
        • Batch statements with LINQ
      • Mapper component
        • Batch statements with the Mapper
    • Connection heartbeat
    • Connection pooling
    • CQL data types to C# types
      • Date and time representation
      • Nulls and unset
    • Execution Profiles
    • Graph support
    • Cluster and schema metadata
    • Metrics
      • App.Metrics Provider
      • List of metrics
    • Native protocol
    • OpenTelemetry
    • Result paging
    • Parameterized queries
    • Query timestamps
    • Query warnings
    • Request Tracker
    • Routing queries
    • Speculative query execution
    • TLS/SSL
    • Tuning policies
    • User-defined functions and aggregates
    • User-defined types
    • Vector support
  • FAQ
  • Upgrade Guide
  • Examples
  • API Reference
Docs Tutorials University Contact Us About Us
© 2025 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 01 Aug 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.7
Ask AI