Bug 29032

Summary: ILL route unusable (slow)
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: REST APIAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: major    
Priority: P5 - low CC: andrewfh, fridolin.somers, jonathan.druart, kyle, martin.renvoize, nick, victor, wainuiwitikapark
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05,20.11.11,20.05.17,19.11.23
Bug Depends on:    
Bug Blocks: 22440    
Attachments: Bug 29032: Pre-load ILL backends to speed up response
Bug 29032: Pre-load ILL backends to speed up response
Bug 29032: Pre-load ILL backends to speed up response
Bug 29032: Pre-load ILL backends to speed up response

Description Tomás Cohen Arazi 2021-09-15 15:02:40 UTC
With only 20 ill requests, for the same backend, the page takes lots of seconds to load.

Steps to reproduce:
1. Add 23 requests with your favourite ILL backend
2. Hit the ILL requests page
=> FAIL: Notice it takes ages to load
Comment 1 Tomás Cohen Arazi 2021-09-15 15:16:34 UTC
Marking it RM_priority so it can be backported ASAP to stable branches once we are sure it works correctly.
Comment 2 Tomás Cohen Arazi 2021-09-15 15:16:56 UTC
Created attachment 124899 [details] [review]
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Andrew Fuerste-Henry 2021-09-15 17:49:26 UTC
Created attachment 124904 [details] [review]
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 4 Tomás Cohen Arazi 2021-09-15 18:10:34 UTC
Created attachment 124906 [details] [review]
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 5 Martin Renvoize 2021-09-21 13:36:28 UTC
Created attachment 125107 [details] [review]
Bug 29032: Pre-load ILL backends to speed up response

Bug 22440 will rewrite the route and make it even more efficient by
prefetching the related data instead of performing several queries in
loops.

In the meantime, we can make this controller perform better with a
simple intervention: load backends once, and use the
$request->_backend() setter to pre-set it before using the objects.

To test:
1. Perform any usual ILL requests listing, try having several
=> FAIL: Notice it takes a weird amount of time to load
2. Apply this patch
3. Restart all
4. Repeat 1
=> SUCCESS: It feels fast enough!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2021-09-21 13:36:57 UTC
Nice speed up here.. No regressions found

PQA
Comment 7 Jonathan Druart 2021-09-21 18:19:16 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 8 Kyle M Hall 2021-10-01 18:26:37 UTC
Pushed to 21.05.x for 21.05.05
Comment 9 Fridolin Somers 2021-10-09 02:15:17 UTC
Pushed to 20.11.x for 20.11.11
Comment 10 Victor Grousset/tuxayo 2021-10-17 01:13:43 UTC
Backported: Pushed to 20.05.x branch for 20.05.17
Comment 11 wainuiwitikapark 2021-10-18 02:43:12 UTC
Backported to 19.11.x for 19.11.23