Skip to content

proxyd: Custom rate limiter implementation#3679

Merged
mslipper merged 1 commit intodevelopfrom
10-09-proxyd_Custom_rate_limiter_implementation
Oct 12, 2022
Merged

proxyd: Custom rate limiter implementation#3679
mslipper merged 1 commit intodevelopfrom
10-09-proxyd_Custom_rate_limiter_implementation

Conversation

@mslipper
Copy link
Contributor

@mslipper mslipper commented Oct 9, 2022

Our current proxyd deployment does not share rate limit state across multiple servers within a backend group. This means that rate limits on the public endpoint are artifically high.

This PR adds a Redis-based rate limiter to fix this problem. While our current rate limiting library (github.com/sethvargo/go-limiter) does support Redis, the client library it uses is not type safe, is less performant, and would require us to update the other places we use Redis. To avoid these issues, I created a simple rate limiting interface with both Redis and memory backend.

Note that this PR only adds the new implementations - it does not integrate them with the rest of the codebase. I'll do that in a separate PR to make review easier.

@changeset-bot
Copy link

changeset-bot bot commented Oct 9, 2022

⚠️ No Changeset found

Latest commit: c2b8efa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@mslipper
Copy link
Contributor Author

mslipper commented Oct 9, 2022

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@mslipper mslipper requested review from Inphi and tynes October 9, 2022 19:34
@mergify
Copy link
Contributor

mergify bot commented Oct 9, 2022

This PR changes implementation code, but doesn't include a changeset. Did you forget to add one?

@mslipper mslipper force-pushed the 10-09-proxyd_Custom_rate_limiter_implementation branch from ada9def to f711c48 Compare October 9, 2022 20:32
@mslipper mslipper requested a review from zhwrd October 9, 2022 22:32
Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have some comments to improve the implementation. But they aren't blockers.

Our current proxyd deployment does not share rate limit state across multiple servers within a backend group. This means that rate limits on the public endpoint are artifically high.

This PR adds a Redis-based rate limiter to fix this problem. While our current rate limiting library (github.com/sethvargo/go-limiter) _does_ support Redis, the client library it uses is not type safe, is less performant, and would require us to update the other places we use Redis. To avoid these issues, I created a simple rate limiting interface with both Redis and memory backend.

Note that this PR only adds the new implementations - it does not integrate them with the rest of the codebase. I'll do that in a separate PR to make review easier.
@mslipper mslipper force-pushed the 10-09-proxyd_Custom_rate_limiter_implementation branch from f711c48 to c2b8efa Compare October 11, 2022 22:20
@mslipper mslipper merged commit ce03351 into develop Oct 12, 2022
@mslipper mslipper deleted the 10-09-proxyd_Custom_rate_limiter_implementation branch October 12, 2022 20:34
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