【问题标题】:Cassandra Python driver protocol version and connection limits don't matchCassandra Python 驱动程序协议版本和连接限制不匹配
【发布时间】:2020-09-29 08:39:56
【问题描述】:

我正在使用 Datastax python 驱动版本:3.23

Cassandra 版本:DSE 版本 5.1.16

cqlsh 的输出如下:

[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)

输出:-

8 100

根据 DataStax 文档,max_request_per_host in v4 应该是 32,786。

不确定问题出在哪里。

Found similar issue for java drive.

【问题讨论】:

    标签: python cassandra datastax cassandra-3.0 datastax-python-driver


    【解决方案1】:

    每个连接 32k 的请求是理论上的最大值 - 这不是实际数量。每个驱动程序都有一些常数作为每个连接的最大请求数。例如,Java 驱动允许每个连接 1024 个请求,C# - 2048 等。

    您可以通过使用cluster.set_max_requests_per_connection 用于Python 驱动程序或其他驱动程序中的相应函数来增加此值。但我不建议大幅增加它 - 如果您有太多正在进行的请求,这表明您的集群无法应对负载,并且通过增加设置您只是隐藏了真正的问题。

    【讨论】:

    • 我尝试使用集群设置 max_requests,set_max_requests_per_connection(0,100)。它会引发错误-使用protocol_version 1或2时会产生影响。我已经浏览了python驱动程序的源代码,观察到NTP版本> 2不支持设置参数。但是,我可以使用集群手动传递较低版本=集群(['xxxx'],protocol_version=2)。在 python 驱动程序中弃用此功能是否有任何具体原因。这是否也适用于 java 驱动程序。
    猜你喜欢
    • 2018-04-11
    • 1970-01-01
    • 1970-01-01
    • 2019-06-04
    • 2021-06-22
    • 1970-01-01
    • 2021-01-08
    • 2017-08-07
    • 2014-06-09
    相关资源
    最近更新 更多