Current Position:Home > Can I control how often the scheduler wakes up?

Can I control how often the scheduler wakes up?

Update:11-30Source: network consolidation
Advertisement
We're experimenting with parallelizing long running jobs by breaking them up into smaller mutually exclusive jobs. The majority of the small jobs run in a subsecond timeframe. When I send these jobs to the job queue via dbms_job, I get respectable throughput -- along the lines of hundreds per second. When I converted this to run with dbms_scheduler, the throughput is horrible. It will run 12 jobs in subsecond timeframe but then not run the next set for 5 seconds (run 12, 5 seconds later run 12 more, etc.) even though there are many jobs queued up to run (hundreds). I seem to remember a way to govern how long the job queue processor "sleeps" in the dbms_job scenario although I can't seem to find it in the 10g documentation (going to check the 9i documentation next). Is there a way to configure the job scheduler similarly as to how long it should sleep after it runs a set of jobs?

The Best Answer

Advertisement
What version are you running?
There are 2 reasons why this is happening:
1)
To is designed to run jobs in max throughput, i.e it will throttle jobs to let the ones
that are running finish quicker. So it is a little conservative in scheduling jobs in parallel.
2) Scheduler works in conjunction with resource manager. Resource manager
throttles resource groups. If you have don't have resource manager running you will
effectively have a single consumer group. This also limits the number of jobs you can run in parallel.
To run many jobs in parallel you need to make a resource plan with many resource groups.
Example:
The following is an example how you can get 80 slaves to run (assuming cpu_count = 2)
alter system set resource_manager_plan = '';
grant create job to scott;
Rem Drop objects if they exist
connect scott/tiger
BEGIN
   for i in 0..19 loop
   for j in 0..3 loop       /* 2 + cpu_count jobs per class */
   begin
   DBMS_SCHEDULER.DROP_JOB(
      JOB_NAME => 'MANY_ACTIVE_JOBS_'||i||'_'||j);
   exception when others then null;
   end;
   end loop;
   end loop;
END;
connect / as sysdba
BEGIN
   for i in 0..19 loop
   DBMS_SCHEDULER.DROP_JOB_CLASS(
      JOB_CLASS_NAME => 'MANY_ACTIVE_JOBS_CLASS_'||i);
   end loop;
END;
BEGIN
   DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.DELETE_PLAN_CASCADE ('MANY_JOBS');
   DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
begin
   DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
  for i in 0..19 loop
  begin
    DBMS_RESOURCE_MANAGER.DELETE_CONSUMER_GROUP(
     CONSUMER_GROUP=>'many_active_jobs_group_'||i);
   exception when others then null;
  end;
  end loop;
  DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA;
end;
commit;
Rem --- END DROP OBJECTS
Rem -- CREATE OBJECTS
begin
   DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
  for i in 0..19 loop
  begin
    DBMS_RESOURCE_MANAGER.CREATE_CONSUMER_GROUP(
     CONSUMER_GROUP=>'many_active_jobs_group_'||i, comment=>'consumer group for job scheduling many active jobs');
   exception when others then null;
  end;
  end loop;
  DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA;
