Bug 980497 - [PERF] Avoid expensive operations in oo-scheduled-jobs when there's no job to be run
[PERF] Avoid expensive operations in oo-scheduled-jobs when there's no job to...
Product: OpenShift Online
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Rob Millner
libra bugs
: UpcomingRelease
Depends On:
  Show dependency treegraph
Reported: 2013-07-02 10:16 EDT by Andy Grimm
Modified: 2016-11-07 22:47 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-22 11:19:50 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Andy Grimm 2013-07-02 10:16:47 EDT
In the run_user_scheduled_jobs function of oo-scheduled jobs, there are two function calls which run under conditions when they are not needed:  both setup_user_vars and setuppam should only be called in the same "if" block as daemon_as_user (and maybe those calls should even be moved into the daemon_as_user function).  Each call to setup_user_vars takes about 0.5 seconds of CPU time, and there are hundreds of these calls per hour, when most gears don't even use cron.
Comment 1 Rob Millner 2013-07-08 14:51:23 EDT
The setuppam call was unnecessary, I got rid of it.  We'll see what can be done to reorder the logic so that setup_user_vars is only called when needed.
Comment 2 Rob Millner 2013-07-09 23:05:57 EDT
Pull request.
Comment 3 openshift-github-bot 2013-07-10 06:41:00 EDT
Commit pushed to master at https://github.com/openshift/origin-server

Bug 980497 - Optimize these calls to oo-get-mcs-level.
Comment 4 Meng Bo 2013-07-11 08:37:24 EDT
Test the oo-scheduled-jobs for specified gear.

On last stage_ami:
#time oo-scheduled-jobs run-user cbb668daea2511e2922622000aa43988 1000

real	0m1.823s
user	0m0.495s
sys	0m0.161s

On latest devenv_ami:
#time oo-scheduled-jobs run-user 591008146458654193745920 1000

real	0m0.167s
user	0m0.075s
sys	0m0.079s

The run time reduced.

Move bug to verified.

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