Skip to content

Re-introduce new "demand-based" bandwidth limiting - #43

Draft
jacquesh wants to merge 1 commit into
bloomberg:mainfrom
jacquesh:reintroduce-demand-based-bwlim
Draft

Re-introduce new "demand-based" bandwidth limiting#43
jacquesh wants to merge 1 commit into
bloomberg:mainfrom
jacquesh:reintroduce-demand-based-bwlim

Conversation

@jacquesh

@jacquesh jacquesh commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

Description

This was previously introduced internally but was stripped out as we ran into a strange issue during deployment and did not have the capacity to investigate it at the time. This commit re-introduces it, although some of the required functionality was already present and simply not used, so as to ease the process of re-introducing it.

As a high-level overview, the existing/older form of bandwidth limiting is fully reactive: it does nothing until a given user is detected to have exceeded their transfer limit for a given second, and then prevents them from transferring anything at all for the rest of that second (and some time into the next second to compensate for exceeding the limit).
By contrast the newer form of bandwidth limiting is somewhat proactive: we instead enforce an ongoing rate limit locally for each user in each HAProxy instance (using the same logic as the built-in bwlim filter). This locally-enforced limit starts out at some default but is updated regularly by polygen based on the number of concurrent transfers being processed for a particular user across the cluster at a time.

I'm creating this as a draft PR just so that we have it here and it's easy to find when we get around to trying to get this back in again (although I'm sure it will require another rebase at that time). Another reason I put this up now is that I suspect that #42 fixes the issue that we ran into last time we enabled it (but didn't have the time to investigate then). I do not expect this to get any significant review or be merged imminently.

Type of Change

  • Bugfix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • New code contribution is covered by automated tests

This was previously introduced internally but was stripped out as we ran into a strange issue during
deployment and did not have the capacity to investigate it at the time.
This commit re-introduces it, although some of the required functionality was already present and simply
not used, so as to ease the process of re-introducing it.

As a high-level overview, the existing/older form of bandwidth limiting is fully reactive: it does nothing
until a given user is detected to have exceeded their transfer limit for a given second, and then prevents
them from transferring anything at all for the rest of that second (and some time into the next second
to compensate for exceeding the limit).
By contrast the newer form of bandwidth limiting is somewhat proactive: we instead enforce an ongoing rate
limit locally for each user in each HAProxy instance (using the same logic as the built-in bwlim filter).
This locally-enforced limit starts out at some default but is updated regularly by polygen based on the
number of concurrent transfers being processed for a particular user across the cluster at a time.
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

Successfully merging this pull request may close these issues.

1 participant