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

rate limit: add local rate limit network filter #9354

Merged
merged 20 commits into from
Dec 30, 2019
Merged

Conversation

mattklein123
Copy link
Member

Allows local rate limit via a token bucket.

Risk Level: None, new feature
Testing: Integration/UT
Docs Changes: Added
Release Notes: Added

Allows local rate limit via a token bucket.

Signed-off-by: Matt Klein <mklein@lyft.com>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #9354 was opened by mattklein123.

see: more, trace.

CODEOWNERS Outdated Show resolved Hide resolved
Signed-off-by: Matt Klein <mklein@lyft.com>
@tonya11en
Copy link
Member

tonya11en commented Dec 15, 2019 via email

Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

You wouldn't underflow because the only place you'd decrement is in the
refill handler. Otherwise, the counter only increases, so you can safely
subtract whatever you observed in the refill handler.

Yes I suppose you could refill up to what you observe having been used, though it would be very easy to miss a fill window this way. In any case, I updated to a full CAS implementation which does not have this issue.

@mattklein123
Copy link
Member Author

Assigning over to @junr03 and @tonya11en for review. @alyssawilk if you feel like taking a look also that would be great but not required if you don't have time. :)

Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Looks great overall!

Copy link
Member

@junr03 junr03 left a comment

Choose a reason for hiding this comment

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

I am glad @tonya11en and you went for the CAS loop solution, it is pretty nice. Just a few comments and an ask in the testing code.

Signed-off-by: Matt Klein <mklein@lyft.com>
@alyssawilk alyssawilk removed their assignment Dec 19, 2019
Matt Klein added 4 commits December 19, 2019 09:31
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
fix
Signed-off-by: Matt Klein <mklein@lyft.com>
@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/.

🐱

Caused by: #9354 was synchronize by mattklein123.

see: more, trace.

@mattklein123
Copy link
Member Author

All comments addressed other than additional test comments which I am working on.

Matt Klein added 2 commits December 19, 2019 13:09
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@tonya11en @junr03 @alyssawilk updated to cover the remaining comments. PTAL.

@mattklein123
Copy link
Member Author

Note also that I think I have a cleaner way of doing the thread synchronizer stuff so going to update that also.

Matt Klein added 3 commits December 20, 2019 11:33
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

@htuch updated per comments.

@jmarantz PTAL at the new thread synchronizer. I think this version is much better.

Signed-off-by: Matt Klein <mklein@lyft.com>
@htuch
Copy link
Member

htuch commented Dec 23, 2019

/lgtm api

Matt Klein added 3 commits December 23, 2019 14:25
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
jmarantz
jmarantz previously approved these changes Dec 27, 2019
Copy link
Contributor

@jmarantz jmarantz left a comment

Choose a reason for hiding this comment

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

Looks great; left a few minor comments; feel free to apply in a follow-up if you agree.

source/common/common/thread_synchronizer.h Outdated Show resolved Hide resolved
source/common/common/thread_synchronizer.cc Outdated Show resolved Hide resolved
source/common/common/thread_synchronizer.h Outdated Show resolved Hide resolved
source/common/common/thread_synchronizer.h Show resolved Hide resolved
Matt Klein added 2 commits December 29, 2019 11:25
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
@mattklein123
Copy link
Member Author

/retest

@repokitteh-read-only
Copy link

🔨 rebuilding ci/circleci: api (failed build)

🐱

Caused by: a #9354 (comment) was created by @mattklein123.

see: more, trace.

@mattklein123
Copy link
Member Author

@htuch @jmarantz this contains format fix for master as well as updated per @jmarantz comments. Can I get a stamp on this?

@mattklein123 mattklein123 merged commit 9b3915d into master Dec 30, 2019
@mattklein123 mattklein123 deleted the local_rate_limit branch December 30, 2019 02:28
prakhag1 pushed a commit to prakhag1/envoy that referenced this pull request Jan 3, 2020
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Prakhar <prakhar_au@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants