Red Hat Bugzilla – Bug 980497
[PERF] Avoid expensive operations in oo-scheduled-jobs when there's no job to be run
Last modified: 2016-11-07 22:47:00 EST
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.
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.
Commit pushed to master at https://github.com/openshift/origin-server
Bug 980497 - Optimize these calls to oo-get-mcs-level.
Test the oo-scheduled-jobs for specified gear.
On last stage_ami:
#time oo-scheduled-jobs run-user cbb668daea2511e2922622000aa43988 1000
On latest devenv_ami:
#time oo-scheduled-jobs run-user 591008146458654193745920 1000
The run time reduced.
Move bug to verified.