【问题标题】:Slow timeout 500 msec/cross-node WARNING慢速超时 500 毫秒/跨节点警告
【发布时间】:2019-09-07 21:55:49
【问题描述】:

我有一个树节点 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:
[/x.y.z.a: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 毫秒”超时的参考。那么我该如何调整这个超时呢?查询大量分区/数据时,是否有任何选项可以避免以 Exception 结尾?

作为旁注,我使用 future 以异步方式检索数据:

 import com.datastax.driver.core.ResultSetFuture;

【问题讨论】:

  • “当我从 Java 客户端询问大量数据时”- 是的,不要那样做。
  • 我的意思是从多个分区以异步方式与期货检索大量数据。每个分区都遵循最佳实践 (

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


【解决方案1】:

默认slow_query_log_timeout_in_ms 是 500,不是实际超时,只是通知/日志记录。如果你想要更高,你可以在你的 yaml 中更新它。

500 毫秒虽然很慢,但可能表明您的环境或查询中有问题。虽然这种情况很少见,但可能只是周期性的 GC,可以通过客户端推测重试来缓解。

【讨论】:

  • 关于我的第一部分问题的有趣答案。但是“连接关闭”执行异常客户端呢?我在服务器端日志中没有任何明确的内容(除了我在第一篇文章中显示的警告,您解释说这并不重要,因为它不会显示发生的真正超时),但是我的大型查询以令人惊讶的方式在客户端失败了“连接关闭”异常..谢谢!
  • 请求真的失败了吗?客户端应将其移至下一个主机。导致该异常的原因有很多,包括节点关闭(即来自 OOM 的查询错误)、网络问题、操作系统配置问题。基本上是连接重置。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-28
  • 2023-03-09
  • 2016-11-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多