timeouts in Question:+edit

Bug #608037 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Critical
Unassigned

Bug Description

https://lp-oops.canonical.com/oops.py/?oopsid=1662O772

SQL time: 18142 ms
Non-sql time: 1566 ms
Total time: 19708 ms
Statement Count: 202

url - https://answers.launchpad.net/ubuntu/+question/118287/+edit doing a post to save changes.

one high cost thing we'll want to fix later:
163 705 4 701 session SELECT TeamParticipation.id, TeamParticipation.person, TeamParticipation.team FROM TeamParticipation WHERE TeamParticipation.person = %s AND TeamParticipation.team = %s
thats 163 probably redundant / irrelevant checks.

This is the culprit though:
17002.0 1 launchpad-main-master SELECT PublishedPackage.archive, PublishedPackage.binarypackagedescription, PublishedPackage.binarypackagename, PublishedPackage.binarypackagerelease, PublishedPackage.binarypackagesummary, PublishedPackage.binarypackageversion, PublishedPackage.build, PublishedPackage.component, PublishedPackage.datebuilt, PublishedPackage.distribution, PublishedPackage.distroarchseries, PublishedPackage.distroseries, PublishedPackage.distroseriesname, PublishedPackage.id, PublishedPackage.packagepublishingstatus, PublishedPackage.processorfamily, PublishedPackage.processorfamilyname, PublishedPackage.section, PublishedPackage.sourcepackagename, PublishedPackage.sourcepackagerelease, PublishedPackage.sourcepackagereleaseversion FROM PublishedPackage WHERE PublishedPackage.sourcepackagename = 'grub2' AND PublishedPackage.binarypackagename = 'grub2' AND PublishedPackage.distribution = 1 AND PublishedPackage.archive IN (1, 534) ORDER BY PublishedPackage.id DESC LIMIT 1

I'm going to guess we had contention or a load spike. I wonder if such queries :- querying data not part of the app - should always be coming from a slave?

Related branches

Revision history for this message
Robert Collins (lifeless) wrote :

https://pastebin.canonical.com/34874/
demonstrates the query, which is on a view, going boom inconsistently - and choosing a nuts plan when it goes boom.

Revision history for this message
Curtis Hovey (sinzui) wrote :

PublishedPackag has nothing to do with questions. I think there are two related issues here, and fixing them will address many other issues in Answers.

1. snapshots are looking at the prejoined collections that are not intrinsic to modifiled object. Adding
     doNotSnapshot
to the interface is easy to do. We added this to several registry objects.

2. Email is sent in proc. It would be nice to send all notifications via a job, but I think that is a lot of work.

Changed in launchpad-answers:
milestone: none → 10.08
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 608037] Re: timeouts in Question:+edit

Do you think we're having slow-queue issues with email? Perhaps we
could do dispatch in a thread out of transaction as an initial
starting point?

Revision history for this message
Curtis Hovey (sinzui) wrote :

I think the queue is fast. We send an email to every direct and indirect subscriber, and in the case of Ubuntu, that is 1000 of emails for every message or modification. I think part of the issues is that Answers is a successful application--we ignore it, it's user base grows, and it gets few bug reports. I think we we are seeing scaling issues that were not visible 3 years ago.

I think the iteration mechanism to expand emails to teams is slow. This is a common problem in launchpad. If we could build a notificationrecipientset is a single query to learn direct and indirect subscribers that also expands team subscriptions to individual users when needed, we could dramatically reduce the SQL query count. We mail also dramtatically increase the the SQL time though

Revision history for this message
Robert Collins (lifeless) wrote :

Ok yes, 1000's of users definitely wants to be out of transaction.
Will think on it.

Curtis Hovey (sinzui)
Changed in launchpad-answers:
milestone: 10.08 → 10.09
Curtis Hovey (sinzui)
Changed in launchpad-answers:
milestone: 10.09 → 10.10
Revision history for this message
Curtis Hovey (sinzui) wrote :

The target widget is calling guessPackageNames() to get source and binary packages hoping to locate a source package based on the name provided. The widget in this case already has a sourcepackagename; one that really is published in Ubuntu. The widget could check if the package has a released (because guessPackageNames is looking in SPPH for evidence that it was publishing in Ubuntu). This may be doable using a DSP. When the widget gets a binarypackagename, it could get the Ubuntu DSP.

The guessPackageNames() method implies that only distros built by soyuz can be selects.

/me tests on staging.

Wow. This is a disappointing experience. For baltix, which has enabled Answers, I can choose *any* source or binary package name, but the widget then errors because the package is not published in Baltix. Baltix will never have SPPH. Lp should not suggest bad data. Either is accepts the SPN that the vocab suggested or we do not allow non-soyuz distros to have answers. No user has reported an issue about this. Supporting this case is not important, but it should be clear it is not supported.

This is all very silly because distro Questions are really targeted DSPs. We do not have a vocabulary for DSPs because they do not have a DB backing because Lp does not know about non-soyuz distros. The schema does have a partial DSP table and there is the very complete distro package cache used for searching. Either of these would do a better job in the case of Ubuntu for providing a list of DSP that can be searched by source or binary name.

Revision history for this message
Robert Collins (lifeless) wrote :

So, I'm totally for use modelling other distros comprehensively enough
that a single code path for this sort of thing will work.

Curtis Hovey (sinzui)
Changed in launchpad-answers:
milestone: 10.10 → 10.11
tags: added: pg83
removed: oops
Curtis Hovey (sinzui)
Changed in launchpad-answers:
milestone: 10.11 → 10.12
Curtis Hovey (sinzui)
Changed in launchpad-answers:
milestone: 10.12 → series-future
Changed in launchpad:
importance: High → Critical
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: nobody → Curtis Hovey (sinzui)
status: Triaged → In Progress
milestone: none → 11.05
Curtis Hovey (sinzui)
tags: added: qa-ok
Changed in launchpad:
status: In Progress → Fix Committed
Curtis Hovey (sinzui)
Changed in launchpad:
status: Fix Committed → Fix Released
Curtis Hovey (sinzui)
Changed in launchpad:
assignee: Curtis Hovey (sinzui) → nobody
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.