-
Notifications
You must be signed in to change notification settings - Fork 64
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
Slow process template page access #5336
Comments
It seems like the function kitodo-production/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml Line 84 in f58592b
kitodo-production/Kitodo/src/main/webapp/WEB-INF/templates/includes/projects/templateList.xhtml Line 107 in f58592b
Which would probably mean 40 database (Elasticsearch?) queries in your case: kitodo-production/Kitodo/src/main/java/org/kitodo/production/forms/TemplateForm.java Line 414 in f58592b
|
Thank you for your research, @BartChris . I can more or less confirm that the call in |
I am wondering if this flag ("is_used_by_processes") should just be a property of the template, set to NULL for existing templates. Then this has to be only calculated once and then stored in the database. Whenever a process is deleted it could be checked, if the template is still referenced by a process and the property could be changed if necessary. |
If getting this information from the database (template is used by processes or not) instead of ElasticSearch you did not need such a field as this information can be retrieved through a good query (left or right join, depending on which side you start the query) to the database - which is possible through Hibernate as used database layer too. |
I just came over this again and saw that it is loading all processes for each comment or batch. But I don’t understand why. MariaDB log while waiting for the process template page to appear:
|
Can we leverage HQL here to just get a map with one query which indicates wether a process template is used or not or the count how many times the template is used (If it is not used, it is not in the list)? And store that in the backing bean to not having to recalculate it. If i am not mistaken both things can also be expressed as HQL Query. SELECT t.id AS template_id,
CASE WHEN EXISTS (
SELECT 1 FROM process p WHERE p.template_id = t.id
) THEN 1 ELSE 0 END AS is_used
FROM template t; gives
SELECT template_id, count(*) from process p group by template_id ; gives
|
Describe the bug
The first access of the process template page is slow and there are only 10 process templates to be shown - i guess the time for this is 30 seconds. I don't know if the time depends on how many projects and indirect processes are assigned to a process template or which other reason is responsible to this slow displaying.
If you later - or in the same login session - open the process template page again, then you get the results a lot faster. After you logged out and logged in again the display speed is on the first access slow again.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Displaying of process templates should not take "ages" to get displayed.
Release
3.4.4-SNAPSHOT
The text was updated successfully, but these errors were encountered: