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 traffic limiting capabilities #118

Closed

Conversation

vysotskylev
Copy link

Each access key now corresponds to a TrafficLimiter. has two types of limits:

  • Small-scale limit helps to shape the traffic, i.e. to 1 Mbit/sec per key. TCP connections are not closed when limit is exceeded, instead a goroutine waits according to "leaky bucket" algorithm. UDP packets are dropped when the limit is exceeded.
  • Large-scale limit restricts how much traffic the given key may use in, say, a month. When the limit is exceeded, TCP connections are closed and UDP packets are dropped.

@vysotskylev vysotskylev requested a review from a team as a code owner April 13, 2022 15:42
@google-cla
Copy link

google-cla bot commented Apr 13, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@bemasc
Copy link

bemasc commented Apr 13, 2022

Hi @vysotskylev. Could you explain more about the use case here? As you may know, Outline already supports a rolling 30-day traffic limit. Limiting the instantaneous bandwidth is unlikely to be necessary, as congestion control and flow control ensure reasonably fair division of available bandwidth when the server is under load.

@vysotskylev
Copy link
Author

@bemasc Yes, I think, the large-scale limits are redundant. But we find the instantaneous limits very useful in our services (with many keys and connections on a single node), as the "built-in" flow control is far from perfect. Moreover, it seems to fail in case of UDP service (AFAIK). So I've created another PR with just instantaneous rate limits: #119.

This one can be closed.

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.

2 participants