Parallel Replenishment Item Quantity and Out of Stock Calculations

In this article

Parallel calculation using NAS service tiers

Parallel calculation using background sessions

Parallel calculation using Job Queues with listener

Parallel calculation using Job Queues with Web Service

To track parallel calculation progress

See also

The calculation time of Out of Stock and Replenishment Item Quantity (RIQ) is directly dependent on the number of items, variants, and locations to be calculated. The calculation can be quite time consuming, if there are large numbers of items and locations involved.

The calculation performance can be improved using parallel calculation. The concept is to run the Out of Stock and RIQ calculation in parallel, where the items are split and shared across multiple sessions so that they are calculated in parallel to speed up the calculation of the process.

There are three approaches to set up the parallel calculation, either using NAS service tiers, background sessions or Job Queues. For the Job Queue approach, you can either start up the Job Queue entries via listener or Web Service.

Parallel calculation using NAS service tiers

In a classical setup, a NAS service tier is used to process a Scheduler job. In the parallel approach, more NAS are added so that the workload can be distributed among the additional services.

For more information on how to set up the parallel calculation for Out of Stock and RIQ using NAS service tiers, see Parallel Replenishment Calculation Memo (LS Central 20.0).pdf.

Parallel calculation using background sessions

With this approach, the system spins up multiple background sessions based on the parallel jobs configuration, and each background session processes a part of the entire item scope.

This approach is easy to set up but there is, however, an operational limit set by Microsoft for Business Central SaaS, where there are only maximum 10 background sessions per environment that can be processed at the same time in a server instance. Background sessions that come in when this limit is exceeded wait in a queue until a time slot becomes available. For more information, see Operational limits for Business Central online.

There are a few steps that you need to perform before you can run the Out of Stock and RIQ calculations in parallel using background sessions. This includes setting up the parallel processing Scheduler jobs and the master job that will monitor the parallel jobs.

To set up Scheduler Jobs for parallel processing

You need to set up multiple Scheduler jobs where each job processes a part of the entire item scope. To run the Out of Stock or RIQ calculation in parallel, at least two scheduler jobs need to be configured.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012200 (LSC Replen. - Calc. Qtys) or 10012203 (LSC Replen. Out of Stock Mgt.) depending on which process you want to calculate.

To set up Master Scheduler Job and Linked Jobs

You need to set up a master Scheduler job, which will spin up the background sessions and monitor the parallel processing Scheduler jobs. For each parallel processing job that is linked to the master job, the system spins up a background session which executes its respective linked job. The master job monitors and checks if all its linked jobs have completed their processes successfully.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012214 (LSC Replen. Parl. Master SaaS).
  4. Click Related - Job - Replenishment Parallel Jobs to open the Replen. Parallel Jobs page.
  5. Fill in the Master Job Timeout Duration (Min) field, which is the time in minutes that the master job should monitor the linked jobs before it times out. If it is assigned with zero, the master job will never time out.
  6. Fill in the Timeout Check Interval (Sec) field, which defines how frequently in seconds the master job should check if a timeout has occurred, for both master job and linked jobs.
  7. In the Linked Jobs FastTab, assign the parallel processing jobs to the master job by filling in the following fields:

    Field NameDescription
    Job IDThis field specifies the ID of the parallel linked job being assigned.
    Job Type CodeThis field shows the Scheduler Job Type Code assigned to the linked job.
    Share TypeThis field specifies how the item range will be distributed among the linked jobs. There are two available options:

    • Equal Weight
    • Manual Weight
    WeightThis field specifies the weight to be used to calculate the item range share percentage.

    • If Share Type Equal Weight is selected, when the Weight of one linked job is changed, the Weights of all the other jobs will be automatically updated with the same value.
    • If Share Type Manual Weight is selected, each of the linked jobs can be assigned with its individual Weight.
    Timeout (Min)This field specifies the time in minutes that the linked job should run before it times out. If it is assigned with zero, the linked job will never time out.
    % ShareThis field shows the workload distributed to each linked job, this is automatically calculated based on the Weights assigned.
    Job Filter StringThis field shows the range of items last processed by the linked job. The item range is calculated and assigned by the master job according to the Weight and % Share of the linked job. If Disable Balancing is enabled on the master job, the master job will no longer calculate the item distribution range and you can manually adjust the Job Filter String as needed.

To execute parallel calculation using background sessions

