Bug 981022

Summary: [PERF] selinux module should require openshift-origin-common/config instead of openshift-origin-common
Product: OpenShift Online Reporter: Andy Grimm <agrimm>
Component: ContainersAssignee: Rob Millner <rmillner>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.xCC: bmeng, jgoulding, mfisher, mpatel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-22 15:20:47 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:

Description Andy Grimm 2013-07-03 19:37:26 UTC
openshift-origin-node/utils/selinux currently requires openshift-origin-common, but it appears to only need that for loading a config object.  Loading all of the requires in openshift-origin-common is expensive, and this translates to slower execution of scripts which should be fast, such as oo-trap-user and oo-get-mcs-level.  For comparison on a fairly idle system:

[agrimm ~]$ time oo-ruby -e 'require "openshift-origin-common"'

real	0m0.773s
user	0m0.344s
sys	0m0.340s
[agrimm ~]$ time oo-ruby -e 'require "openshift-origin-common/config"'

real	0m0.239s
user	0m0.111s
sys	0m0.081s

and on a busier one:

[agrimm lib]$ time oo-ruby -e 'require "openshift-origin-common"'

real	0m3.745s
user	0m0.411s
sys	0m0.511s
[agrimm lib]$ time oo-ruby -e 'require "openshift-origin-common/config"'

real	0m0.546s
user	0m0.133s
sys	0m0.148s

Comment 1 openshift-github-bot 2013-07-09 16:56:42 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/eae448337517199f018f8c38d7c0c159f88f8807
Bug 981022 - only load the parts of common that are needed.

Comment 2 Meng Bo 2013-07-10 05:15:47 UTC
Seems the bug is not easy to verify with normal test scenario.

Checked on devenv_3471, the selinux.rb require opneshift-origin-common/cofing instead of openshift-origin-common now.

#cat openshift-origin-node/utils/selinux.rb
<---->
require 'etc'
require 'selinux'
require 'find'
require 'openshift-origin-common/config'
require 'openshift-origin-node/utils/node_logger'
<---->