Cassandra Python driver protocol version and connection limits don't match

1.1k Views Asked by At

I am using Datastax python driver version:3.23

Cassandra version: DSE version 5.1.16

The output from cqlsh gives the following:

[cqlsh 5.0.1 | Cassandra 3.11.3.5116 | DSE 5.1.16 | CQL spec 3.4.4 | Nativeprotocol v4]

cluster = Cluster(['X.X.X.X'],port=9042,auth_provider=provider,protocol_version=4)
max_requests = cluster.get_max_requests_per_connection(0)
max_connections = cluster.get_max_connections_per_host(0)
print(max_connections)
print(max_requests)

Output:-

8 100

Based on the DataStax documentation max_request_per_host in v4 should be 32,786.

Not sure where is the problem.

Found similar issue for java drive.

1

There are 1 best solutions below

1
On

32k of requests per connection is the theoretical maximum - it's not the actual number. Each driver has some constant as max number of the requests per connection. For example, Java driver allows 1024 request per connection, C# - 2048, etc.

You can increase this value by using cluster.set_max_requests_per_connection for Python driver, or corresponding functions in other drivers. But I don't recommend heavily increase of it - if you have too many in-flight requests, this is a sign that your cluster can't cope with the load, and by increasing the setting you're just hiding the real problem.