-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use pyramid-beaker to cache acl permissions for a specific service and user name #218
Conversation
Codecov Report
@@ Coverage Diff @@
## master #218 +/- ##
==========================================
- Coverage 71.38% 70.67% -0.72%
==========================================
Files 95 96 +1
Lines 6912 6993 +81
==========================================
+ Hits 4934 4942 +8
- Misses 1978 2051 +73
Continue to review full report at Codecov.
|
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.
@davidcaron
I have tried testing with similar operations.
We need to add config.include("pyramid_beaker")
in the adapter's __init__
since Magpie is not added completely on Twitcher's side.
Also, we need to add the config in Twitcher's ini to make them work in the gateway.
I would also add a warning note about caching timeout as it can make unexpected behaviours quite easily if set too high.
Does twitcher need to know about beaker? I wouldn't think so, as it's not a required dependency.
I set it up so that no caching is done by default... where should the warning be? In the configuration file or in the docs? |
What I mean is that the config specified in |
I think it must be disabled by default, and a comment directly in the ini file should state quite clearly that this can cause differences in responses if the cache timeout is too high. For example, deleting route access permission will not be immediately effective if the timeout hasn't been reached. This could be very undesirable. Actually, we should probably enforce a cache invalidation on any POST/PUT/DELETE request that modifies any kind of permission to avoid this. |
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.
consider adding cache invalidation on updated permission requests
Yes, it is disabled by default.
I'll look into it. I'll also add some more documentation. I know that this caching can lead to confusing outcomes when done incorrectly. |
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.
Excellent!
…id ide complaining
96b68fb
to
98be61a
Compare
I only tested this with the
ServiceAPI
service type.Basically, the permissions are cached for a specific service and user. When there are a lot of concurrent requests, adding a cache with a small expiration time of 5 seconds can make a big difference (2-3 times more requests handled per second).
@fmigneault I don't think so, but look if I didn't miss anything regarding permissions that caching could interfere with...