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

[router][server] ACL optimization #1521

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

gaojieliu
Copy link
Contributor

@gaojieliu gaojieliu commented Feb 11, 2025

High-level idea:

  1. For a keep-alive connection, the client cert will never change, so for the same store, it is useless to validate each request on the same connection.
  2. In Server, there is an Acl Handler called ServerAclHandler, which is used to validate whether the connection is from Venice Router or not via static ACL. For each connection, Server will buffer the ACL check result in this attribute key: SERVER_ACL_APPROVED_ATTRIBUTE_KEY. And the ACL check result won't change during the lifetime of the Server instance.
  3. In both Router and Server, there is a store-level ACL check, which can change during the lifetime of the Router/Server (ACL added/removed). The caching idea is a little different from 2), and it will maintain a cache map in the original connection, and for all the requests coming from this particular connection, it will check the acl check cache map first, and it will follow the previous result if the cache entry is not expired. If there is no such entry or the cache entry is expired, it will resort to the underlying access control to update the cache map. In theory, the acl check against the access controller will be minimized a lot.

New config:
acl.in.memory.cache.ttl.ms: -1 (by default)

If the ttl config value is <= 0, the store-level acl caching will be disabled.

How was this PR tested?

CI

Does this PR introduce any user-facing changes?

  • No. You can skip the rest of this section.
  • Yes. Make sure to explain your proposed changes and call out the behavior change.

High-level idea:
1. For a keep-alive connection, the client cert will never change,
   so for the same store, it is useless to validate each request
   on the same connection.
2. In Server, there is an Acl Handler called `ServerAclHandler`, which
   is used to validate whether the connection is from Venice Router or
   not via static ACL. For each connection, Server will buffer the ACL
   check result in this attribute key: `SERVER_ACL_APPROVED_ATTRIBUTE_KEY`.
   And the ACL check result won't change during the lifetime of the Server
   instance.
3. In both Router and Server, there is a store-level ACL check, which
   can change during the lifetime of the Router/Server (ACL added/removed).
   The caching idea is a little different from linkedin#2, and it will maintain
   a cache map in the original connection, and for all the requests coming
   from this particular connection, it will check the acl check cache map first,
   and it will follow the previous result if the cache entry is not expired.
   If there is no such entry or the cache entry is expired, it will resort
   to the underlying access control to update the cache map.
In theory, the acl check against the access controller will be minimized
a lot.

New config:
acl.in.memory.cache.ttl.ms: 60000 (by default)
Copy link
Contributor

@FelixGV FelixGV left a comment

Choose a reason for hiding this comment

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

Thanks, this will be valuable. I left some comments which should hopefully be minor and easy to address...

Copy link
Contributor

@FelixGV FelixGV left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@gaojieliu gaojieliu merged commit b68eb16 into linkedin:main Feb 12, 2025
58 checks passed
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