-
Notifications
You must be signed in to change notification settings - Fork 31
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
Metadata caching #239
Metadata caching #239
Conversation
A couple things with allegro/bigcache that I'm not very happy with:
The above does not happen when using coocood/freecache. |
027288f
to
65bb618
Compare
97a68a2
to
c9fdb53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a few suggestion but the code looks good, great work @guicassolato
@@ -97,6 +100,7 @@ var ( | |||
oidcHTTPPort = fetchEnv(envOIDCHTTPPort, defaultOIDCHTTPPort) | |||
oidcTLSCertPath = fetchEnv(envOIDCTLSCertPath, defaultOIDCTLSCertPath) | |||
oidcTLSCertKeyPath = fetchEnv(envOIDCTLSCertKeyPath, defaultOIDCTLSCertKeyPath) | |||
metadataCacheSize = fetchEnv(envMetadataCacheSize, defaultMetadataCacheSize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be configured via the authorino operator?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need to open an issue for that. However, let's make sure it's for the EVALUATOR_CACHE_SIZE
env var from #247, instead of this one.
func (c *jsonCache) Set(key, value interface{}) error { | ||
if valueAsBytes, err := gojson.Marshal(value); err != nil { | ||
return err | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, do we need the else statement?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one we actually do need... or valueAsBytes
needs to be declared in the scope.
- Based on github.com/allegro/bigcache - Uses github.com/eko/gocache as adapter
…y from StaticOrDynamicValue
c9fdb53
to
8013370
Compare
Adds caching options for external metadata.
allegro/bigcachecoocood/freecacheCache size per metadata config can be set at the level of the Authorino instance, by injecting the environment variable
METADATA_CACHE_SIZE
(in megabytes).Verification steps
Build and deploy based on this branch:
make local-setup kubectl -n authorino port-forward deployment/envoy 8000:8000 &
Apply the AuthConfig:
Send requests:
/hello
/hello
again before the cache entry expires (60 seconds from the first request sent to this path)/hello
again after the cache entry expires (60 seconds from the first request sent to this path)Closes #21