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.
Pull request. https://github.com/openshift/origin-server/pull/3030
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/b60e7e11f8c9c1e8b812bcb77d817c9a3fcca9e6 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 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.