Skip to content

rate limit: add local rate limit network filter#9354

Merged
mattklein123 merged 20 commits intomasterfrom
local_rate_limit
Dec 30, 2019
Merged

rate limit: add local rate limit network filter#9354
mattklein123 merged 20 commits intomasterfrom
local_rate_limit

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.

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
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
Signed-off-by: Matt Klein <mklein@lyft.com>
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.

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.

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

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.

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.

9 participants