使用 nodejs 在 Cassandra 中重试策略 [英] Retry policies in Cassandra using nodejs

查看:28
本文介绍了使用 nodejs 在 Cassandra 中重试策略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于在 nodejs 中为 Cassandra 编写了重试策略,我有一个用例,只要有可用的单节点副本,我就需要通过修改一致性来允许读写最低水平.

我附上了我更新的重试代码(retry.js 中的 DowngradeRetryPolicy),能否请您检查链接并发表您的意见,

https://gist.github.com/harigist/f74b29976702a84f8f7e7e

1) 我希望使用此重试策略的问题列表?
2)这段代码有什么问题吗?我需要做一些改变来处理极端情况吗?

解决方案

使用降级一致性重试策略会使您的应用程序一致性保证处于最低级别.理论上等价于第一次使用较低的一致性级别.

我个人认为这种类型的策略用处不大,除非您处理应用程序的正常模式"和降级模式".

关于代码,我觉得不错.

I finally have written a retry policy for Cassandra in nodejs, I have a use case where the whenever there is a one node replica available I need to allow the read and write by modifying my consistency to the minimum level.

I have attached my updated retry code (DowngradeRetryPolicy in retry.js), Could you please check the link and give your comments,

https://gist.github.com/harigist/f74b29976702a84f8f37e1bf7b509e0e

1) I expect the list of problems in using this retry policy?
2) Anything wrong with this code? Is there a change I need to make to handle corner cases?

解决方案

Using a downgrading consistency retry policy causes your application consistency guarantee to be at minimum level. It would be theoretically equivalent to use a lower consistency level the first time.

I personally don't see much use for that type of policy except in the cases when you are handling a "normal mode" and "degraded mode" of your application.

About the code, it looks good to me.

这篇关于使用 nodejs 在 Cassandra 中重试策略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