Allowing a Job to Specify Thread Pool
- Updated on 05 Mar 2019
- 2 minutes to read
By default, the job scheduler runs all jobs in the same queue. This means that only one job will run at a time. For example, if Job A is scheduled to run at 5:00 PM and Job B is scheduled to run at 5:10 PM, but Job A takes 20 minutes to complete, Job B will not actually begin running until 5:20 AM because it could not start until Job A had completed. The job scheduler works like this to protect the server from being inundated by too many jobs running at once. However, in some cases a user may want to override this default behavior and allow a job to run in a separate job queue, thus allowing it to run in parallel with other jobs.
There are many different types of jobs but all have the same option for configuring Queue Name . This setting is the same regardless of job type, this example will show how to change the Queue Name option on the Job Settings page. We will create five jobs to fully illustrate how to use Job Queues . Create five jobs scheduled to start at the same time. Configure their Queue names as follows.
Navigate to the System > Jobs and Events > Scheduled Jobs Folder in the Portal . Then, click New Ad Sync Job on the Folder Actions Panel.
For this example we create five New Ad Sync Jobs. Name first Job A, then, set up a Calendar for the Job and click Finish.
In the similar manner we add 4 more New Ad Sync Jobs.
Jobs A ad B are going to be in the Default Queue Pool. We select Job C and selectEdit [Advanced] option from the pop-up menu.
In the resulting window we locateAdvanced > Values section and in Override Job Queue Name text-box type My Queue Y . Click Ok to save and close this window.
Then, we Edit Job D...
In the Job Edit window we defineMy Queue Y value for the***Override Job Queue Name*** setting. Click Ok .
Finally, we Edit Job E.
For the Job E we define My Queue Z value for the Override Job Queue Name configuration. Click Ok to save.
If all these jobs are scheduled to start at 5 PM, three of the five jobs (Job A , Job C and Job E ) will actually start at that time because the jobs are in three different queues (Default pool, My Queue Y and My Queue Z). Because Job A is in the same pool as Job B , Job B will not begin until Job A has completed. Because Job C is in the same pool as Job D , Job D will not begin until Job C has completed. However, Job C will begin at the scheduled time because it in a different pool than Job A and Job B . Because Job E is in its own pool, it will start at the scheduled time regardless of which other jobs have also started at that time.