firezone icon indicating copy to clipboard operation
firezone copied to clipboard

relay: rate limiting

Open thomaseizinger opened this issue 2 years ago • 6 comments

I am guessing we will eventually want to rate limit how much bandwidth a user can use. I am writing this issue so we don't forget about it.

Any ideas on how that rate limiting should work? Same limits for every user? Fair-use policy / day? Do we need ad-hoc limiting from the portal? Do we want to limit just bandwidth or also maximum traffic i.e. speed vs data cap.

thomaseizinger avatar May 24 '23 14:05 thomaseizinger

Yes, absolutely. Eventually we plan to rate limit based on which tier a client's account belongs to from Enterprise to Free.

Thinking through this feature a bit more, we could add a bandwidth_tier enum to the username for the long-term credential. This would be provided by the portal and used to inform the Relay which bandwidth tier the user's account belongs to.

I don't think we need this at 1.0 launch -- at launch we could apply static tc rules to our managed Relays.

jamilbk avatar May 24 '23 15:05 jamilbk

After 1.0 launch we could ship this and self-hosted Relays in the next launch

jamilbk avatar May 24 '23 15:05 jamilbk

I don't think we need this at 1.0 launch -- at launch we could apply static tc rules to our managed Relays.

@jamilbk In the epic you tagged this as 1.0. Do we want to include this then?

thomaseizinger avatar Jun 14 '23 19:06 thomaseizinger

I don't think we need this at 1.0 launch -- at launch we could apply static tc rules to our managed Relays.

@jamilbk In the epic you tagged this as 1.0. Do we want to include this then?

Good catch, fixed.

jamilbk avatar Jun 15 '23 16:06 jamilbk

Blocked on #2044 Blocked on #3353

Todo

  • [ ] Create separate Relay tiers depending on plan
  • [ ] Refactor STUN-only codepaths in portal to instead select appropriate relays
  • [ ] Create fair bandwidth policy with tc on both tiers of Relays, and test bandwidth sharing

jamilbk avatar Jan 31 '24 00:01 jamilbk

Some quick research suggests that it is possible using tc to dynamically limit the bandwidth a single IP can consume. This would allow us to still deploy the relay's to bigger machines but limit, how much traffic a single IP (i.e. user) can use.

thomaseizinger avatar Jan 31 '24 01:01 thomaseizinger

I think the consensus here so far is to have "colored" relays that are sent to clients depending on the account tier they're in. Can save for a bit later.

jamilbk avatar Mar 18 '24 16:03 jamilbk