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

[Feature Request] Actions after upload limit trigger #645

Open
4 tasks done
Gaojianli opened this issue Oct 28, 2024 · 1 comment
Open
4 tasks done

[Feature Request] Actions after upload limit trigger #645

Gaojianli opened this issue Oct 28, 2024 · 1 comment
Labels
backend This is a backend bug enhancement 功能增强

Comments

@Gaojianli
Copy link
Member

Gaojianli commented Oct 28, 2024

问题描述 - Issue Description

Feature Request: Implement a functionality to throttle the downloader when daily upload traffic reaches the limit

额外信息 - Addition Information

F.1 Use a Sliding Window to Monitor Upload Traffic with Configurable Window Size and Upload Limit

Implement a sliding window approach to track upload traffic, allowing for configurable window size and upload limit. This prevents hitting the daily limit too early during peak periods and getting blocked from uploading for the rest of the day.

Example: For an upload limit of 10GB and a window size of 24 hours, the timeline would look like this:

  • +0h: No limit, 2GB uploaded
  • +1h: No limit, 8GB uploaded
  • +2h: Upload throttled
  • +24h: Upload throttled
  • +25h: No limit, 2.5GB uploaded
  • +26h: Throttled
  • +27h: No limit, 7.5GB uploaded
  • +28h: Throttled

The behavior after +26h is identical.

F.2 Throttle Strategy

Adopt an AIMD strategy for throttling and unthrottling with four parameters:

  • $l$ -threshold
  • $s_{min}$ - minium speed
  • $s_{max}$ - maximum speed
  • $a$ - increase factor
  • $b$ - decrease factor

Throttle Strategy: For each monitoring period, if the upload reaches the threshold, the current speed is set as follows:

$$ s = \begin{cases} s_{min},\quad s \leq s_{min} \\ \frac{s}{b},\quad s> s_{min} \end{cases} $$

Unthrottle Strategy: Once the upload does not reach the threshold, the current speed is set as follows:

$$ s = \begin{cases} s_{max},\quad s >= s_{max} \\ s+a,\quad s< s_{max} \end{cases} $$

As you can see, the factor $a$ and $b$ can be calculated based on the time window and speed limit:

$$ a = \frac{l-l_{current}}{w} $$ $$ b = \frac{l_{current}}{l} $$

* $l_{current}$ is the cumulative value within the current window,

检查清单 - Check list

  • 这不是一个错误 (BUG) (This is not an bug/error)
  • PeerBanHelper 已更新到最新版本,非最新版本不接受任何错误反馈,任何非最新版本的 Issue 将被 立 刻 关 闭,不会有人给您提供任何支持 (I'm running the latest version of PBH that can be found in Github Relases, non-latest release won't receive any support)
  • 我已检查过 PBH 文档(特别是常见问题),且即使使用了搜索也没有找到与此有关的内容 (This not a question/or the question that not listed in README's FAQ or PBH WIKI)
  • 我同意遵守 PBH-BTN 包容性条约,不发布 “嘲讽、骂战、引战、开盒(有时也称为人肉搜索)、人身攻击、仇恨、暴力、侮辱性言辞、违法违规、黑灰产、危害国家安全、实施或帮助他人实施电信犯罪” 等内容。并已知晓如果仍旧发布了这些内容,我的账号将立刻从包括但不限于 PBH-BTN 组织、社交软件中封禁。所有主题、内容都将被立刻删除或折叠,撤销、删除和收回您所做出的一切贡献,并封禁 BTN 网络的中账号权限、排除您所提交的所有数据。在您违反相关规则时,PBH-BTN 将会将您的注册、登录、和最近访问的 IP 地址、电子邮件地址、以及其它可能追踪您或将您去匿名化的信息从定期删除转为永不删除,并在任何国家或地区的政府、公安机关或有关部门需要时无通知的提供这些数据。 (I agree to abide by the PBH-BTN Inclusivity Pact by not posting content such as “taunting, name-calling, war-mongering, open-boxing (sometimes referred to as mansplaining), personal attacks, hatred, violence, insulting language, illegal activities, black and grey business, endangering national security, and committing or assisting others in committing telecommunication crimes”. I am aware that if I continue to post such content, my account will be immediately banned from organizations including but not limited to PBH-BTN, social software. All topics and content will be immediately deleted or collapsed, all contributions will be revoked, deleted and retracted, and you will be banned from the BTN network and all data you have submitted will be excluded. In the event of a violation of these rules, PBH-BTN will delete your registration, login, and most recent IP address, email address, and any other information that may be used to track you or de-anonymize you from regular to permanent deletion, and will make this data available to the government, public security, or other relevant authorities without notice if they request it, no matter what country or region.)
@Ghost-chu
Copy link
Collaborator

线性代数挂科还没修呢,数学题饶了我吧

@Ghost-chu Ghost-chu added the enhancement 功能增强 label Nov 3, 2024
@Ghost-chu Ghost-chu added the backend This is a backend bug label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend This is a backend bug enhancement 功能增强
Projects
None yet
Development

No branches or pull requests

2 participants