プロジェクト

全般

プロフィール

Vote #79360

完了

Update User#last_login_on only once per minute

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

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

0%

予定工数:
category_id:
53
version_id:
99
issue_org_id:
28952
author_id:
2784
assigned_to_id:
1
comments:
8
status_id:
5
tracker_id:
2
plus1:
1
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

On setups where a lot of logins happen (e.g. when heavily using the API with Basic Auth credentials), access to the@ users@ table can get contentioned due to the many parallel write queries to the table during each request as each requests sets the last_login_on column of the user to the current date in @User.try_to_login@. This can result in deadlocks or general long lock waits on the database since all of these update queries will effectively be serialized per user.

By updating the last_login_on column less often, we can drastically reduce this contention. The attached patch implements this by only updating the @last_login_on@ column once per minute.


journals

--------------------------------------------------------------------------------
nice catch!

I'm wondering if something like this could be also applied for
verify_session_token - https://github.com/redmine/redmine/blob/43d9bea7c5da32a99c3ebdb828e23d6a02c31c12/app/models/user.rb#L442
if Rails.application.config.redmine_verify_sessions is enabled, redmine updates user tokens on each request. These updates are at the top or our db monitoring.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
+1
Sometimes I also experience the same problem.

Setting target version to 4.1.0.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Patch committed, thanks.

Pavel Rosický wrote:
> I'm wondering if something like this could be also applied for
> verify_session_token - https://github.com/redmine/redmine/blob/43d9bea7c5da32a99c3ebdb828e23d6a02c31c12/app/models/user.rb#L442
> if Rails.application.config.redmine_verify_sessions is enabled, redmine updates user tokens on each request. These updates are at the top or our db monitoring.

Please fill a separate issue so we can keep track of that.
--------------------------------------------------------------------------------
done #29041
--------------------------------------------------------------------------------

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


related_issues

relates,New,20648,Users' "Last connection" is not updated correctly.
relates,Closed,29041,Update session token only once per minute

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

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

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

いいね!0
いいね!0