supermirror_rewritemap.py optimization

Bug #85065 reported by Stuart Bishop
6
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
James Henstridge

Bug Description

We want to run this script multiple times per minute instead of once per hour.

It is currently too slow to do this. It is a very simple script, and the only real optimization that can be done is to prejoin the products table when selecting the list of all branches. This will mean the script is running a single query instead of a a few thousand.

Stuart Bishop (stub)
Changed in launchpad:
importance: Undecided → High
status: Unconfirmed → Confirmed
Revision history for this message
David Allouche (ddaa) wrote :

Raising importance to critical. Needed for low supermirror latency.

Changed in launchpad:
assignee: nobody → ddaa
importance: High → Critical
Revision history for this message
James Henstridge (jamesh) wrote :

I did a few tests against the launchpad_demo database. I did 20 runs of the supermirror_rewritemap.py script, which gave the following average timings:

    4.62 user, 0.30 system, 6.57 elapsed

Hacking the script to prejoin the branch product and owner gave the following average timings:
    4.59 user, 0.29 system, 6.51 elapsed

And removing the call that actually writes the map file (while leaving all the initialisation) gives the following:
    3.21 user, 0.24 system, 6.46 elapsed

So we are talking about a very marginal improvement here. Of course, these numbers don't tell the story of the work done by the database server: it would be doing a lot less work in the second two cases.

Revision history for this message
James Henstridge (jamesh) wrote :

I've submitted a branch to PQM that performs the prejoins, which reduces the script to a single DB query for the run. This should make Stuart happy, but doesn't address the overall performance (it is low enough that it could be run more than once an hour though).

David Allouche (ddaa)
Changed in launchpad:
assignee: ddaa → jamesh
Revision history for this message
Stuart Bishop (stub) wrote :

I can confirm jamesh's findings - this query is surpisingly slow!

I'll switch on the existing implementation twice per minute, so no need for a cherry pick.

Changed in launchpad:
importance: Critical → Medium
Revision history for this message
Stuart Bishop (stub) wrote :

I mean once per minute, not twice.

Revision history for this message
David Allouche (ddaa) wrote :

Thank you Stuart.

Revision history for this message
Christian Reis (kiko) wrote :

Do you mean surprising slow, really, Stuart?

Revision history for this message
James Henstridge (jamesh) wrote :

The change is committed to rocketfuel now as r3826.

I've also got a branch available to merge to production at jamesh/launchpad/rewritemap-prejoins-for-1.80 if you think it is worth cherry picking.

Changed in launchpad:
status: Confirmed → Fix Committed
Revision history for this message
Stuart Bishop (stub) wrote : Re: [Bug 85065] Re: supermirror_rewritemap.py optimization

Christian Reis wrote:
> Do you mean surprising slow, really, Stuart?

Yes. I was surprised how slow an apparently simple query ran and that
optimizations did not seem possible. Surprisingly slow.

--
Stuart Bishop <email address hidden> http://www.canonical.com/
Canonical Ltd. http://www.ubuntu.com/

Changed in launchpad:
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.