cassandra - 慢超时 500 毫秒/跨节点警告
问题描述
我有一个树节点 Cassandra 集群。
当我从 Java 客户端询问大量数据时,服务器端出现以下警告:
WARN SELECT * FROM [...] time 789 msec - slow timeout 500 msec/cross-node
WARN SELECT * FROM [...] time 947 msec - slow timeout 500 msec/cross-node
WARN SELECT * FROM [...] time 1027 msec - slow timeout 500 msec/cross-node
WARN SELECT * FROM [...] time 819 msec - slow timeout 500 msec/cross-node
客户端,我最终遇到以下异常:
java.util.concurrent.ExecutionException:
com.datastax.driver.core.exceptions.TransportException:
[/xyza:9042] 连接已关闭
我的服务器配置 yaml 如下:
# How long the coordinator should wait for read operations to complete
read_request_timeout_in_ms: 5000
# How long the coordinator should wait for seq or index scans to complete
range_request_timeout_in_ms: 10000
# How long the coordinator should wait for writes to complete
write_request_timeout_in_ms: 2000
# How long the coordinator should wait for counter writes to complete
counter_write_request_timeout_in_ms: 5000
# How long a coordinator should continue to retry a CAS operation
# that contends with other proposals for the same row
cas_contention_timeout_in_ms: 1000
# How long the coordinator should wait for truncates to complete
# (This can be much longer, because unless auto_snapshot is disabled
# we need to flush first so we can snapshot before removing the data.)
truncate_request_timeout_in_ms: 60000
# The default timeout for other, miscellaneous operations
request_timeout_in_ms: 10000
我没有找到“500 ms”超时的任何参考。那么我该如何调整这个超时呢?查询大量分区/数据时,是否有任何选项可以避免以 Exception 结尾?
作为旁注,我使用 future 以异步方式检索数据:
import com.datastax.driver.core.ResultSetFuture;
解决方案
默认slow_query_log_timeout_in_ms
值为 500,不是实际超时,而只是通知/日志记录。如果您希望它更高,您可以在您的 yaml 中更新它。
500 毫秒虽然很慢,但可能表明您的环境或查询中有问题。尽管如果这种情况很少见,它可能只是周期性的 GC,可以通过客户端投机重试来缓解。
推荐阅读
- python - 如何使用 python 从 MS Access 数据库中检索所有已保存的查询?
- python - 在 django 中使用 url
- java - LibGDX Scene2D 是一种实现 GUI 比例设置的不同方式,而不是将所有内容乘以常数?
- c# - 正确插入文本框和datagridview c# sql
- c# - 为收到的每个请求替换 MvcNewtonsoftJsonOptions
- java - 使用 Opendaylight 通过 NETCONF 检索列表时出现“XML 输入中的命名空间重复”错误
- php - PHP电子表格数据填充不会通过列“Z”
- pandas - 我想使用循环在列中随机添加 a 到 z。我该怎么做?
- r - approx(nintv, cvals[nintl:ninth, tintl, i], n = max(nintv) - 中的错误:需要至少两个非 NA 值进行插值
- python - 如何使用 pd.eval() 对 pandas 数据框中的行进行索引?