Bugzilla::User::Setting::get_all_settings() should use memcached

RESOLVED FIXED in Bugzilla 5.0

Status

()

Bugzilla
Bugzilla-General
P1
enhancement
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: glob, Assigned: glob)

Tracking

({bmo-goal, perf})

unspecified
Bugzilla 5.0
bmo-goal, perf
Bug Flags:
approval +

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
due to the gravatar extension on BMO, $user->settings() is called for each commenter.  this results in frequent database calls for data that changes very infrequently, making it an ideal candidate for memcached.

changes required:
- during an update in editsettings.cgi call Bugzilla->memcached->clear_config()
- update Bugzilla::User::Settings:
  - update get_all_settings($user_id)
    - build a cache key as "user_settings.$user_id"
    - check the cache with Bugzilla->memcached->get_config($key) and return if found
    - if not found, query the database and store with memcached->set_config()
  - add a method clear_settings_cache($user_id)
    - calls memcached->clear({ key => $key }) using the same key as get_all_settings()
- call clear_settings_cache() from userprefs.cgi::SaveSettings()

i'm not totally comfortable with clear_settings_cache(), however the way settings have been implemented makes abstraction difficult (the settings hashref inside the user object is updated directly by userprefs.cgi, and using a tied hashref would be an overkill).

Updated

3 years ago
Severity: normal → enhancement
(Assignee)

Updated

3 years ago
Keywords: bmo-goal
(Assignee)

Updated

3 years ago
Assignee: general → glob
(Assignee)

Comment 1

3 years ago
Created attachment 8444484 [details] [diff] [review]
993926_1.patch
Attachment #8444484 - Flags: review?(sgreen)

Updated

3 years ago
Priority: -- → P1

Updated

3 years ago
Attachment #8444484 - Flags: review?(sgreen) → review+
(Assignee)

Comment 2

3 years ago
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   8b98912..c19dc4f  master -> master
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Flags: approval+
Resolution: --- → FIXED
Target Milestone: --- → Bugzilla 5.0
You need to log in before you can comment on or make changes to this bug.