This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 137
Optimize authorization by caching authorization results #1999
Merged
BewareMyPower
merged 6 commits into
streamnative:master
from
BewareMyPower:bewaremypower/authz-optimization
Aug 27, 2023
Merged
Optimize authorization by caching authorization results #1999
BewareMyPower
merged 6 commits into
streamnative:master
from
BewareMyPower:bewaremypower/authz-optimization
Aug 27, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Motivation To follow Kafka's behavior, KoP also performs authorization for each PRODUCE or FETCH request. If the custom authorization provider is slow to authorize produce or consume permissions, the performance will be impacted. ### Modifications Introduce caches for authorization: - PRODUCE: (topic, role) -> result - FETCH: (topic, role, group) -> result; Add `SlowAuthorizationTest` to verify the producer and consumer won't be affected significantly by slow authorization.
BewareMyPower
added
the
type/enhancement
Indicates an improvement to an existing feature
label
Aug 23, 2023
Codecov Report
@@ Coverage Diff @@
## master #1999 +/- ##
============================================
+ Coverage 17.03% 17.06% +0.03%
- Complexity 727 731 +4
============================================
Files 191 191
Lines 14251 14277 +26
Branches 1337 1340 +3
============================================
+ Hits 2428 2437 +9
- Misses 11646 11663 +17
Partials 177 177
|
...mpl/src/main/java/io/streamnative/pulsar/handlers/kop/security/auth/SimpleAclAuthorizer.java
Outdated
Show resolved
Hide resolved
...mpl/src/main/java/io/streamnative/pulsar/handlers/kop/security/auth/SimpleAclAuthorizer.java
Outdated
Show resolved
Hide resolved
...mpl/src/main/java/io/streamnative/pulsar/handlers/kop/security/auth/SimpleAclAuthorizer.java
Outdated
Show resolved
Hide resolved
@Demogorgon314 Done. |
Demogorgon314
approved these changes
Aug 27, 2023
Demogorgon314
pushed a commit
to Demogorgon314/kop
that referenced
this pull request
Oct 30, 2023
…#1999) (streamnative#127) ### Motivation To follow Kafka's behavior, KoP also performs authorization for each PRODUCE or FETCH request. If the custom authorization provider is slow to authorize produce or consume permissions, the performance will be impacted. ### Modifications Introduce caches for authorization: - PRODUCE: (topic, role) -> result - FETCH: (topic, role, group) -> result; Add `SlowAuthorizationTest` to verify the producer and consumer won't be affected significantly by slow authorization. Introduce two configs to configure the cache policy so that revoke permission can work: - kopAuthorizationCacheRefreshMs: the refresh timeout - kopAuthorizationCacheMaxCountPerConnection: the max cache size (cherry picked from commit 9ab8411)
Demogorgon314
pushed a commit
to Demogorgon314/kop
that referenced
this pull request
Nov 28, 2023
…#1999) ### Motivation To follow Kafka's behavior, KoP also performs authorization for each PRODUCE or FETCH request. If the custom authorization provider is slow to authorize produce or consume permissions, the performance will be impacted. ### Modifications Introduce caches for authorization: - PRODUCE: (topic, role) -> result - FETCH: (topic, role, group) -> result; Add `SlowAuthorizationTest` to verify the producer and consumer won't be affected significantly by slow authorization. Introduce two configs to configure the cache policy so that revoke permission can work: - kopAuthorizationCacheRefreshMs: the refresh timeout - kopAuthorizationCacheMaxCountPerConnection: the max cache size (cherry picked from commit 9ab8411)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
no-need-doc
This pr does not need any document
type/enhancement
Indicates an improvement to an existing feature
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
To follow Kafka's behavior, KoP also performs authorization for each PRODUCE or FETCH request. If the custom authorization provider is slow to authorize produce or consume permissions, the performance will be impacted.
Modifications
Introduce caches for authorization:
Add
SlowAuthorizationTest
to verify the producer and consumer won't be affected significantly by slow authorization.Introduce two configs to configure the cache policy so that revoke permission can work:
Documentation
Check the box below.
Need to update docs?
doc-required
(If you need help on updating docs, create a doc issue)
no-need-doc
(Please explain why)
doc
(If this PR contains doc changes)