Bug 1247796 - get_enterable_products() is slow for logged out users
get_enterable_products() is slow for logged out users
Product: Bugzilla
Classification: Community
Component: Bugzilla General (Show other bugs)
Unspecified Unspecified
high Severity high (vote)
: ---
: ---
Assigned To: Jeff Fearn
Depends On:
  Show dependency treegraph
Reported: 2015-07-28 18:46 EDT by Matt Tyson
Modified: 2015-08-04 19:33 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-08-04 19:33:02 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Mozilla Foundation 1188451 None None None Never

  None (edit)
Description Matt Tyson 2015-07-28 18:46:59 EDT
When fixing bug 1241767 upstream, it was found that get_enterable_products() is extremely slow for logged out users.  We should find out why this is the case and fix it.
Comment 1 Jason McDonald 2015-07-29 20:21:28 EDT
Which pages will this impact?
Comment 2 Matt Tyson 2015-07-29 20:30:26 EDT
(In reply to Jason McDonald from comment #1)
> Which pages will this impact?

show_bug.cgi and enter_bug.cgi
Comment 3 Jeff Fearn 2015-08-04 19:24:25 EDT
I've been testing this and I don't think it's a bug. The extra cost appears to be connecting to the DB. The way this test is constructed a logged in user will already have a connection as they have accessed the profiles table, whereas a logged out user hasn't done that so needs to start up a connection.

I've timing around Bugzilla->dbh in sub get_enterable_products and running the tests as per https://bugzilla.mozilla.org/show_bug.cgi?id=1183492#c9

$ perl -Mlib=lib -MTime::HiRes -MBugzilla -MBugzilla::User -wE 'my $user = Bugzilla::User->new(1); $user->groups_as_string; my $t0 = Time::HiRes::time(); my $groups = $user->get_enterable_products; my $t1 = Time::HiRes::time(); say $t1 - $t0'

$ perl -Mlib=lib -MTime::HiRes -MBugzilla -MBugzilla::User -wE 'my $user = Bugzilla::User->new(0); $user->groups_as_string; my $t0 = Time::HiRes::time(); my $groups = $user->get_enterable_products; my $t1 = Time::HiRes::time(); say $t1 - $t0'
Comment 4 Jeff Fearn 2015-08-04 19:33:02 EDT
Bug was closed upstream after feedback above was posted there.

Note You need to log in before you can comment on or make changes to this bug.