Search code examples
cassandradatastaxcassandra-3.0

Number of connections per host in Datastax C++ driver


I've not been able to understand the role of a 'connection' in the execution of a query on a host.

cass_cluster_set_core_connections_per_host sets the number of connections made to each server in each IO thread. Why is this parameter configurable? What's the benefit of having more than 1 connection per IO thread? What decides the optimum value for this parameter?


Solution

  • This function sets the initial number of connections per host, and it could be increased up to value set by cass_cluster_set_max_connections_per_host function (by default it's 2). New connection is created when the number of in-flight request is greater than set by cass_cluster_set_max_concurrent_requests_threshold (default 100). You can set higher value with cass_cluster_set_core_connections_per_host if you know that you'll generate the big number of in-flight request from the beginning - in this case you won't spend time opening an additional connection when you're executing requests.