end;
commit;
BEGIN
   DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.CREATE_PLAN
      ('MANY_JOBS', 'PLAN TO SUPPORT MANY ACTIVE JOBS');
   for i in 0..19 loop
   DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
      PLAN => 'MANY_JOBS',
      GROUP_OR_SUBPLAN => 'many_active_jobs_group_' || i,
      COMMENT=>'none',
      CPU_P1 => 5
   end loop;
   DBMS_RESOURCE_MANAGER.CREATE_PLAN_DIRECTIVE(
      PLAN => 'MANY_JOBS',
      GROUP_OR_SUBPLAN => 'OTHER_GROUPS',
      CPU_P1 => 0,
      CPU_P2 => 100,
      COMMENT=>'Required'
   DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
   DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
END;
BEGIN
   for i in 0..19 loop
   DBMS_SCHEDULER.CREATE_JOB_CLASS(
      JOB_CLASS_NAME => 'MANY_ACTIVE_JOBS_CLASS_'||i,
      LOGGING_LEVEL => DBMS_SCHEDULER.LOGGING_FULL,
      LOG_HISTORY => 5,
      RESOURCE_CONSUMER_GROUP => 'MANY_ACTIVE_JOBS_GROUP_'||i
  end loop;
END;
BEGIN
  for i in 0..19 loop
  DBMS_RESOURCE_MANAGER_PRIVS.GRANT_SWITCH_CONSUMER_GROUP(
      'SCOTT','MANY_ACTIVE_JOBS_GROUP_'||i, TRUE);
  end loop;
END;
alter system set resource_manager_plan = 'MANY_JOBS';
connect scott/tiger
create or replace procedure call_fib(n number) is
i number;
begin
    if n = 1 then null; return; end if;
    if n = 2 then null; return; end if;
    if n = 20 then select 0 into i from dual; end if;
    call_fib(n-1);
    call_fib(n-2);
end;
show errors procedure call_fib;
BEGIN
   for i in 0..19 loop
   for j in 0..3 loop
   DBMS_SCHEDULER.CREATE_JOB(JOB_NAME => 'MANY_ACTIVE_JOBS_' || i || '_'||j,
      JOB_TYPE=>'PLSQL_BLOCK', JOB_ACTION=>'call_fib(23);',
      JOB_CLASS=>'MANY_ACTIVE_JOBS_CLASS_'||i,
      REPEAT_INTERVAL=>'FREQ=SECONDLY',
      ENABLED=>true);
  end loop;
  end loop;
END;
/
  • Can I control how often the scheduler wakes up? Update:11-30

    We're experimenting with parallelizing long running jobs by breaking them up into smaller mutually exclusive jobs. The majority of the small jobs run in a subsecond timeframe. When I send these jobs to the job queue via dbms_job, I get respectable th

  • Auto GR with Control Key or Prod.Scheduling Profile Update:11-30

    Hi PP champs As we can use both i.e. Control key and Production scheduling profile for activating the Auhto GR for prodcution order confirmation ..Can some one help me which is the more <b>preferred</b> or  which is considered first by the sys

  • Auto sleeping after scheduled wake!?? Update:11-30

    How do I prevent my Intel iMac from going back to sleep shortly after its scheduled wake? I have it scheduled to wake in the moring and sleep at 10pm. It is waking up to the login screen, which is what I want, but it then goes back to sleep if no act

  • Scheduled wake / lid closed Update:11-30

    Got my Macbook Pro yesterday, and I'm having a blast! One question about sleep and wake issues though, sorry for the n00b ignorance. I have a program that I'd like to kick off to run at 5 AM every day. (It's Isilox, an app that downloads pages from t

  • Control Center status running scheduled jobs stops when DB is shutdown Update:11-30

    I have scheduled jobs in the Control Center of OWB, and the status is "Running" (Green Arrow ->), but everytime we stop and start the database I have to start the schedule job again under Status. Is there any way to fix this so that when the

  • Is there a Scheduled Wake up (similar to Scheduled Start Up? Update:11-30

    I recently decide to let Backup run in the wee hours, so set them for 3, 3:15, and 3:30am. I don't shut down at night; I let the computer sleep (either via the Apple menu or automatically if I don't use it for 2 hours). While it's sleeping, of course

  • Task scheduler wake computer to run this task Update:11-30

    I can run any task manually or on schedule if the computer is awake, but the "wake computer to run this task" option does not work. The computer never wakes.Len, Other people have been experiencing the same problem since build 9926.  We can but

  • Scheduled wake doesn't work Update:11-30

    When I schedule a wake up at a certain time, it simply does not work. (Wake up is not password-protected.) I ran a test, setting a time for wake up a few minutes later, put my computer to sleep, waited, and nothing happened.I finally found the soluti

  • Schedule "wake up for iMac" Update:11-30

    When I try to set up a wake up or sleep time in preferences/energy saver/schedule/ ... no numbers appear in the far right box for either the sleep or wake up selections. When I click on the up or down arrows, they darken, but do not show any numbers

  • Schedule Wake up Update:11-30

    I'm trying to schedule my iMac 1.8 ghz w/ 10.4.111 to wake up for a back up overnight. I schedule the time in the energy saver panel, but it doesn't wake up. Any suggestions?followed those directions... restarted ... nothing has changed. Restored def