Redmine - Defect #40610
Slow display of projects list when including project description column
2024-04-22 10:29 - James H

ステータス:

Closed

開始日:

優先度:

Normal

期日:担当者:

Go MAEDA

進捗率:0%

カテゴリ:

Performance

予定工数:

0.00時間対象バージョン:5.0.9

Resolution:

Fixed

Affected version:

4.1.0

説明
Hello,I am in the process of upgrading to 5.x.x from 4.x.x and noticed that there was a change to the projects page that is causing me
problems, probably due to my open project count.
I have a lot of open projects at a given time and the changes are causing it to lag out and freeze before it finishes loading...
I managed to make it a bit better by removing all the project descriptions and filtering from the page but it also still freezes near
the end.
Any way to make this more performant?
関連するチケット:
関連している Redmine - Feature #29482: Query system for Project...

Closed

関係しているリビジョン
リビジョン 22829 - 2024-05-14 09:44 - Go MAEDAFix slow display of projects list when including project description column (#40610).
Patch by Go MAEDA (@maeda).
リビジョン 22831 - 2024-05-15 16:07 - Go MAEDA
Merged r22829 from trunk to 5.1-stable (#40610).
リビジョン 22832 - 2024-05-16 01:46 - Go MAEDA
Merged r22829 from trunk to 5.0-stable (#40610).

履歴#1 - 2024-04-23 08:25 - Go MAEDA
Does the following change improve performance?
diff --git a/app/helpers/application̲helper.rb b/app/helpers/application̲helper.rb
index 910f1f431..24160641b 100644--- a/app/helpers/application̲helper.rb+++ b/app/helpers/application̲helper.rb@@ -941,7 +941,7 @@module ApplicationHelper
if obj.is̲a?(Journal)
attachments += obj.journalized.attachments if obj.journalized.respond̲to?(:attachments)
else
attachments += obj.attachments if obj.respond̲to?(:attachments)+
attachments += obj.attachments if !obj.is̲a?(Project) && obj.respond̲to?(:attachments)
end
if attachments.present?
text.gsub!(/src="([^\/"]+\.(bmp¦gif¦jpg¦jpe¦jpeg¦png¦webp))"(\s+alt="([^"]*)")?/i) do ¦m¦#2 - 2024-04-23 20:31 - James H
Go MAEDA wrote in #note-1:
Does the following change improve performance?
[...]

2024-10-11

1/3

yes, that seems to make it load much much faster, taking about 10% of the time it used to take to freeze
Thank you!
#3 - 2024-04-24 05:16 - Go MAEDAJames H wrote in #note-2:
Go MAEDA wrote in #note-1:
Does the following change improve performance?
[...]

yes, that seems to make it load much much faster, taking about 10% of the time it used to take to freeze
Thank you!

Thanks to your feedback, I have identified the cause of the issue you mentioned. I will look into ways to address this issue.
#4 - 2024-04-25 02:26 - Go MAEDA- ファイル 40610.patch を追加- 対象バージョン を Candidate for next minor release にセット
I wrote a patch to fix this issue.
The cause of the issue is that the projects list with the list style loads all attachments whose container̲type is Project for each project to render theproject's description. Attachments with container̲type of Project are files uploaded to the "Files" module.
Attachment Load (0.1ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 1], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Attachment Load (0.2ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 5], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Attachment Load (0.1ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 6], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Attachment Load (0.1ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 3], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Attachment Load (0.1ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 4], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Attachment Load (0.2ms)
SELECT "attachments".* FROM "attachments" WHERE "attachments"."container̲id"
̲type" = ? ORDER BY attachments.created̲on ASC, attachments.id ASC[["container̲id", 2], ["container̲type",
app/helpers/application̲helper.rb:944:in ̀+'
Rendered projects/̲list.html.erb (Duration: 188.8ms ¦ Allocations: 68634)= ? AND"Project"]]"attachments".

= ? AND"Project"]]"attachments".

= ? AND"Project"]]"attachments".

= ? AND"Project"]]"attachments".

= ? AND"Project"]]"attachments".

= ? AND"Project"]]"attachments".

The reason attachments are loaded to render text content is to generate HTML tags for inline images. Currently, however, attachments are always
loaded even for content that does not contain inline images. This causes the performance issue when displaying many projects in the project list.
The attached patch resolves this performance issue by changing ApplicationHelper#parse̲inline̲attachments to load attachments only when thetext being rendered contains img tags. I guess the change will improve performance not only for displaying the projects list, but also for displaying
an issue with large numbers of attachments and comments.
#5 - 2024-04-25 02:44 - Go MAEDA- Affected version を 5.1.2 から 4.1.0 に変更#6 - 2024-04-25 02:44 - Go MAEDA- 関連している Feature #29482: Query system for Projects page を追加#7 - 2024-04-25 08:43 - Go MAEDA- ファイル 40610-v2.patch を追加
I found a simpler solution than the patch I posted in #note-4. Applying the following fix will have the same effect as the patch in #note-4, as it will
skip processing inline images, which is not necessary when displaying the project list.
#8 - 2024-04-25 22:51 - James H

2024-10-11

2/3

Thank you, will give it a try later#9 - 2024-04-30 09:03 - Go MAEDA- 対象バージョン を Candidate for next minor release から 5.0.9 に変更
Setting the target version to 5.0.9.
#10 - 2024-05-14 09:44 - Go MAEDA- 題名 を Projects page never finishes loading から Slow display of projects list when including project description column に変更- ステータス を New から Resolved に変更- Resolution を Fixed にセット
Committed the fix in r22829.
#11 - 2024-05-16 01:46 - Go MAEDA- ステータス を Resolved から Closed に変更- 担当者 を Go MAEDA にセット
Merged the change to stable branches.

ファイル
40610.patch
40610-v2.patch

2024-10-11

2.2 KB

2024-04-25

Go MAEDA

1009 Bytes

2024-04-25

Go MAEDA

3/3