Closed Bug 897029 Opened 7 years ago Closed 7 years ago

Preload bug permissions when calling Bug.get to improve performance

Categories

(Bugzilla :: WebService, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
Bugzilla 5.0

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

(Keywords: perf)

Attachments

(1 file)

Attached patch patch, v1Splinter Review
Bugzilla::Bug->check() passes one bug ID to Bugzilla::User->visible_bugs() to know if the user is allowed to access the bug. This means one DB call per bug.

If we call Bugzilla::User->visible_bugs() with the whole list of bug IDs before calling Bugzilla::Bug->check(), then the DB isn't queried again and again, because permissions are already cached.

In my testing with 1300 bugs being requested at once, the win is 0.5 second.
Attachment #779752 - Flags: review?(sgreen)
and NYTProf reports:

without my patch:

# spent 715ms (71.4+643) within Bugzilla::User::visible_bugs which was called 1302 times, avg 549µs/call


with my patch:

# spent 120ms (62.7+57.5) within Bugzilla::User::visible_bugs which was called 1303 times, avg 92µs/call
Attachment #779752 - Flags: review?(sgreen) → review+
Flags: approval?
Flags: approval? → approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/WebService/Bug.pm
Committed revision 8674.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.