-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Add caching to pagegrid #1406
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine, but @beatrycze-volk just introduced a dedicated DocumentCacheManager
in #1401. Maybe we should incorporate this into the new cache manager instead of doing our own caching in PageGridController
?
Yes, this changes can be added to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please incorporate this into the new cache manager (see #1401).
Any news on this, @michaelkubina? I'd love to merge this for the 6.0 release. |
@sebastian-meyer i had a tighter schedule due to some courses...i will look into it the next coming days |
No worries! I didn't want to stress you, but just to make sure it's not forgotten. ;o) |
This PR adds a cache specifically for the pagegrid and optimizes the for-loop.
Background: each call to the PageGrid-Controller requires the whole
structMap PHYSICAL
to be parsed alongside the correspondingfileGrp
for the thumbnail URL. This is a very expensive operation with linear time complexety. Since we always load the whole$entryArray
with each call and pass it later on to the pagination, this results in very long response times as it needs to be processed again and again. The number of pages displayed in the pagegrid (via settings) has no effect on execution time as it only affects the pagination itself.On a manuscript with about 1800 (https://resolver.sub.uni-hamburg.de/kitodo/PPN1842517988) pages the execution time for the pagegrid alone takes about 10+ seconds. After adding the cache it went down to about 50ms (on our development instance) once there was a cached item.
With this PR and the #1405 optimization the whole response time for said document went down from nearly 25 seconds to about 2,5 seconds on our development instance. On a typical book with about 200 pages it went down from about 3,5 seconds to about 600ms.
Sidenote: At the SUB-HH the pagegrid is directly integrated into the details-page as a initially invisible container. once it is opened we present all pages without the pagination with lazy-loading of the thumbnails. This way we always allow for a whole preview of the document and see it as a navigation feature that should not require a page-reload when opened. Typically document have around 200-300 pages, so that we accept edge-cases like these large documents to be still quite slower than others. Even if it the pagegrid is used as a standalone page, this optimization improves performance significantly.