プロジェクト

全般

プロフィール

Vote #81835

完了

Improve performance of adding or removing members of a group

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Performance_53
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
53
version_id:
155
issue_org_id:
36696
author_id:
94920
assigned_to_id:
332
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

In situations where groups are applied to hundreds of projects (with or without subprojects, with or without inherit members), adding or removing a user from the group takes VERY LONG (more than 5-10 minutes).

Would like to request:

Better querying optimization?

Bulk edit capability

  1. not sure how because I do not know how it queries. maybe something like consolidate multiple queries into fewer big queries?
  2. When looking at the "users" tab under Groups, have a checkmark selection and "Apply All" button at the bottom for actions applied for multiple users at once. This way it can try to optimize the query for that?

journals

or maybe make it a background job similar to like #36691
--------------------------------------------------------------------------------
I wrote a patch that speeds up the adding of a group member. In my test environment with 500+ projects, I got a speedup of about 30%.

Before:
<pre>
Completed 200 OK in 1674ms (Views: 10.3ms | ActiveRecord: 275.6ms | Allocations: 924861)
Completed 200 OK in 1691ms (Views: 2.7ms | ActiveRecord: 278.2ms | Allocations: 921060)
Completed 200 OK in 1734ms (Views: 2.1ms | ActiveRecord: 294.0ms | Allocations: 921192)
Completed 200 OK in 1928ms (Views: 3.0ms | ActiveRecord: 305.9ms | Allocations: 921065)
Completed 200 OK in 1655ms (Views: 2.7ms | ActiveRecord: 277.6ms | Allocations: 921057)
</pre>

After:
<pre>
Completed 200 OK in 1309ms (Views: 4.1ms | ActiveRecord: 185.9ms | Allocations: 754306)
Completed 200 OK in 1264ms (Views: 2.1ms | ActiveRecord: 169.1ms | Allocations: 745979)
Completed 200 OK in 1392ms (Views: 2.7ms | ActiveRecord: 184.0ms | Allocations: 745980)
Completed 200 OK in 1299ms (Views: 2.1ms | ActiveRecord: 173.2ms | Allocations: 746013)
Completed 200 OK in 1256ms (Views: 2.1ms | ActiveRecord: 168.8ms | Allocations: 745976)
</pre>
--------------------------------------------------------------------------------
Updated the patch. Now it also improves the speed of removing a group member. The speedup of GroupsController#remove_user is about 20% in my test environment.

Before:
<pre>
Completed 200 OK in 1555ms (Views: 8.9ms | ActiveRecord: 281.5ms | Allocations: 951235)
Completed 200 OK in 1605ms (Views: 2.3ms | ActiveRecord: 295.5ms | Allocations: 947796)
Completed 200 OK in 1551ms (Views: 2.7ms | ActiveRecord: 290.3ms | Allocations: 947743)
Completed 200 OK in 1566ms (Views: 3.6ms | ActiveRecord: 289.5ms | Allocations: 947744)
Completed 200 OK in 1610ms (Views: 2.7ms | ActiveRecord: 300.5ms | Allocations: 947749)
</pre>

After:
<pre>
Completed 200 OK in 1247ms (Views: 4.6ms | ActiveRecord: 221.6ms | Allocations: 732887)
Completed 200 OK in 1364ms (Views: 2.1ms | ActiveRecord: 248.6ms | Allocations: 729979)
Completed 200 OK in 1255ms (Views: 2.1ms | ActiveRecord: 231.0ms | Allocations: 730074)
Completed 200 OK in 1399ms (Views: 2.0ms | ActiveRecord: 261.1ms | Allocations: 729955)
Completed 200 OK in 1285ms (Views: 2.2ms | ActiveRecord: 232.4ms | Allocations: 729953)
</pre>
--------------------------------------------------------------------------------
That was quick, thank you for your efforts!
--------------------------------------------------------------------------------
Setting the target version to 5.0.0.
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Closed,36730,Replace Member.find_or_new with ActiveRecord's find_or_initialize_by

Admin Redmine さんが4年以上前に更新

  • カテゴリPerformance_53 にセット
  • 対象バージョン5.0.0_155 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0