You can run the Out of Stock or RIQ calculation in parallel by executing the master Scheduler job (assigned with codeunit 10012214 LSC Replen. Parl. Master SaaS). The master job calculates and distributes the item range among the linked jobs based on their weights. If you wish to manually assign the item distribution range, you can enable the Disable Balancing setting in the Replen. Parallel Jobs page of the master job. With this setting enabled, the master job no longer distributes the item range for you and you can manually adjust the Job Filter String of the linked jobs.

For each linked job, the system creates a corresponding background session to process its respective item range.

Parallel calculation using Job Queues with listener

With the parallel calculation configured with the Job Queue approach, when the Out of Stock or RIQ calculation is initiated, the system creates multiple Job Queue entries based on the parallel jobs configuration, and each Job Queue entry processes a part of the entire item scope.

There are a few steps that you need to perform before you can run the Out of Stock and RIQ calculations in parallel using Job Queues with listener. This includes setting up the users that will start and run the parallel Job Queue entries, the parallel processing Scheduler jobs, the master job that will monitor the parallel jobs, and the Job Queue listener.

To set up Replen. Job Queue Users

You need to set up Replen. Job Queue Users to start and run the parallel Job Queue entries. Note that one user can only run a maximum of five Job Queue entries simultaneously. Therefore, you must set up more users in your environment if you want to run more than five parallel sessions. For example, if you want to run 10 parallel sessions, you must set up a minimum of two users where each user will pick up five parallel jobs.

  1. Click the icon, enter Replen. Job Queue Users, and select the relevant link.
  2. Create a new Replen. Job Queue User by clicking the New action.
  3. Enter a User Name, which corresponds to the user that will log in to the system.
  4. Enter a Description.

To set up Scheduler Jobs for parallel processing

You need to set up multiple Scheduler jobs where each job processes a part of the entire item scope. To run the Out of Stock or RIQ calculation in parallel, at least two Scheduler jobs need to be configured.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012200 (LSC Replen. - Calc. Qtys) or 10012203 (LSC Replen. Out of Stock Mgt.) depending on which process you want to calculate.
  4. Enable the Parallel Calc. with Job Queue setting.
  5. Select a Replen. Job Queue User in the Parallel Calc. Job Queue User field. This user will execute the Job Queue entry that is associated with this Scheduler job.

Note: Due to Microsoft's operational limit, you should only assign a user to a maximum of five Scheduler jobs to achieve maximum parallelism.

To set up Master Scheduler Job and Linked Jobs

You need to set up a master Scheduler job, which is used to create the Job Queue entries and to monitor the parallel processing Scheduler jobs. For each parallel processing job that is linked to the master job, the system creates a Job Queue entry that is assigned with the same user as the associated linked job. The master job monitors and checks if all its linked jobs have completed their processes successfully.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012214 (LSC Replen. Parl. Master SaaS).
  4. Enable the Parallel Calc. with Job Queue setting.
  5. Click Related - Job - Replenishment Parallel Jobs to open the Replen. Parallel Jobs page.
  6. Fill in the Master Job Timeout Duration (Min) field, which is the time in minutes that the master job should monitor the linked jobs before it times out. If it is assigned with zero, the master job will never time out.
  7. Fill in the Timeout Check Interval (Sec) field, which defines how frequent in seconds, the master job should check if a timeout has occurred, for both master job and linked jobs.
  8. Fill in the Maximum No. of Attempts to Run field, which specifies how many times a Job Queue of the linked job should be rerun after the Job Queue fails to run.
  9. In the Linked Jobs FastTab, assign the parallel processing jobs to the master job by filling in the following fields:

    Field NameDescription
    Job IDThis field specifies the ID of the parallel linked job being assigned.
    Job Type CodeThis field shows the Scheduler Job Type Code assigned to the linked job.
    Parallel Calc. Job Queue UserThis field shows the Replen. Job Queue User assigned to the linked job.
    Share TypeThis field specifies how the item range will be distributed among the linked jobs. There are two available options:
    • Equal Weight
    • Manual Weight
    WeightThis field specifies the weight to be used to calculate the item range share percentage.
    • If Share Type Equal Weight is selected, when the Weight of one linked job is changed, the Weights of all the other jobs will be automatically updated with the same value.
    • If Share Type Manual Weight is selected, each of the linked jobs can be assigned with its individual Weight.
    Timeout (Min)This field specifies the time in minutes that the linked job should run before it times out. If it is assigned with zero, the linked job will never time out.
    % ShareThis field shows the workload distributed to each linked job, this is automatically calculated based on the Weights assigned.
    Job Filter StringThis field shows the range of items last processed by the linked job. The item range is calculated and assigned by the master job according to the Weight and % Share of the linked job. If Disable Balancing is enabled on the master job, the master job will no longer calculate the item distribution range and you can manually adjust the Job Filter String as needed.

To set up Job Queue listener

You need to set up a Job Queue entry for each Replen. Job Queue User, which will act as a listener to start and run their respective parallel Job Queue entries assigned with the same user.

  1. Click the icon, enter Job Queue Entries, and select the relevant link.
  2. Create a new Job Queue Entry by clicking the New action.
  3. In the General FastTab, select Codeunit in the Object Type to Run field, and assign the Object ID to Run with 10012228 (LSC Start JQ with Listener).
  4. Fill in the fields in the Recurrence FastTab as needed, which define the recurring and frequency settings of the Job Queue listener.
  5. Click the Set Status to Ready action to activate the Job Queue listener. Note that each user must log in to the system to set their respective Job Queue listener to Ready.

To execute parallel calculation using Job Queues with listener

You can run the Out of Stock or RIQ calculation in parallel by executing the master Scheduler job (assigned with codeunit 10012214 LSC Replen. Parl. Master SaaS). The master job calculates and distributes the item range among the linked jobs based on their weights. If you wish to manually assign the item distribution range, you can enable the Disable Balancing setting in the Replen. Parallel Jobs page of the master job. With this setting enabled, the master job will no longer distribute the item range for you and you can manually adjust the Job Filter String of the linked jobs.

For each linked job, the system creates a corresponding Job Queue entry to process its respective item range. The Job Queue listeners activate their respective parallel Job Queue entries assigned with the same user. Once the calculations are done for all the parallel Job Queue entries, they are removed from the system.

Parallel calculation using Job Queues with Web Service

With the parallel calculation configured with the Job Queue approach, when the Out of Stock or RIQ calculation is initiated, the system creates multiple Job Queue entries based on the parallel jobs configuration, and each Job Queue entry processes a part of the entire item scope.

The steps to set up the parallel Out of Stock and RIQ calculations using Job Queues with Web Service are similar to the listener approach. However, instead of setting up listeners to start the Job Queue entries, the Job Queue entries are executed by Entra Application Users via Web Service.

To set up an Entra ID App

Microsoft Entra ID is a cloud-based identity and access management solution. See How to: Set Up an Entra ID App for more information about how to register an Entra ID App in the Microsoft Azure portal.

To set up Entra Application Users

You need to create Entra Application Users that will be used to start and run the parallel Job Queue entries. See How to: Create the External Application Account in LS Central for more information about how you can create Entra Application Users in LS Central.

To set up Replen. Job Queue Users

You need to set up Replen. Job Queue Users to start and run the parallel Job Queue entries. Note that one user can only run a maximum of five Job Queue entries simultaneously. Therefore, you must set up more users in your environment if you want to run more than five parallel sessions. For example, if you want to run 10 parallel sessions, you must set up a minimum of two users where each user will pick up five parallel jobs.

  1. Click the icon, enter Replen. Job Queue Users, and select the relevant link.
  2. Create a new Replen. Job Queue User by clicking the New action.
  3. Enter a User Name, which corresponds to the Entra Application User's User Name.
  4. Enter a Description.
  5. Enable the Is Entra Application setting and select the relevant Entra App Client ID.
  6. Fill in the Entra App Secret field with the client secret value that you copied during the Entra ID App registration in Microsoft Azure portal.

You can test the web service connection of the Entra Application Users based on their Entra App Client ID and Entra App Secret configuration, by using the Test Connection (Current User) and Test Connection (All Entra Users) actions.

To set up Scheduler Jobs for parallel processing

You need to set up multiple Scheduler jobs where each Scheduler job processes a part of the entire item scope. To run the Out of Stock or RIQ calculation in parallel, at least two Scheduler jobs need to be configured.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012200 (LSC Replen. - Calc. Qtys) or 10012203 (LSC Replen. Out of Stock Mgt.) depending on which process you want to calculate.
  4. Enable the Parallel Calc. with Job Queue and Parallel Calc. Run Job Queue with WS settings.
  5. Select a Replen. Job Queue User in the Parallel Calc. Job Queue User field. This user will execute the Job Queue entry that is associated with this scheduler job.

Note: Due to Microsoft's operational limit, you should only assign a user to a maximum of five Scheduler jobs to achieve maximum parallelism.

To set up Master Scheduler Job and Linked Jobs

You need to set up a master Scheduler job, which is used to create the Job Queue entries and to monitor the parallel processing Scheduler jobs. For each parallel processing job that is linked to the master job, the system creates a Job Queue entry that is assigned with the same user as the associated linked job. The master job monitors and checks if all its linked jobs have completed their processes successfully.

  1. Click the icon, enter Scheduler Job List, and select the relevant link.
  2. Create a new Scheduler Job by clicking the New action.
  3. In the Object Setup FastTab, select Codeunit in the Object Type field, and assign the Object No. with 10012214 (LSC Replen. Parl. Master SaaS).
  4. Enable the Parallel Calc. with Job Queue and Parallel Calc. Run Job Queue with WS settings.
  5. Click Related - Job - Replenishment Parallel Jobs to open the Replen. Parallel Jobs page.
  6. Fill in the Master Job Timeout Duration (Min) field, which is the time in minutes that the master job should monitor the linked jobs before it times out. If it is assigned with zero, the master job will never time out.
  7. Fill in the Timeout Check Interval (Sec) field, which defines how frequent in seconds, the master job should check if a timeout has occurred, for both master job and linked jobs.
  8. Fill in the Maximum No. of Attempts to Run field, which specifies how many times a Job Queue of the linked job should be rerun after the Job Queue fails to run.
  9. In the Linked Jobs FastTab, assign the parallel processing jobs to the master job by filling in the following fields:

    Field NameDescription
    Job IDThis field specifies the ID of the parallel linked job being assigned.
    Job Type CodeThis field shows the Scheduler Job Type Code assigned to the linked job.
    Parallel Calc. Job Queue UserThis field shows the Replen. Job Queue User assigned to the linked job.
    Share TypeThis field specifies how the item range will be distributed among the linked jobs. There are two available options:

    • Equal Weight
    • Manual Weight
    WeightThis field specifies the weight to be used to calculate the item range share percentage.

    • If Share Type Equal Weight is selected, when the Weight of one linked job is changed, the Weights of all the other jobs will be automatically updated with the same value.
    • If Share Type Manual Weight is selected, each of the linked jobs can be assigned with its individual Weight.
    Timeout (Min)This field specifies the time in minutes that the linked job should run before it times out. If it is assigned with zero, the linked job will never time out.
    % ShareThis field shows the workload distributed to each linked job, this is automatically calculated based on the Weights assigned.
    Job Filter StringThis field shows the range of items last processed by the linked job. The item range is calculated and assigned by the master job according to the Weight and % Share of the linked job. If Disable Balancing is enabled on the master job, the master job will no longer calculate the item distribution range and you can manually adjust the Job Filter String as needed.

To publish the Web Service that starts the Job Queues

You need to set up and publish the Web Service that will be used by the Entra Application Users to start and run the parallel Job Queue entries.

  1. Click the icon, enter Web Services, and select the relevant link.
  2. Create a new Web Service by clicking the New action.
  3. Select Codeunit in the Object Type field, and assign the Object ID with 10012222 (LSCStartJobQueueAPI).
  4. Fill in the Service Name field with LSCStartJobQueueAPI and select the Published check box.

To execute parallel calculation using Job Queues with Web Service

You can run the Out of Stock or RIQ calculation in parallel by executing the master Scheduler job (assigned with codeunit 10012214 LSC Replen. Parl. Master SaaS). The master job calculates and distributes the item range among the linked jobs based on their weights. If you wish to manually assign the item distribution range, you can enable the Disable Balancing setting in the Replen. Parallel Jobs page of the master job. With this setting enabled, the master job no longer distributes the item range for you and you can manually adjust the Job Filter String of the linked jobs.

For each linked job, the system creates a corresponding Job Queue entry to process its respective item range. The Entra Application Users activate their respective parallel Job Queue entries assigned with the same user via the web service. Once the calculations are done for all the parallel Job Queue entries, they are removed from the system.

To track parallel calculation progress

During the Out of Stock or RIQ calculation, you can monitor how many items have been processed by each linked job.

To enable this feature:

  1. Click the icon, enter Replen. Setup, and select the relevant link.
  2. In the General FastTab, enable the Track Progress in OOS Child Jobs or Track Progress in RIQ Child Jobs setting, depending on which process you want to monitor.
  3. Fill in the Item Counter Interval field, which specifies how frequent the item counter will be updated.

During the calculation, to monitor the progress:

  1. Click the icon, enter Scheduler, and select the relevant link.
  2. Filter the page to view the linked Scheduler jobs.
  3. The progress of how many items have been calculated so far compared to the total number of items is shown in the Last Message Text field of the respective linked jobs.

See also

Parallel Replenishment Calculation

Replenishment Out of Stock Days

Calculation of Replenishment Item Quantity