Bug 27343 - Use L1 cache for get_all_subpermissions
Summary: Use L1 cache for get_all_subpermissions
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 27341
  Show dependency treegraph
 
Reported: 2021-01-05 13:51 UTC by Jonathan Druart
Modified: 2021-12-13 21:10 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 27343: Cache get_all_subpermissions return (1.67 KB, patch)
2021-01-05 14:20 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-01-05 13:51:54 UTC
The permissions are fetched for every hit, we should cache them in L1.
Comment 1 Jonathan Druart 2021-01-05 14:20:05 UTC
Created attachment 114876 [details] [review]
Bug 27343: Cache get_all_subpermissions return

The permissions are fetched for every hit, we should cache them in L1.
Comment 2 David Cook 2021-01-05 22:38:46 UTC
What do you mean by every hit? 

It seems to me that it's basically called for every request, but we clear the L1 cache for every request anyway, so I'm not sure this patch would change anything?
Comment 3 Jonathan Druart 2021-01-06 09:15:38 UTC
Hum, looks like I was so frustrated to not find something significant in get_template_and_user that I invented problems.

Yes, it's plain silly to use L1 in this situation. And L2 won't help much...
Comment 4 David Cook 2021-01-07 00:07:08 UTC
(In reply to Jonathan Druart from comment #3)
> Hum, looks like I was so frustrated to not find something significant in
> get_template_and_user that I invented problems.
> 
> Yes, it's plain silly to use L1 in this situation. And L2 won't help much...

I do dislike get_template_and_user... heh.

What about the block for "LoadSearchHistoryToTheFirstLoggedUser"? It looks like that could generate way more database calls than should be necessary, although I doubt that would show up in the benchmarking...

Actually, going back to permissions, I have been thinking about whether we should calculate permissions for each request, or if we should calculate permissions at login time. I think that AWS calculates at least some permissions at login time, which would be more performant, although the annoying thing is that sometimes you have to logout and login again to gain newly assigned permissions.