Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1402423 - "hammer repository upload-content --path" redundantly non-performant against big repos
"hammer repository upload-content --path" redundantly non-performant against ...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Repositories (Show other bugs)
6.2.5
All Linux
high Severity high (vote)
: 6.2.9
: Unused
Assigned To: Justin Sherrill
jcallaha
: Performance, Triaged
Depends On: 1439840
Blocks: 1426401
  Show dependency treegraph
 
Reported: 2016-12-07 09:25 EST by Pavel Moravec
Modified: 2017-07-24 08:30 EDT (History)
9 users (show)

See Also:
Fixed In Version: tfm-rubygem-katello-3.0.0.115-1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1426401 (view as bug list)
Environment:
Last Closed: 2017-05-01 09:56:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
before dynflow (45.97 KB, image/png)
2017-04-19 13:34 EDT, jcallaha
no flags Details
after dynflow (36.89 KB, image/png)
2017-04-19 13:34 EDT, jcallaha
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 17691 None None None 2016-12-15 13:47 EST
Red Hat Product Errata RHBA-2017:1191 normal SHIPPED_LIVE Satellite 6.2.9 Async Bug Release 2017-05-01 13:49:42 EDT

  None (edit)
Description Pavel Moravec 2016-12-07 09:25:41 EST
Description of problem:
"hammer repository upload-content --path" command invokes for each and every RPM in the directory foreman task Actions::Katello::Repository::ImportUpload. That task consists of:

Actions::Pulp::Repository::ImportUpload
Actions::Pulp::Repository::DistributorPublish
Actions::Katello::Repository::FilteredIndexContent

dynflow sub-tasks.

Assume one uploads hundreds of RPMs in bulk action to a big repo. Then we call pulp sequence "upload RPM to repo, publish repo" 100times in a row.

If the repo is big in content, every publish can take tens of seconds. Redundantly, since another iteration of the loop will discard the published bits. This can even cause upload package failure per https://bugzilla.redhat.com/show_bug.cgi?id=1402415 .

Please ensure by either way that the DistributorPublish (and I expect FilteredIndexContent as well) is called just once, at the end of the bulk action. 

I file the BZ against hammer, though a change in hammer _and_ foreman/katello tasks needs to be done.


Version-Release number of selected component (if applicable):
tfm-rubygem-hammer_cli_katello-0.0.22.26-1.el7sat.noarch
Sat6.2.4


How reproducible:
100%


Steps to Reproduce:
1. Have a big repo (say RHEL6 base one)
2. Bulk upload many RPMs via "hammer repository upload-content --path /tmp/dir_with_many_rpms"
3. Count the time, check for potential failed uploads and for the time spent in individual DistributorPublish sub-tasks.


Actual results:
Huge time, some uploads might fail (if repo publish exceeds hammer timeout, see bz1402415 for reasoning), great deal of the time spent in DistributorPublish steps.


Expected results:
Substantially slower times, no faile uploads, DistributorPublish called just once at the end.


Additional info:
Idea of fix: add option "skip_publish" to Actions::Katello::Repository::ImportUpload and hammer sets it to true for all except the latest RPM upload. skip_publish=true will not trigger the 2 dynflow steps
Comment 3 Brad Buckingham 2016-12-15 13:47:50 EST
Created redmine issue http://projects.theforeman.org/issues/17691 from this bug
Comment 4 pm-sat@redhat.com 2017-01-25 10:08:36 EST
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17691 has been resolved.
Comment 7 pm-sat@redhat.com 2017-02-23 16:10:20 EST
Please add verifications steps for this bug to help QE verify
Comment 8 Bryan Kearney 2017-03-14 09:14:21 EDT
Justin, did I add the MR's correctly?
Comment 9 Justin Sherrill 2017-03-14 09:25:33 EDT
Yes thanks! looks like i forgot these two.
Comment 11 jcallaha 2017-04-18 09:11:26 EDT
time hammer -u admin -p changeme repository upload-content --id 2 --path .
Successfully uploaded file 'bef-foo-e4854-1-1.fc21.x86_64.rpm'.
Successfully uploaded file '8b8-foo-48a52-1-1.fc21.x86_64.rpm'.
...
Successfully uploaded file 'ac6-foo-6d830-1-1.fc21.x86_64.rpm'.
Successfully uploaded file '3b6-foo-7a7c8-1-1.fc21.x86_64.rpm'.
Publishing Repository.
[................................................................] [100%]

real	971m23.798s
user	9m14.737s
sys	0m41.055s
Comment 13 Justin Sherrill 2017-04-18 21:13:14 EDT
I'm not sure, i've not actually tried that many rpms, comparing to 6.2.8 would probably help (and i'd maybe try just 500 rpms for that comparison).
Comment 14 jcallaha 2017-04-19 13:33:28 EDT
Verified in Satellite 6.2.9 Snap 3.

In this version, there is a significant decrease in time required to upload multiple rpms into one repository. As you will see in the screenshots (attached) the new version skips the distributor publish. Also, you can notice that repo publishing occurs only after the last rpm is uploaded.

6.2.8

Successfully uploaded file '0dc-foo-cb183-1-1.fc21.x86_64.rpm'.
Successfully uploaded file '0dd-foo-7c0b2-1-1.fc21.x86_64.rpm'.
Successfully uploaded file '0dd-foo-cf700-1-1.fc21.x86_64.rpm'.

real    31m13.457s
user    0m29.723s
sys 0m2.309s


6.2.9 Snap 3

Successfully uploaded file '0dd-foo-7c0b2-1-1.fc21.x86_64.rpm'.
Successfully uploaded file '0dd-foo-cf700-1-1.fc21.x86_64.rpm'.
Publishing Repository.
[......................................................] [100%]

real    13m6.497s
user    0m30.406s
sys 0m2.325s
Comment 15 jcallaha 2017-04-19 13:34 EDT
Created attachment 1272689 [details]
before dynflow
Comment 16 jcallaha 2017-04-19 13:34 EDT
Created attachment 1272690 [details]
after dynflow
Comment 18 errata-xmlrpc 2017-05-01 09:56:51 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1191

Note You need to log in before you can comment on or make changes to this bug.