Uncached grp and pwd calls make duplicity slow with large group and passwd maps

Bug #1013446 reported by Steve Atwell
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned
duplicity (Ubuntu)
Fix Released
Medium
Chris J Arges
Precise
Fix Released
Medium
Chris J Arges
Quantal
Fix Released
Medium
Chris J Arges

Bug Description

With large /etc/group and /etc/passwd files, duplicity spends the vast majority of its time mapping group and user names to gids and uids. This is with duplicity 0.6.18-0ubuntu3 on Ubuntu 12.04 and Python 2.7.3.

I have a largish group map (7MB, with many group entries having lines in the 100KB - 200KB range.) A zero change incremental backup of ~200k files takes about 23 minutes.

Profiling the duplicity run shows that 92% of the time is spent calling grp.getgrnam! Another ~2% is spent calling grp.getgrgid, pwd.getpwnam, and pwd.getpwuid.

Some simple caching of caching of this information would make a big improvement.

--

SRU Justification:
[Impact]
 * This fix should be backported into Precise LTS because users of duplicity with large group/passwd files will encounter performance issues.

[Test Case]
 * Using a large group/passwd file configuration, perform a backup and record the time it takes to backup. Profile this as well and determine how much time is spent in grp.getgrnam. Compare this with the patched version and ensure improvement in performance.

[Regression Potential]
 * This is a backported patch, and is currently in the latest duplicity. However; because it is a new feature we will need to ensure backups work as expected with this patch.

Related branches

Jonathan Davies (jpds)
Changed in duplicity:
status: New → Fix Committed
Revision history for this message
Chris J Arges (arges) wrote :

Attached is a patch that backports this fix to precise.
A 64-bit build is available here for testing: http://people.canonical.com/~arges/lp1013446/

Changed in duplicity (Ubuntu):
importance: Undecided → Medium
Chris J Arges (arges)
description: updated
Revision history for this message
Steve Atwell (satwell) wrote :

Chris, the debdiff looks good to me. I tested 0.6.18-0ubuntu4 and it fixes the performance issue I was seeing with 0.6.18-0ubuntu3. Thanks!

Chris J Arges (arges)
Changed in duplicity (Ubuntu Precise):
importance: Undecided → Medium
status: New → Incomplete
status: Incomplete → In Progress
assignee: nobody → Chris J Arges (christopherarges)
Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.6.21
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank for the work Chris, we need the bug fixing in raring first before having it backported to precise though, could you work on that?

Chris J Arges (arges)
Changed in duplicity (Ubuntu):
assignee: nobody → Chris J Arges (christopherarges)
status: New → In Progress
Revision history for this message
Michael Terry (mterry) wrote :

Shouldn't this fix be proposed upstream to python?

Before this change, we had an exact copy of python 2.7's tarfile.py (with some changes to support python 2.4). Now we can't ever go back to a pure upstream tarfile.py.

And since the change seems to make sense for python itself too...

Revision history for this message
Chris J Arges (arges) wrote :

@mterry,
Seems reasonable, I can help out with this if needed.

For the time being it would still be good to have this in raring.
Is a debdiff for raring needed, or will the raring ubuntu package be synced anytime soon?

Revision history for this message
Iain Lane (laney) wrote :

I can apply the same patch to raring and then upload this SRU

Changed in duplicity (Ubuntu Quantal):
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package duplicity - 0.6.20-0ubuntu3

---------------
duplicity (0.6.20-0ubuntu3) raring; urgency=low

  * debian/patches/07caching.dpatch:
    - Backport caching work done by Steve Atwell, on behalf of Chris J Arges
    (LP: #1013446)
 -- Iain Lane <email address hidden> Tue, 11 Dec 2012 14:52:15 +0000

Changed in duplicity (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Chris J Arges (arges) wrote :

@laney
Thanks!

Chris J Arges (arges)
Changed in duplicity (Ubuntu Quantal):
assignee: nobody → Chris J Arges (christopherarges)
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :

This SRU was uploaded to the Precise queue it seems:

https://launchpad.net/ubuntu/precise/+queue?queue_state=1

Revision history for this message
Brian Murray (brian-murray) wrote :

I'm unsubscribing sponsors - please resubscribe them if and when there is a quantal debdiff to sponsor.

Revision history for this message
Chris J Arges (arges) wrote :

Attached is a version for a quantal SRU.

Revision history for this message
Steve Atwell (satwell) wrote :

Chris, it looks like there's a problem with the 0.6.18-0ubuntu4 package that was uploaded to the precise-proposed queue, as mentioned by Brian in comment #9.

It includes debian/patches/07caching.dpatch, but that patch wasn't added to debian/patches/00list, so it's not getting applied.

Revision history for this message
Chris J Arges (arges) wrote :

@satwell
Ok looks like the above quantal patch has this. I'll respin a patch for precise with this.

Revision history for this message
Chris J Arges (arges) wrote :

Here is a fixed debdiff that includes the proper addition to 00list for precise. Please SRU this patch instead.

Revision history for this message
Michael Terry (mterry) wrote :

I'll upload this again, bundling it up with an update I have for duplicity.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Steve, or anyone else affected,

Accepted duplicity into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/duplicity/0.6.19-0ubuntu2.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in duplicity (Ubuntu Quantal):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Steve, or anyone else affected,

Accepted duplicity into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/duplicity/0.6.18-0ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in duplicity (Ubuntu Precise):
status: In Progress → Fix Committed
Revision history for this message
Miklos Juhasz (mjuhasz) wrote :

I have tested the proposed package on my 12.04 (Precise) work desktop which has 93k files in my home. I measured the execution time of a backup without any change on the filesystem multiple times with both the current and the proposed duplicity. On average I experienced ~23% performance increase. I expect it would be even more if I had a larger group/passwd file. I also restored some files and folders, checked owners, permissions, checksums and no regression spotted.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package duplicity - 0.6.18-0ubuntu3.1

---------------
duplicity (0.6.18-0ubuntu3.1) precise-proposed; urgency=low

  [ Chris J Arges ]
  * debian/patches/07caching.dpatch:
    - Backport caching work done by Steve Atwell. (LP: #1013446)

  [ Michael Terry ]
  * debian/patches/08volcorruption.dpatch:
    - Fix some data-corruption issues when resuming an interrupted
      backup (LP: #1091269)
 -- Michael Terry <email address hidden> Fri, 11 Jan 2013 11:05:16 -0500

Changed in duplicity (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

duplicity (0.6.19-0ubuntu2.2) quantal-proposed; urgency=low

  * debian/patches/09volcorruption.dpatch:
    - Backport a fix for a restart test that caused FTBFS on armhf

 -- Michael Terry <email address hidden> Fri, 11 Jan 2013 13:59:19 -0500

duplicity (0.6.19-0ubuntu2.1) quantal-proposed; urgency=low

  [ Michael Terry ]
  * debian/patches/07u1utf8.dpatch:
    - Update with a fix for a UnicodeDecodeError crash (LP: #1080423)
  * debian/patches/09volcorruption.dpatch:
    - Fix some data-corruption issues when resuming an interrupted
      backup (LP: #1091269)

  [ Chris J Arges ]
  * debian/patches/08caching.dpatch:
    - Backport caching work done by Steve Atwell. (LP: #1013446)

 -- Michael Terry <email address hidden> Wed, 05 Dec 2012 16:39:01 -0500

Changed in duplicity (Ubuntu Quantal):
status: Fix Committed → Fix Released
Changed in duplicity:
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.