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

relay api key #805

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

brianolson
Copy link
Contributor

in case we need to play favorites to keep the system up, allow API keys with multiple tiers of priority and the ability to shed lower levels

@@ -87,6 +88,10 @@ type BGS struct {

// Management of Compaction
compactor *Compactor

apiKeys atomic.Pointer[ApiKeys]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason we use this instead of a lock?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't use these atomic semantics anywhere else and I'm a bit wary of throwing them in here now over using a standard mutex pattern.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideally atomics are faster; there are a few large system NUMA cases where they are less good than usual, but I'm not sure they're ever slower than sync.Mutex ? I think in the optimistic case where there is no contention they're much faster.
They don't provide fairness of unlock to multiple lockers like sync.Mutex, but that doesn't matter here.

@brianolson
Copy link
Contributor Author

The good news is that I can demonstrate that it works. With no setup, works as present, no api key needed. With api key set uploaded, can set threshold priority up and down and allow/disallow various api keys (or unkeyed access).

The messy news is that it is currently stateless and I should do more work to add it to the local database. Otherwise the API keys need to be re-uploaded after any reboot.

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