launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #06629
"Performance Tuesday" candidate
-
To:
Launchpad Community Development Team <launchpad-dev@xxxxxxxxxxxxxxxxxxx>
-
From:
Jeroen Vermeulen <jtv@xxxxxxxxxxxxx>
-
Date:
Mon, 07 Mar 2011 09:22:09 +0700
-
User-agent:
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8
Hi folks,
This could be an easy big win for someone who feels like fixing a
performance problem.
One of our slowest requests is
LanguageSet:CollectionResource:#languages, an API request.
An example of the oops is here:
https://lp-oops.canonical.com/oops.py/?oopsid=1891B10
What does it do? Why is it so slow? As near as makes no difference,
all of the request's time is spent counting contributors for each
individual language out of the karma cache!
Like so:
SELECT COUNT(*)
FROM KarmaCache,
KarmaCategory,
Person,
PersonLanguage
WHERE PersonLanguage.person = Person.id
AND PersonLanguage.LANGUAGE = <language_id>
AND KarmaCache.person = Person.id
AND KarmaCache.product IS NULL
AND KarmaCache.project IS NULL
AND KarmaCache.sourcepackagename IS NULL
AND KarmaCache.distribution IS NULL
AND KarmaCache.category = KarmaCategory.id
AND KarmaCategory.name = 'translations'
AND (1=1)
This looks like it could be sped up very very easily:
SELECT PersonLanguage.language, COUNT(*)
FROM KarmaCache,
KarmaCategory,
Person,
PersonLanguage
WHERE PersonLanguage.person = Person.id
AND KarmaCache.person = Person.id
AND KarmaCache.product IS NULL
AND KarmaCache.project IS NULL
AND KarmaCache.sourcepackagename IS NULL
AND KarmaCache.distribution IS NULL
AND KarmaCache.category = KarmaCategory.id
AND KarmaCategory.name = 'translations'
AND (1=1)
GROUP BY PersonLanguage.language
Seriously, it would save about 13 seconds on that particular timeout and
who knows how many seconds beyond the timeout. Be the day's hero!
It's bug 728174.
Jeroen