Priority-based batch scheduling
Dynamics 365 for Finance and Operations has evolved into purpose-built applications to help you manage specific business functions. For more information about these changes, see Dynamics 365 Licensing Guide.
In Platform update 31, you can turn on the Batch priority-based scheduling feature in Feature management. Priority-based scheduling decouples batch groups from the batch server. Instead, relative scheduling priorities are used to determine the order that tasks are run in across available batch servers.
This feature is available only in a restricted preview as part of Platform update 31.
A scheduling priority is defined for batch groups, but it can be overridden for specific batch jobs. The scheduling priority classifications are used to declare relative priorities, and to determine the processing order of jobs and business processes. The available values for the scheduling priority are Low, Normal, High, Critical, and Reserved capacity. Normal is the default value and is also applied to all existing batch groups when the feature is turned on. Reserved capacity represents the highest priority. In Platform update 32 and later versions, you can use it to dedicate reserved capacity for jobs. For more information, see the Set the batch reserved capacity section later in this topic.
Because the schedule priority is set to Normal for all existing batch groups when the feature is turned on, it's important that you plan and update the scheduling priority for each batch group so that it represents the relative priorities according to business requirements for the related batch jobs and their related business processes.
Platform update 32 includes upgrade support for existing batch jobs. For more information, see the Automatic batch group migration for batch jobs section later in this topic.
Priority-based batch scheduling requires that you turn on the Batch framework contention reduction feature in Feature management.
The following procedures explain how to work with batch groups, jobs, and tasks, when the Priority based batch scheduling feature is turned on.
Batch groups are now used only to logically group jobs and to set the default scheduling priority. Here are some examples of batch groups:
- Jobs that belong to a specific business process
- Jobs that have the same execution recurrence (for example every night, every week, or every month)
- Jobs that have the same priority
Create a batch group
- Go to System administration > Setup > Batch group.
- Select New to create a batch group.
- In the Group field, enter a unique name for the batch group.
- In the Description field, enter a value.
- In the Scheduling priority field, select the default scheduling priority for the batch jobs in the batch group.
- Select Save.
A batch job is a group of tasks that are submitted for automatic processing. Batch jobs are run by using the security credentials of the user who is selected in Run by field. Use the following procedure to create a batch job.
Create a batch job
- Go to System administration > Inquiries > Batch jobs.
- Select New to create a batch job.
- In the Job description field, enter a value.
- In the Scheduled start date/time field, enter a date and time.
- In the Run by field, select the users whose security credentials will be used when the batch job is run. For more information, see Batch manager security role.
- Optional: In the Monitoring category field, select a value to make it easier to identify the types of jobs during monitoring.
- Optional: Set the Critical job option to Yes. For more information, see Import users in bulk or Configure the Workflow message processing batch job as critical.
- In the Batch group field, select the batch group for the job.
- Optional: Set the Scheduling priority is overridden option to Yes, to make the Job scheduling priority field available.
- Optional: In the Job scheduling priority field, select a default priority that differs from the default priority that is defined for the batch group.
- Optional: In the Active period field, select the time range when the batch job can be run. For more information, see Active batch periods.
- Select Save.
Add a task to a batch job
On the Batch job page, in the Batch tasks section, select New.
In the Task description field, enter a value.
In the Company accounts field, select the company that the task will be run in.
In the Class name field, select the process to run. Classes appear in the list only if the CanGoBatchJournal property is turned on.
Expand the Batch task detail FastTab to add more settings for the batch task, or to add constraints.
On the General tab, set the Ignore task failure option to Yes to specify that failure of the task should not cause the job to fail.
In the Maximum retries field, specify the number of times that a task should be retried before it's considered to have failed.
Set the Private option to Yes if the task should be run only by the user who created the job. This option is applicable only to client tasks.
On the Constraints tab, select New if the execution of the selected task should be dependent on the status of a preceding task for the job.
In the Task ID field, select the preceding task.
In the Expected status field, select the status that the preceding task must reach before the current task can run.
If you enter more than one condition/constraint, and if all conditions must be met before the dependent task can run, select All as the condition type. If the dependent task can run after any of the conditions has been met, select Any as the condition type.
If the batch task supports input parameters, select Parameters, and then set task-specific parameters.
Select OK, and then select Save.
Go to System administration > Setup > System parameters.
On the Batch global settings tab, in the Batch reserved capacity level field, select the reserved capacity level to use for batch jobs that have Reserved capacity priority:
- No reserved capacity – This value is the default value.
- Low reserved capacity – Ten percent of the cumulative batch threads are reserved.
- Medium reserved capacity – Fifteen percent of the cumulative batch threads are reserved.
- High reserved capacity – Twenty-five percent of the cumulative batch threads are reserved.
Sample values are for the purpose of illustration only. The actual reserved capacity depends on the configuration of the batch server and the number of available batch threads at any given point.
Any reserved capacity is exclusive to batch jobs that have Reserved capacity priority. The reserved capacity won't be made available for batch jobs that have other priorities, even if there is idle reserved capacity.
A new internal system batch job, System job to clean up expired batch heartbeat records, cleans up the new BatchHeartbeatTable table. This batch job has the class name SysCleanupBatchHeartbeatTable. BatchHeartbeatTable is an internal monitoring table that is used to determine, configure, and distribute reserved capacity threads among online nodes.
After the feature is turned on, batch group information on the task is duplicated on the job that will be used. The batch group assignment on a job is based on the batch group that is most used for the tasks for the job.
A new system batch job, System job to seed batch group associations to batch jobs, manages the migration. This batch job has the class name SysMigrateBatchGroupsForPriorityBasedScheduling.
The batch job is run every day at 1:00 AM, even if the Batch priority-based scheduling feature is turned off. It migrates the delta of applicable batch jobs since the last execution.
The batch job is also run when the feature is turned on, to migrate any batch jobs since the last execution. The user who turned on the feature will receive a notification that includes a reference to the ID of the migration batch job.
We recommend that you review the automatic batch group assignment after the feature is turned on and the migration is completed. To facilitate this review, the Batch group field for tasks is read-only. To support backward compatibility, the value of this field will be propagated from the job when new batch tasks are added.