Distribution/DistroSeries overview wastes time querying languages and countries

Bug #515702 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Jeroen T. Vermeulen

Bug Description

We're seeing some timeouts for the Distribution and DistroSeries translation overview pages because they spend too much time looking up languages by code, and to a slightly lesser extent, countries and the languages that are spoken in them.

The language lookups in particular are pointless. We're querying Language by code about 10× as many times as there are languages listed in the overview. Some kind of caching and/or bulk-fetching seems in order.

OOPS-1492A1007, OOPS-1492A1146, OOPS-1492A1282, OOPS-1492A1362, OOPS-1492A1372
OOPS-1492A1456, OOPS-1492B1114, OOPS-1492B1170, OOPS-1492B1292, OOPS-1492B1533
OOPS-1492B1450, OOPS-1492D1484, OOPS-1492G1554, OOPS-1492G2077, OOPS-1492H60

Related branches

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

The cause seems to be that isPreferredLanguage indirectly looks up TranslationsMixin.translatable_languages, which uses preferred_or_request_languages from the Launchpad helpers, which in turn queries all of the languages set as the user's preferred languages or accepted by the http[s] request.

Since this is browser code, we can just make translatable_languages a @cachedproperty. It doesn't break any pagetests, and it looks like it'd knock >10 seconds off each of the timed-out requests.

Changed in rosetta:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Jeroen T. Vermeulen (jtv)
milestone: none → 10.02
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

OOPS-1493A256, OOPS-1493A381, OOPS-1493B1491, OOPS-1493B1554, OOPS-1493B182
OOPS-1493A1351, OOPS-1493A1368, OOPS-1493A1573, OOPS-1493A626, OOPS-1493B1238
OOPS-1493C1002, OOPS-1493C1497, OOPS-1493C193, OOPS-1493C999, OOPS-1493O943
OOPS-1493G1262
OOPS-1493A623
OOPS-1493C1885, OOPS-1493D971
OOPS-1493A1094, OOPS-1493A276, OOPS-1493B891, OOPS-1493C1005, OOPS-1493C1415
OOPS-1493A1362, OOPS-1493A1408, OOPS-1493A1932, OOPS-1493A978, OOPS-1493E541

Actually, it *can* also happen with products or productseries:
OOPS-1493C1073, OOPS-1493F1677, OOPS-1493G2098, OOPS-1493H1260

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

        OOPS-1493EA364, OOPS-1493EB531, OOPS-1493EB536
        OOPS-1493EA73, OOPS-1493EC309
OOPS-1493EB22
        OOPS-1493EA363, OOPS-1493EB280, OOPS-1493EC310
        OOPS-1493EA625, OOPS-1493EA66
        OOPS-1493EA398, OOPS-1493EB317

summary: - Distribution/DistroSeries overview wastes time querying languges and
+ Distribution/DistroSeries overview wastes time querying languages and
countries
Revision history for this message
Ursula Junque (ursinha) wrote : A commit mentioned this bug
Changed in rosetta:
status: In Progress → Fix Committed
tags: added: qa-needstesting
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Yay! On edge this has taken all the problem pages out of the top-10 lists: timeouts, durations, and statement count.

tags: added: qa-ok
removed: qa-needstesting
Changed in rosetta:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.