Open Bug 1277432 Opened 9 years ago Updated 8 years ago

Bugzilla::Memcached needs to support caching and clearing whole tables

Categories

(Bugzilla :: Database, enhancement)

5.1.1
enhancement
Not set
normal

Tracking

()

People

(Reporter: dylan, Assigned: h2014313059)

Details

Attachments

(1 file, 4 obsolete files)

There are a few tables (yes, whole tables) that are reasonably small enough to store in memcached. Of these, fielddefs is a good target. glob: The prefix / incr / etc stuff that is used to quickly invalidate cache, is that technique discussed somewhere? I'd like to make sure I understand its significance before adding anything else in there.
Flags: needinfo?(glob)
(In reply to Dylan William Hardison [:dylan] from comment #0) > glob: The prefix / incr / etc stuff that is used to quickly invalidate > cache, is that technique discussed somewhere? tons of places, including the official faq: https://github.com/memcached/memcached/wiki/ProgrammingTricks#namespacing
Flags: needinfo?(glob)
note a lot of these sorts of tables, including fielddefs, already have IS_CONFIG => 1, so core 'load whole table' and cache invalidation mechanisms already exist. https://github.com/mozilla/webtools-bmo-bugzilla/blob/master/Bugzilla/Object.pm#L414 of course making smarter use of this could be of value (priming the cache on startup, supporting filtered requests, etc).
well, right now fielddefs is loaded from the db twice per request (for some requests, anyway). My plan is to put caching in match() for Bugzilla::Field, for instance.
(In reply to Dylan William Hardison [:dylan] from comment #3) > well, right now fielddefs is loaded from the db twice per request (for some > requests, anyway). > My plan is to put caching in match() for Bugzilla::Field, for instance. sounds like a solid plan :)
Severity: normal → enhancement
Assignee: database → h2014313059
Attached patch first patch (obsolete) — Splinter Review
Attachment #8796847 - Flags: review?(dylan)
Comment on attachment 8796847 [details] [diff] [review] first patch Please remove all the commented out code and submit another patch. :-)
Attachment #8796847 - Flags: review?(dylan) → review-
Attached patch Modified First Patch (obsolete) — Splinter Review
Attachment #8796848 - Flags: review?(dylan)
Attachment #8796847 - Attachment is obsolete: true
note: ignoring those extra files. it was because of how we did a .git directory transplant.
Attached patch Third patch (obsolete) — Splinter Review
Attachment #8796849 - Flags: review?(dylan)
Attachment #8796848 - Attachment is obsolete: true
Attachment #8796848 - Flags: review?(dylan)
Comment on attachment 8796849 [details] [diff] [review] Third patch I was too involved in discovering this fix, so I'm going to ask dkl to review it.
Attachment #8796849 - Flags: review?(dylan) → review?(dkl)
Comment on attachment 8796849 [details] [diff] [review] Third patch Review of attachment 8796849 [details] [diff] [review]: ----------------------------------------------------------------- This could be a future issue as our memcached instance limits keys to 250 characters in length. Certain where strings can be longer than this and the key would be truncated to 250 silently. This could cause unintended key collisions is some cases and we need to guarantee this doesn't happen. I would suggest we first hash the where string and use the hash string in the key. Then use this to get/set. Or someother method if there is one better to guarantee uniqueness but still always be under the size limit. We could use something similar to how Bugzilla::Token::issue_hash_token uses md5_hex from Digest::MD5 to hash the where string. Maybe give that a try first. dkl ::: Bugzilla/Object.pm @@ +381,5 @@ > && $class->IS_CONFIG) > { > + if ($where) { > + $memcached_key = "$class:where:$where"; > + } else { nit: } else {
Attachment #8796849 - Flags: review?(dkl) → review-
Attached patch Revised_patch (obsolete) — Splinter Review
Attachment #8807410 - Flags: review?(dkl)
Attachment #8807410 - Flags: feedback?(dylan)
Attached patch Revised_patchSplinter Review
Attachment #8796849 - Attachment is obsolete: true
Attachment #8807410 - Attachment is obsolete: true
Attachment #8807410 - Flags: review?(dkl)
Attachment #8807410 - Flags: feedback?(dylan)
Flags: needinfo?(dylan)
Attachment #8807411 - Flags: review?(dkl)
This looks promising.
Flags: needinfo?(dylan)
Comment on attachment 8807411 [details] [diff] [review] Revised_patch I cannot get to this at the moment. Dylan might be faster then I. dkl
Attachment #8807411 - Flags: review?(dkl) → review?(dylan)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: