This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 976855 - (client) version checks done at startup are very slow
(client) version checks done at startup are very slow
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
6.7
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: candlepin-bugs
John Sefler
:
Depends On:
Blocks: rhsm-rhel72
  Show dependency treegraph
 
Reported: 2013-06-21 12:17 EDT by Adrian Likins
Modified: 2015-07-22 02:51 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-07-22 02:51:48 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)
pycallgraph output showing client version loading info dominating time spent (33.47 KB, application/pdf)
2013-06-21 12:28 EDT, Adrian Likins
no flags Details

  None (edit)
Description Adrian Likins 2013-06-21 12:17:21 EDT
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 Adrian Likins 2013-06-21 12:27:34 EDT
(er, oops)

Description:

At startup, subscription-manager finds the version of subscription-manager and python-rhsm, and the version of the candlepin server it uses.

The client checks check the rpm database for the versions of the packages. This can be slow (~.75 secs or more). This is a blocking operation, and adds significant latency to the startup of the app.

For cli invocations especially, this can actually be the majority of the time spent in the application. 

See attached "pycallgraph-list-installed.pdf" for an example of the version checking taking .8s on startup. In this case, the entire invocation was only .9s, so the version check is the majority of the time spent in the application.


Possible fixes:

1. instead of checking rpmdb via it's api, just include the version strings into the python modules at build time. This would reduct the client version check time to almost nothing. 

2
Comment 2 Adrian Likins 2013-06-21 12:28:13 EDT
Created attachment 763909 [details]
pycallgraph output showing client version loading info dominating time spent
Comment 3 Bryan Kearney 2013-07-18 16:52:47 EDT
moving to rhel7
Comment 5 Bryan Kearney 2014-03-19 16:49:45 EDT
Moving bugs from 7.0 to 7.1
Comment 7 Bryan Kearney 2014-07-30 15:21:10 EDT
Acking 7.1
Comment 10 Devan Goodwin 2014-11-21 10:39:42 EST
Simple fix and good time savings. Devel ack.
Comment 11 Adrian Likins 2015-03-02 09:30:32 EST
in upstream master and versions >= 1.14.1-1

commit 1ba2d37da42b69c48b9034f7751c500f9422be46
Author: Adrian Likins <alikins@redhat.com>
Date:   Fri Jun 21 16:43:07 2013 -0400

    976855: populate a "version.py" at build time
    
    Instead of asking the rpm db for the versions
    of "subsciption-manager" and "python-rhsm", we
    generate a versions.py at build time with that
    info.
    
    "make set-versions" is the make target that
    does it. It will use VERSION from the env
    (the spec file passes this in), or if
    not specified, it will build one based
    on 'git describe'.
    
    This removes code that was on average spending
    about .5s every time we started up (including
    cli). This reduces it to basically nothing.
    
    This requires latest python-rhsm (>= 1.8.14-1)
Comment 14 Shwetha Kallesh 2015-05-08 08:45:45 EDT
Marking verified!!

With python-rhsm version < 1.8.14-1:

[root@hp-dl380pgen8-01 ~]# time subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.26.8-1
subscription management rules: 5.12
subscription-manager: 1.12.14-9.el6_6
python-rhsm: 1.13.8-1.el6

real	0m1.308s
user	0m0.364s
sys	0m0.060s



With python-rhsm version > 1.8.14-1:

[root@hp-dl380pgen8-01 ~]# time subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.26.8-1
subscription management rules: 5.12
subscription-manager: 1.14.6-1.el6
python-rhsm: 1.14.2-1.el6

real	0m1.084s
user	0m0.297s
sys	0m0.036s
Comment 15 errata-xmlrpc 2015-07-22 02:51:48 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://rhn.redhat.com/errata/RHBA-2015-1345.html

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