首页 > 解决方案 > 客户端和服务器端超时设置的区别

问题描述

按照这个流程:Cassandra read_request_timeout_in_ms 为外部(客户端)请求设置,我知道在服务器端设置超时是不够的,我们还需要在客户端设置。

在客户端和服务器端设置超时有什么区别?

例子 :

          Setting the request time out in server side in Cassandra (cassandra.yaml)
                                 VS
          Setting the request time out in client side in Cassandra driver 

编辑:

driver read timeout: the driver did not receive any response from the current coordinator within SocketOptions.setReadTimeoutMillis. It invokes onRequestError on the retry policy with an OperationTimedOutException to decide what to do.
server read timeout: the driver did receive a response, but that response indicates that the coordinator timed out while waiting for other replicas. It invokes onReadTimeout on the retry policy to decide what to do.

有人可以清楚地解释两者之间的目的和区别吗?

标签: cassandracassandra-3.0

解决方案


在服务器端(即在 cassandra.yaml 中)设置超时与使用 SocketOptions.setReadTimeoutMillis 设置驱动程序(也称为客户端)超时不同。他们都单独工作。一个不会超越另一个。通常,您应该将驱动程序超时设置为略大于服务器端超时。

  1. 如果 Cassandra 节点可访问且正常工作,但它无法在 cassandra.yaml 中提到的读取时间内响应,它将引发异常,驱动程序将获得相同的异常。如果已配置,驱动程序可能会重试。
  2. 如果 Cassandra 节点由于某种原因没有响应,驱动程序不能无限期地等待。那是驱动程序超时启动并在 Cassandra 没有响应时引发异常的时候。

推荐阅读