英文:
Is it possible to do an immediate speculative retry towards the REMOTE datacenter?
问题
我的Cassandra集群托管在两个数据中心。它们不仅之间存在一些延迟,而且它们中的任何一个在某些时候都可能暂时不可用。
EACH_QUORUM不是一个选项,因为它既太慢又不够可用。
LOCAL_QUORUM是一个选择,也是我目前正在使用的,但它不能容忍本地数据中心不可用的情况。
是否可以配置Java驱动程序以立即对远程集群进行推测性重试?
据我所了解,这将把请求发送到两个数据中心,只要其中任何一个返回(通常是本地一个);驱动程序就会返回。
也许我还需要将其与一个RetryPolicy或LoadBalancingPolicy结合使用,以容忍本地或远程数据中心在某些时候暂时不可用。
英文:
My cassandra cluster is hosted on two datacenters. Not only are they separated by some latency, at times either of them might become temporarily unavailable.
EACH_QUORUM is not an option as it is both too slow and not available enough.
LOCAL_QUORUM is an option and what I'm currently doing, but it doesn't tolerate the local datacenter being unavailable.
Is it possible to configure the java driver to do an immediate speculative retry against the remote cluster?
As far as I understand this would send the request to both datacenters and as soon as any of them returns (which would normally be the local one); the driver would return.
Perhaps I would also have to combine this with a RetryPolicy or LoadBalancingPolicy that tolerates that either the LOCAL or REMOTE datacenter is temporarily unavailable.
答案1
得分: 1
理论上它不会起作用,因为在请求/查询的生命周期内都会使用相同的查询计划。
如果你还记得,驱动程序生成一个查询计划,其中本地数据中心中的所有活动主机都优先,远程节点添加在最后。在一个有2个数据中心和每个数据中心有3个节点的集群中,查询计划中的前3个主机将始终是本地数据中心中的3个节点,因此不会尝试对远程节点进行推测执行。
无论如何,听起来你正在寻找一个软件解决方案,用于解决基础设施问题,这并不是一个可行的修复方法。最多,它将成为一个不可预测的权宜之计。
你真的需要解决根本问题。干杯!
英文:
In theory it wouldn't work because the same query plan is used for the life of the request/query.
If you recall, the driver generates a query plan where all live hosts in the local DC are preferred with remote nodes added last. In a cluster with 2 DCs and 3 nodes/DC, the first 3 hosts in the query plan will always be the 3 nodes in the local DC so the remote nodes will not tried for speculative execution.
In any case, it sounds like you're looking for a software solution for what is an infrastructure problem and it's not a viable fix. At best, it is going to be an unpredictable workaround.
You really need to address the underlying issue. Cheers!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论