Feature #28952
closedUpdate User#last_login_on only once per minute
0%
Description
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.
Files
Related issues
Updated by Go MAEDA over 6 years ago
- Target version set to Candidate for next major release
Updated by Pavel Rosický over 6 years ago
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.
Updated by Go MAEDA over 6 years ago
- Related to Defect #20648: Users' "Last connection" is not updated correctly. added
Updated by Go MAEDA over 6 years ago
- Target version changed from Candidate for next major release to 4.1.0
+1
Sometimes I also experience the same problem.
Setting target version to 4.1.0.
Updated by Jean-Philippe Lang over 6 years ago
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Target version changed from 4.1.0 to 4.0.0
- Resolution set to Fixed
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.
Updated by Marius BĂLTEANU over 6 years ago
- Related to Feature #29041: Update session token only once per minute added