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

Implement a limiter Layer for volo / 为 Volo 实现一个过载保护 Layer #9

Open
PureWhiteWu opened this issue Aug 10, 2022 · 8 comments
Assignees
Labels
A-volo-ecosystem The volo ecosystem(volo-rs). C-feature-accepted This feature request is accepted. E-help-wanted Stuff where we want help. E-medium This is neither `E-easy` not `E-hard`. T-good-first-issue This issue is good for newcomers.

Comments

@PureWhiteWu
Copy link
Member

Feature Request

Crates

This should be placed under https://github.com/volo-rs.

这应该放在 volo-rs 组织下,作为 volo 的生态。

Motivation

Limiters are very useful when under high qps, which can prevent the server from being overload.

We can support it for volo.

过载保护对于在大流量下保护 server 非常有用,这可以防止 server 被打挂然后雪崩。

Proposal

We propose to support a QPS limiter and a concurrent limiter for volo.

实现一个 QPS limiter 和一个 concurrent limiter,尽可能让 gRPC 和 Thrift 都能用。

@PureWhiteWu PureWhiteWu added C-feature-accepted This feature request is accepted. E-help-wanted Stuff where we want help. E-medium This is neither `E-easy` not `E-hard`. T-good-first-issue This issue is good for newcomers. A-volo-ecosystem The volo ecosystem(volo-rs). labels Aug 10, 2022
@changrui0608
Copy link

If nobody is working on it yet, I may have a try. Although I may have little free time so this may takes a long time. It's OK to assign to other people if I'm not responding.

如果还没人认领,我就先占个坑吧,但不保证投入时间,若之后没响应,也可转让其他人接手。

我这里曾在其他语言框架下,对过载保护有些许经验,包括一些更复杂的机制(e.g. 自监控过载程度、请求优先级机制),想正好先通过相对没那么复杂的 qps 或 concurrent 来尝试上手语言、框架,再之后若时间允许,也会在 volo 下尝试一下上述高级算法的可能性。

@PureWhiteWu
Copy link
Member Author

@raaay0608 十分欢迎!作为认领者,你觉得 crate 名叫什么比较好(我建议以volo-开头)?我帮你在 volo-rs 组织下建立一个 repo~

@changrui0608
Copy link

@raaay0608 十分欢迎!作为认领者,你觉得 crate 名叫什么比较好(我建议以volo-开头)?我帮你在 volo-rs 组织下建立一个 repo~

我觉得不着急建仓,我先在我名下自建repo开发,时机成熟时转移,届时可以按照那时的规划定来修改。(另一方面也防止万一我鸽了,留一个空仓太难看了哈哈哈)

我这边暂时的想法是,根据看你们的代码库规划,若希望所有过载保护类的内容都在一个仓内或者一个group内,据我了解过载保护对应英文是 overload control,因而可以叫 volo-overload-control。若各自为仓,可以类似于 volo-concurrency-limiter 或者 volo-flow-control-limiter 等等,可以参考这个想法来做后续规划。

@PureWhiteWu
Copy link
Member Author

@raaay0608 ok,没问题,我觉得具体是拆分多个仓库还是在一个仓库内,取决于是否有一些公用的组件,以及你作为实现者的个人选择。
期待你的贡献~

@changrui0608
Copy link

@PureWhiteWu 这里初步实现了一版:https://github.com/raaay0608/volo-limit/pull/1/
还希望帮助确认:

  1. 是否还有 code review 需要、代码库规范要求等等,任何问题,可以直接提在上边的链接中
  2. 若代码层面 ok 之后,是否我直接 transfer ownership 到 https://github.com/volo-rs 下即可

@PureWhiteWu
Copy link
Member Author

@raaay0608 太赞了,非常感谢你的贡献,我今天会尽快 review 一下~

@PureWhiteWu
Copy link
Member Author

很抱歉今天事情比较多,没有 review 完,明天我会继续 review~

@changrui0608
Copy link

Hi,抱歉直到最近才有时间和状态填这个坑
concurrency limiter的部分已经重新整理,see:https://github.com/changrui0608/volo-concurrency-limiter/pull/1
若这个没有太大问题,rate limiter 也会重新整理尽快提供
@PureWhiteWu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-volo-ecosystem The volo ecosystem(volo-rs). C-feature-accepted This feature request is accepted. E-help-wanted Stuff where we want help. E-medium This is neither `E-easy` not `E-hard`. T-good-first-issue This issue is good for newcomers.
Development

No branches or pull requests

2 participants