Repository navigation
[improve] Prefetch role tokens in the background in the Athenz auth plugin - #1355
Merged
Merged
Conversation
nodece
approved these changes
Apr 22, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
We use Athenz for authentication between clients and brokers.
When a broker is restarted or a topic is unloaded, connected Pulsar Go clients can send a large number of requests to the Athenz ZTS server at the same time, causing the ZTS server to become overloaded.
The Athenz library used by the authentication plugin caches obtained role tokens for at least two hours to reduce requests to ZTS. However, this cache is only updated when a reconnection occurs between the client and the brokerand is never updated in the background. Therefore, if a broker that has a large number of clients connected for a long time is shut down, all of those clients will simultaneously send requests to ZTS to refresh their role token caches, which have already expired.
Modifications
Newer versions of the Athenz library support the feature to periodically fetch role tokens in the background, so I will upgrade the Athenz library and enable this feature.
AthenZ/athenz#2892
This way, each client's cache is constantly refreshed and does not expire, avoiding a flood of requests to ZTS in response to broker restarting or topic unloading.
Verifying this change
Does this pull request potentially affect one of the following parts:
Documentation