← Back to team overview

launchpad-dev team mailing list archive

recent improvements for analysing performance issues

 

A few things have gone live recently that make analysing performance
issues easier. I thought it might be useful to draw some attention to
them.

Firstly, OOPS reports now do substition of parameters in analyzing
repeated queries. This is why you see $INT in the longest query and
repeated query sections. The *actual* queries can be found down in the
simple list of actions, and ..

Secondly we do bind variable substition in OOPSes now, so the actual
queries are nearly directly testable on qastaging/staging by squad
leads. The only quirk, because we capture before the postgresql layer
serialises things, is that unicode strings will be u"foo" rather than
'foo' in the capture - just edit appropriately to make into raw sql,
and away you go.

Thirdly, there is a new test helper I'm landing at the moment -
BrowsesWithQueryLimit. This renders the default view for a page and
checks the query count is under your supplied limit. So scaling tests
can look like this:
+    def test_linked_bugs_series_branch_query_scaling(self):
+        # As we add linked bugs, the query count for a branch index page stays
+        # constant.
+        product = self.factory.makeProduct()
+        branch = self.factory.makeProductBranch(product=product)
+        browses_under_limit = BrowsesWithQueryLimit(54, branch.owner)
+        with person_logged_in(product.owner):
+            product.development_focus.branch = branch
+        # Start with some bugs, otherwise we might see a spurious increase
+        # depending on optimisations in eager loaders.
+        with person_logged_in(branch.owner):
+            self._addBugLinks(branch)
+            self.assertThat(branch, browses_under_limit)
+        with person_logged_in(branch.owner):
+             # Add plenty of bugs.
+            for _ in range(5):
+                self._addBugLinks(branch)
+            self.assertThat(branch, browses_under_limit)

Lastly, the ++profile++ page decorator now works on staging and
qastaging. Its not usable on production yet, but I'll be reevaluating
its suitability there once we're in purely single threaded mode.
logged profiles should be rsynced to devpad regularly - if they
aren't, let me know and I'll see what needs to happen to get them
rsynced frequently.

-Rob



Follow ups