Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize retry in failbackregistry #2752

Closed
carryxyh opened this issue Nov 7, 2018 · 6 comments
Closed

Optimize retry in failbackregistry #2752

carryxyh opened this issue Nov 7, 2018 · 6 comments
Assignees

Comments

@carryxyh
Copy link
Member

carryxyh commented Nov 7, 2018

Currently our retry will start executing when the FailbackRegistry starts. We can completely retry it more regularly.

At present, we have five collections that need to be checked regularly. Why not check regularly when the collection is not empty, check and retry will continue until the collection is empty. If the collection has new elements that require retry, continue to open a task.

So we need to open up to five tasks at most, at least we can do not need to retry.

@carryxyh carryxyh self-assigned this Nov 7, 2018
@carryxyh
Copy link
Member Author

carryxyh commented Nov 8, 2018

目前我们的retry会在FailbackRegistry初始化的时候进行,我们完全可以让他更加规律的执行。

现在我们有五个集合需要定期检查。更好的方式应该是在这五个集合不为空的时候再进行我们的retry。然后在集合为空的时候再停止我们的任务,以此来解约更多的资源,对整个retry流程实现更精确的控制。

这种情况下,最多我们会有五个任务在执行,最少我们不需要任何一个检查+retry的任务(当我们五个集合都为空的时候)。

@lllichen
Copy link
Contributor

lllichen commented Nov 8, 2018

@carryxyh 是想当集合为null的时候终止线程池吗?集合添加元素的时候新生成一个线程池吗?这样成本更高啊,还是写成订阅者模式,抛异常了自己推自己

@carryxyh
Copy link
Member Author

carryxyh commented Nov 8, 2018

线程池的使用场景和这里是不符合的。也没有必要写成SUB/PUB。我上面的描述我思考了一下我觉得不是特别好。没必要对每个集合整体检查。关于这个的设计可以一起讨论一下。

@lllichen
Copy link
Contributor

lllichen commented Nov 8, 2018

加一个消费者队列,来一个消费一个如何

@carryxyh
Copy link
Member Author

carryxyh commented Nov 8, 2018

我们的终极目的是让检查和retry更加符合我们的预期,预期就是每五秒钟处理一次retry操作。
在我看来加一个队列不解决问题。

@carryxyh
Copy link
Member Author

carryxyh commented Nov 8, 2018

#2763
我已经提交了一个PR,对这个优化有兴趣的可以帮忙review一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants