[Rt-commit] rt branch, 4.4/acl-probe-sytem-level-cache, created. rt-4.4.2-65-gc152c2dcb
? sunnavy
sunnavy at bestpractical.com
Tue Jan 23 12:52:32 EST 2018
The branch, 4.4/acl-probe-sytem-level-cache has been created
at c152c2dcb0c41d3b0d65f18daafda1d2db76ba6e (commit)
- Log -----------------------------------------------------------------
commit c152c2dcb0c41d3b0d65f18daafda1d2db76ba6e
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Jan 23 23:46:09 2018 +0800
probe system level cache to speed up right check procedure
especially for web pages, where we already precache system level rights
(see the HasRights call in RT::Interface::Web::ShowRequestedPage)
the speedup could be quite a lot. in my case, the test system has 3k+
queues, 3k+ scrips and about 100k object scrips. with super user "root",
I got about 90x faster page load on a queue's scrip admin page.
(tech note: RT checks "ShowScrip" right on each record when looping
through scrips. since a scrip's acl equivalence objects contain all the
queues it applies to, the ACLEquivalenceObjects call is quite expensive
in my case, and this commit short-circuits it.)
diff --git a/lib/RT/Principal.pm b/lib/RT/Principal.pm
index 86d600f41..74faa81ed 100644
--- a/lib/RT/Principal.pm
+++ b/lib/RT/Principal.pm
@@ -327,6 +327,16 @@ sub HasRight {
};
return $cached->{'SuperUser'} || $cached->{ $args{'Right'} }
if $cached;
+
+ if ( ref $args{Object} ne 'RT::System' ) {
+ my $cached =
+ $_ACL_CACHE->{ $self->id . ';:;'
+ . 'RT::System' . '-'
+ . $RT::System->id };
+ return 1
+ if $cached
+ && ( $cached->{'SuperUser'} || $cached->{ $args{'Right'} } );
+ }
}
unshift @{ $args{'EquivObjects'} },
-----------------------------------------------------------------------
More information about the rt-commit
mailing list