Person:+branches timeouts

Bug #827935 reported by Martin Pool
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Raphaël Badin

Bug Description

https://code.launchpad.net/~ubuntu-branches consistently times out for me with for example OOPS-2055AZ40 and OOPS-2054AO1

this has happened a bunch of times before in for example bug 397034.

it would be quite useful to be able to see this so we can check on the udd importer.

More recent OOPS:OOPS-2106I63

Related branches

Martin Pool (mbp)
description: updated
tags: added: regression timeout
Changed in launchpad:
status: New → Triaged
importance: Undecided → Critical
Revision history for this message
Martin Pool (mbp) wrote :

so the timeout seems to be in

select branch ... ORDER BY Branch.lifecycle_status DESC, Branch.target_suffix ASC, Branch.owner_name ASC, Branch.name ASC LIMIT 48
OFFSET 313000

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 827935] Re: consistent timeout on user branch listing page

On Wed, Aug 17, 2011 at 11:03 PM, Martin Pool <email address hidden> wrote:
> so the timeout seems to be in
>
> select branch ... ORDER BY Branch.lifecycle_status DESC, Branch.target_suffix ASC, Branch.owner_name ASC, Branch.name ASC LIMIT 48
> OFFSET 313000

heh. So this is addressable soon with Abels up coming most excellent
work integrating the memo support in batchnav.

-Rob

summary: - consistent timeout on user branch listing page
+ Person:+branches timeouts
description: updated
Raphaël Badin (rvb)
Changed in launchpad:
assignee: nobody → Raphaël Badin (rvb)
status: Triaged → In Progress
Revision history for this message
Raphaël Badin (rvb) wrote :

Most of the time is indeed spent computing counts; Unfortunately I think Abel's work on StormRangeFactory cannot be applied to this because of the limitations it has (namely, that resultsets must be entire objects: simply adding range_factory = StormRangeFactory(results) fails to create a proper explain query: "EXPLAIN SELECT Branch.date_last_modified DESC, Branch.target [...]"). Maybe the query could be refactored to make it work but the way the query is built is rather complex.

I'll see if I can find a way to improve the queries themselves (for instance by caching the result of the subquery https://pastebin.canonical.com/54940/ which is repeated over and over).

Revision history for this message
Raphaël Badin (rvb) wrote :

I made a first attempt: http://paste.ubuntu.com/719759/. But testing the generated query on real data showed that this does not lead to any serious gain.

The heart of the problem seems to be here:
   -> Seq Scan on branch (cost=3507.31..57784.85 rows=223894 width=0) (actual time=0.029..1019.004 rows=336922 loops=1)
         Filter: (((NOT transitively_private) OR (hashed SubPlan 1)) AND (owner = 2866082) AND (lifecycle_status = ANY ('{10,30,50}'::integer[])))
(lines 4,5 of https://pastebin.canonical.com/54886/ [orig query https://pastebin.canonical.com/54885/])

jtv suggests splitting the problem into two to give a chance to the planner to do more clever choices.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 827935] Re: Person:+branches timeouts

Note that stormrangefactory can be improved to do non-objects, it just
wasn't needed for the first type abel was working on improving.

Revision history for this message
Raphaël Badin (rvb) wrote :

The diff I proposed in an earlier comment did improve the counting of the private branches (and since the subquery is repeated over and over this might buy us some perf) but the main problem is counting the public branches which can be many (336922 in this case).

The only solution left is the one Rob suggests: try to use stormrangefactory to avoid the counts altogether.

Revision history for this message
Martin Pool (mbp) wrote :

Thanks for fixing this: at the moment the udd roles have so many branches you can never get a full listing, and being able to see them will be helpful.

Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
Changed in launchpad:
status: In Progress → Fix Committed
Raphaël Badin (rvb)
tags: added: qa-ok
removed: qa-needstesting
Changed in launchpad:
status: Fix Committed → In Progress
Raphaël Badin (rvb)
tags: removed: qa-ok
Raphaël Badin (rvb)
tags: added: qa-ok
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
Raphaël Badin (rvb)
tags: added: qa-ok
removed: qa-needstesting
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-needstesting
removed: qa-ok
Changed in launchpad:
status: In Progress → Fix Committed
Revision history for this message
Launchpad QA Bot (lpqabot) wrote :
tags: added: qa-ok
removed: qa-needstesting
Raphaël Badin (rvb)
Changed in launchpad:
status: Fix Committed → In Progress
Revision history for this message
Raphaël Badin (rvb) wrote :

The new (simplified) menu has just been enabled in production.

https://code.launchpad.net/~ubuntu-branches is still heavy to generate but no timeout so far…

Revision history for this message
Martin Pool (mbp) wrote :

looks stable to me too. fixreleased?

Revision history for this message
Raphaël Badin (rvb) wrote :

Fix released indeed…

Changed in launchpad:
status: In Progress → Fix Released
Revision history for this message
Raphaël Badin (rvb) wrote :

The new menu made a branch listing on another page oops. The FF has been removed for now… back to in progress…

Changed in launchpad:
status: Fix Released → In Progress
Revision history for this message
Raphaël Badin (rvb) wrote :

The fix for the other bug has been released, the new menu is now enabled again.

Changed in launchpad:
status: In Progress → 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.