[Bug 36155] New: Improve perfs of suggestion.pl when there are many budgets
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Bug ID: 36155 Summary: Improve perfs of suggestion.pl when there are many budgets Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: fridolin.somers@biblibre.com QA Contact: testopia@bugs.koha-community.org Page suggestion/suggestion.pl always calls GetBudgets() and GetBudgetHierarchy(). But the result are not always used in template. When there are many budgets and funds this takes some time. Also CanUserUseBudget() in a loop should use a unique Koha::Patron object of the logged in user. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=35921 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |fridolin.somers@biblibre.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |7923 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7923 [Bug 7923] Performance omnibus -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=30232 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #1 from Fridolin Somers <fridolin.somers@biblibre.com> --- (In reply to Fridolin Somers from comment #0)
Also CanUserUseBudget() in a loop should use a unique Koha::Patron object of the logged in user. Ah I mean a unblessed Koha::Patron object of logged in user
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #2 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 162364 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162364&action=edit Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl always calls GetBudgets() and GetBudgetHierarchy(). But the result are not always used in template. When there are many budgets and funds this takes some time. Also CanUserUseBudget() in a loop should use a unique Koha::Patron unblessed object of the logged in user. Test plan : 1) Create a user 'P1' with permissions 'catalogue', 'suggestions_manage' and all permissions on acquisition except 'budget_manage_all' 2) Create some funds and subfunds without restricted access 3) Create a fund 'F1' with owner other than 'P1' and restricted access on owner 4) Go to staff interface with patron 'P1' 5) Go to Acquisitions > Suggestions 6) Check you see all founds except F1 in Filter by > Acquisition information 7) Create a new suggestion 8) Check you see all founds except F1 in Fund 9) Select a fund and save 10) Edit this suggestion 11) Check you see all founds except F1 in Fund 12) Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #3 from Fridolin Somers <fridolin.somers@biblibre.com> --- Applyed on a Koha with : 67 aqbudgetperiods 1605 aqbudgets Timings : suggestion.pl?op=add : 14s > 2s suggestion.pl?op=edit : 14s > 2s suggestion.pl?op=show : 20s > 8s Whaouuu :D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162364|0 |1 is obsolete| | --- Comment #4 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 162371 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162371&action=edit Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl always calls GetBudgets() and GetBudgetHierarchy(). But the result are not always used in template. When there are many budgets and funds this takes some time. Also CanUserUseBudget() in a loop should use a unique Koha::Patron unblessed object of the logged in user. Test plan : 1) Create a user 'P1' with permissions 'catalogue', 'suggestions_manage' and all permissions on acquisition except 'budget_manage_all' 2) Create some funds and subfunds without restricted access 3) Create a fund 'F1' with owner other than 'P1' and restricted access on owner 4) Go to staff interface with patron 'P1' 5) Go to Acquisitions > Suggestions 6) Check you see all founds except F1 in Filter by > Acquisition information 7) Create a new suggestion 8) Check you see all founds except F1 in Fund 9) Select a fund and save 10) Edit this suggestion 11) Check you see all founds except F1 in Fund 12) Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=31024 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #5 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- Will need to be rebased on top of 34478 when pushed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com Status|Signed Off |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |34478 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34478 [Bug 34478] Full CSRF protection -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162371|0 |1 is obsolete| | --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- Created attachment 183676 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183676&action=edit Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl calls CanUserUseBudget() in a loop, will must use a uniq Koha::Patron object of the logged in user. When there are many budgets and funds this takes some time. Test plan : Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on|34478 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34478 [Bug 34478] Full CSRF protection -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #7 from Fridolin Somers <fridolin.somers@biblibre.com> --- Code have changed so patch is smaller, only replaces call on patron in loop -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #8 from David Cook <dcook@prosentient.com.au> --- Ah yes... suggestion.pl. The home of "$op eq 'else'". *shudder*. In theory, we should probably only fetch the data for "sugg_budgets" for the ops that need it, but... unpicking suggestion.tt would not be fun and this fix makes a big difference so very practical improvement as is. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #9 from David Cook <dcook@prosentient.com.au> --- My test plan: 1. Create many budgets (see bug 35921) perl -MKoha::Database -e ' my $schema = Koha::Database->schema; my $period = $schema->resultset("Aqbudgetperiod")->create({ budget_period_startdate => "2000-01-01", budget_period_enddate => "2999-12-31" }); $schema->resultset("Aqbudget")->create({ budget_owner_id => 1, budget_period_id => $period->id }) for (1..1000) ' 2. Go to http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl 3. Note how it takes several seconds to load 4. Apply the patch 5. koha-plack --restart kohadev 6. Go to http://localhost:8081/cgi-bin/koha/suggestion/suggestion.pl 7. Note how it loads in < 1 second now -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183676|0 |1 is obsolete| | --- Comment #10 from David Cook <dcook@prosentient.com.au> --- Created attachment 185381 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185381&action=edit Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl calls CanUserUseBudget() in a loop, will must use a uniq Koha::Patron object of the logged in user. When there are many budgets and funds this takes some time. Test plan : Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) Signed-off-by: David Cook <dcook@prosentient.com.au> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=33430 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185381|0 |1 is obsolete| | --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 185891 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185891&action=edit Bug 36155: Improve perfs of suggestion.pl when there are many budgets Page suggestion/suggestion.pl calls CanUserUseBudget() in a loop, will must use a uniq Koha::Patron object of the logged in user. When there are many budgets and funds this takes some time. Test plan : Compare performance with and without patch with many budgets and funds (see test plan of Bug 35921) Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Improve perfs of |Improve performance of |suggestion.pl when there |suggestion.pl when there |are many budgets |are many budgets CC| |m.de.rooy@rijksmuseum.nl QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to main Version(s)| |25.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #12 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- We could maybe have used a separate variable for the unblessed version. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- (In reply to Jonathan Druart from comment #13)
We could maybe have used a separate variable for the unblessed version.
use Benchmark qw(:all); use Koha::Patrons; my $patron = Koha::Patrons->find(51); my $count = 10000; my $t = timeit($count, sub { $patron->unblessed }); print "$count unblessed:", timestr($t),"\n"; 10000 unblessed: 0 wallclock secs ( 0.13 usr + 0.00 sys = 0.13 CPU) @ 76923.08/s (n=10000) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.11.00 |25.11.00,25.05.04 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 --- Comment #15 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|25.11.00,25.05.04 |25.11.00,25.05.04,24.11.09 released in| | --- Comment #16 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 24.11.x for 24.11.09 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36155 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting --- Comment #17 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x as it wasn't backported to 24.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org