More ACL checks from cache

Hello.
Here is patch that cut number of the queries we run on the DB by using
cache more aggressivly.
It’s against 3.4.5

Best regards, Ruslan.

speedup_acl_checks.patch (4.82 KB)

Hello.
Here is patch that cut number of the queries we run on the DB by using
cache more aggressivly.

Any basic stats on how effective this is? I think I’m most comfortable
starting with this in 3.7, since 3.6 is so close to going out the door.

I know it’s pedantic, but can this get turned into something that reads
a little easier to someone poking at the code?

(also $big_hashkey doesn’t tell me what it’s for, just that it’s large
:wink:

Hello.
Here is patch that cut number of the queries we run on the DB by using
cache more aggressivly.

Any basic stats on how effective this is? I think I’m most comfortable
When you have SuperUser right on the system you need only one request to the DB.
It works pretty simple. If you have right ShowTicket on the Queue then
we put into cache record ‘your_id,ShowTicket,Queue-XXX’. Then when we
check the right on any ticket from the Queue its object is one of the
equivalence objects for ticket and we fetch this info from cache.
This trick doesn’t work for role-checks because of inability to get
real object you have right on.

starting with this in 3.7, since 3.6 is so close to going out the door.
Heh, I don’t mind if this prove concept and usefulness then I’m happy
to apply to any branch.

I know it’s pedantic, but can this get turned into something that reads
a little easier to someone poking at the code?
This is one the most commented code, but anyway took several tries to
understand whole piture.

(also $big_hashkey doesn’t tell me what it’s for, just that it’s large
:wink:
bundle_hashkey? I don’t know how to call it, it’s really big hashkey
that contains references to all equiv objects.

  • $_ACL_CACHE->set( $big_hashkey => $hitcount? 1:-1 );

It’s against 3.4.5


Best regards, Ruslan.

[snip]
Best regards, Ruslan.

Any basic stats on how effective this is? I think I’m most comfortable
When you have SuperUser right on the system you need only one request to the DB.
It works pretty simple. If you have right ShowTicket on the Queue then
we put into cache record ‘your_id,ShowTicket,Queue-XXX’. Then when we
check the right on any ticket from the Queue its object is one of the
equivalence objects for ticket and we fetch this info from cache.
This trick doesn’t work for role-checks because of inability to get
real object you have right on.

Ok. It’s probably worht adding that description as a comment in that
code.

starting with this in 3.7, since 3.6 is so close to going out the door.
Heh, I don’t mind if this prove concept and usefulness then I’m happy
to apply to any branch.

Indeed it does. 3.7 gives me the most comfort.

I know it’s pedantic, but can this get turned into something that reads
a little easier to someone poking at the code?
This is one the most commented code, but anyway took several tries to
understand whole piture.

nod

(also $big_hashkey doesn’t tell me what it’s for, just that it’s large
:wink:
bundle_hashkey? I don’t know how to call it, it’s really big hashkey
that contains references to all equiv objects.

$user_object_and_right ?

  • $_ACL_CACHE->set( $big_hashkey => $hitcount? 1:-1 );

So it would end up as: (the extra paren makes it a little more readable
to me.

$_ACL_CACHE->set( $user_object_and_right => ($hitcount? 1:-1) );