-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ce9d4b
commit 5d10b16
Showing
3 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ Package information | |
|
||
usage | ||
installation | ||
performance | ||
contributing | ||
authors | ||
history | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
=========== | ||
Performance | ||
=========== | ||
|
||
Requesting permissions for a specific user and service can be demanding if a lot of | ||
requests are done rapidly. PostgreSQL and sqlalchemy are usually fast enough, but | ||
when more than a couple requests per second are needed, some solutions are possible to | ||
improve the performance of these requests. | ||
|
||
We can take advantage of the fact that permission are not susceptible to change often | ||
and cache the results of these permission queries. | ||
|
||
While not activated by default, it's possible to cache the access control lists (ACLs) | ||
for all services, and give it an expiration timeout:: | ||
|
||
# example Paste Deploy configuration | ||
cache.regions = adapter | ||
cache.type = memory | ||
cache.adapter.expire = 5 # seconds | ||
|
||
For a particular request that queries a user's ACL | ||
for a specific service, the response will be cached for 5 seconds. The consequence of this | ||
caching is that any permission change will take 5 seconds to be effective. Depending on the | ||
use case, this can be perfectly acceptable and the performance improvement is not negligible. | ||
You should test and profile for your particular environment. |