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

Add Throttle Support #743

Closed
Xuanwo opened this issue Sep 29, 2022 · 7 comments · Fixed by #2444
Closed

Add Throttle Support #743

Xuanwo opened this issue Sep 29, 2022 · 7 comments · Fixed by #2444
Assignees
Labels
help wanted Extra attention is needed

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Sep 29, 2022

ThrottleLayer can help users to control the max bandwidth that used by OpenDAL.

@Xuanwo Xuanwo moved this to 📋 Backlog in Xuanwo's Work Sep 29, 2022
@Xuanwo Xuanwo mentioned this issue Sep 30, 2022
8 tasks
@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 18, 2023
@Xuanwo Xuanwo removed the good first issue Good for newcomers label Apr 14, 2023
@morristai
Copy link
Member

Hi @Xuanwo, I'm interested in this issue, but I need more information. For example, is the goal to limit the amount of data that OpenDAL can send over the network in a given time period (e.g. set_write_timeout(10s)), or to limit the network speed at any given time (e.g. 100 kbps)?

@Xuanwo
Copy link
Member Author

Xuanwo commented May 29, 2023

Thanks for your interest!

to limit the network speed at any given time (e.g. 100 kbps)?

This issue want to address this so that users can limit the bandwidth to 100Mbps and so on.

@morristai
Copy link
Member

So I just did a quick survey of existing Rust crates. There are different kinds of bandwidth limit algorithms, the most common one being "Token Bucket", and another being "Leaky Bucket".

Both seem to support asynchronous. Do we have any existing preferences?

@Xuanwo
Copy link
Member Author

Xuanwo commented May 30, 2023

Thanks a lot for the research!

governor LGTM!

@morristai
Copy link
Member

Thanks a lot for the research!

governor LGTM!

Sounds good. The governor supports two types of limiters: "direct" and "keyed".

  • Direct rate limiters maintain a single state, such as the rate of outgoing email conversations.
  • Keyed rate limiters, on the other hand, maintain a separate rate limiting state for each key. For example, they can be used to regulate the flow of API requests made by each customer.

Currently, I am unsure how to implement the Keyed Limiter as it requires interaction with the throttle layer state after building the Operator. Should I first try implementing the Direct Limiter, as all operations under an operator share an Atomic Limiter?

@Xuanwo
Copy link
Member Author

Xuanwo commented Jun 6, 2023

Should I first try implementing the Direct Limiter, as all operations under an operator share an Atomic Limiter?

LGTM! And we don't need to implement keyed support until we have user's feature request.

@Xuanwo
Copy link
Member Author

Xuanwo commented Jul 25, 2023

Mostly DONE! Thanks @morristai, we can polish this layer when new feature requested.

@Xuanwo Xuanwo closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants