Bug 976855

Summary: (client) version checks done at startup are very slow
Product: Red Hat Enterprise Linux 6 Reporter: Adrian Likins <alikins>
Component: subscription-managerAssignee: candlepin-bugs
Status: CLOSED ERRATA QA Contact: John Sefler <jsefler>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.7CC: bkearney, dgoodwin, skallesh, wpoteat
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 06:51:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1121117    
Attachments:
Description Flags
pycallgraph output showing client version loading info dominating time spent none

Description Adrian Likins 2013-06-21 16:17:21 UTC
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 16:27:34 UTC
(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 16:28:13 UTC
Created attachment 763909 [details]
pycallgraph output showing client version loading info dominating time spent

Comment 3 Bryan Kearney 2013-07-18 20:52:47 UTC
moving to rhel7

Comment 5 Bryan Kearney 2014-03-19 20:49:45 UTC
Moving bugs from 7.0 to 7.1

Comment 7 Bryan Kearney 2014-07-30 19:21:10 UTC
Acking 7.1

Comment 10 Devan Goodwin 2014-11-21 15:39:42 UTC
Simple fix and good time savings. Devel ack.

Comment 11 Adrian Likins 2015-03-02 14:30:32 UTC
in upstream master and versions >= 1.14.1-1

commit 1ba2d37da42b69c48b9034f7751c500f9422be46
Author: Adrian Likins <alikins>
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 12:45:45 UTC
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 06:51:48 UTC
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