Multiple Scheduler services configuration

<< Click to Display Table of Contents >>

Navigation:  Automation Server > Automation Server configuration and administration guide > Initial project configuration > Best practices in the production environment >

Multiple Scheduler services configuration

Overview

Each Bizagi project needs an installed service called the Scheduler on its Automation Server.

The Scheduler is a Bizagi agenti which is in charge of performing system maintenance, offline and asynchronous tasks, and other jobs that run in the background and can be scheduled (set to run periodically).

When running your processes in a .NET platform, the Scheduler runs as a Windows service with its name refering to the specific project's name.

 

The Scheduler is supported in cluster configuration, to support load balancing of background tasks.

The following image illustrates a high availability Bizagi system architecture, involving a redundant Scheduler service:

 

Standard_scheduler_setup

 

However, for projects strongly relying on background processing, you can install and use more than one Scheduler service, whether by installing them on separate servers (cluster nodes), by installing them on the same server, or in a combination of these options:

 

Multiple_scheduler_setup

 

note_pin

When setting up multiple Scheduler instances, even if you have more than one service per node, we recommend that you set these up as independently as possible (each using its own dedicated server and resources).

This helps avoid single points of failure (a failure in one node, it does not affect more than one Scheduler instance).

For example, you may have separate servers running Scheduler services (if helpful for your project), independently of the Work Portal of Bizagi.

 

Why configure multiple Scheduler services?

By default each Bizagi project operates with one instance of the Scheduler service.

However, you can configure the use of multiple Scheduler services to work on a batch of background tasks in parallel.

This allows you to achieve either, or both of these advantages:

 

1. Configuration of a high availability system architecture.

In this setup you would have a Bizagi cluster for load-balancing capabilities, each node having Automation Server operational with its 2 main components: Bizagi Work portal (web application) and the Scheduler.

This way, your system architecture avoids single points of failure (should one node fail, the other continues operating avoiding service disruption).

For more information about setting up a Bizagi cluster refer to Clusters and server management.

 

2. Scalability of the Scheduler.

In some scenarios and depending on the specifics of the project's implementation, using more than one Scheduler service which processes the background tasks helps make sure that background tasks are not spending too much time in the queue.

According to your specific analysis of the number of tasks that the Scheduler needs to process at one time(i.e sizing), and their expected SLAs, you could install and configure more than one Scheduler within the same server, without the need to do the same for the Work Portal (scaling out only the Scheduler).

 

Before you start

The steps described below, part from your project has already been set up (Automation Server properly configured, whether in a cluster or in a single-server system architecture).

Note that though the multiple Scheduler services will distribute the load of background tasks between them:

 

1. Only one Scheduler performs system maintenance

System maintenance carried out by the Scheduler involves moving information from transactional tables in the database and should be carried out during non-working or off-peak hours.

When the system has multiple Schedulers, define which Scheduler will be in charge of performing system maintenance so that you can configure it as a "master" Scheduler.

 

2. Each Scheduler takes a batch of ten tasks

When a Scheduler service is ready to process tasks (according to the Scheduler interval definition, set as described in Bizagi parameters configuration), it will lock a batch of ten tasks even though it will work on one at a time, and it is uncertain how much time will it take to process the first one or the complete batch.

Each batch of ten tasks, and background tasks processed by the Scheduler in general, follow a FIFO priority algorithm (a First in, First out queue).

This implies that if the number of incoming tasks to process at a given moment (in a very short period of time), does not exceed ten, then it is likely that additional Scheduler service will not balance the load between them.

 

What you need to do

To configure multiple Scheduler services, carry out these steps:

 

1. Install your additional Scheduler services

Do this either through the Management Console clustering options or through manual installation.

There are special naming considerations to take into account when installing multiple Scheduler services on a single server.

 

2. Configure additional Scheduler services

Only one Scheduler is designated to perform system maintenance.

Additional configuration oriented to the number of threads run by each Scheduler is optional to optimize parallelism.

 

Procedure

Follow the steps below.

 

1. Install your additional Scheduler services

Create additional Scheduler services through the Management Console clustering options when creating a first Scheduler service in a given server.

To view more information about setting up a Bizagi cluster that already includes an additional Scheduler, refer to Clusters and server management.

 

If you are installing multiple Scheduler services in a same server, carry out the following:

 

1.1 Create a copy (clone) of the Scheduler folder.

Copy, paste and rename the folder located by default at C:\Bizagi\Projects\[your_project]\Scheduler\.

Do this for each additional Scheduler service you require in that server.

In this example, we want to have three services on the server:

 

Schedulers_Folder

 

1.2 Edit the .bat files inside of the new Scheduler folders.

As a best practice, edit all .bat files to render them ready when needed.

 

Schedulers_bats

 

Edit install.bat, installx64.bat, uninstall.bat and uninstallx64.bat by changing the name of the Scheduler service so that it is unique within that same server:

 

Schedulers_install

 

In this example we are using the same root name, with a numbering suffix.

For service number three, we have:

 

Schedulers_installother

 

Save your changes when done.

 

1.3 Run the installx64.bat (or install.bat if applies) file to install each new Scheduler service.

Click the installation .bat file for your server's architecture to install the service.

Do this for each additional Scheduler service you want to install.

Do this with administrator rights and confirm that you get a successful execution:

 

Schedulers_installed

 

In the end, you should see your additional Scheduler services installed and listed among your Windows services:

 

Schedulers_services

 

Do not start the multiple services at this point, as you need to edit their configurations first.

 

2. Configure the additional Scheduler services

Define which Scheduler services will perform maintenance tasks.

Review all of your Scheduler services within the solution (only one among all nodes you may have in a cluster, including multiple services you may have in each node).

 

You can call that one the "master" Scheduler, it does not not require further configuration.

For all other Scheduler services, edit their .config file located by default at C:\BIZAGI\PROJECTS\[your_project]\SchedulerN3\BizAgi.Scheduler.Services.exe.config, to include the following key  in the <appSettings> element:

<add key="DisableAsynchCaseClosing" value="1"/>

 

Schedulers_slaves

 

note_pin

When configuring more than one Scheduler service in the same node, you must change the location of the temporary folder used by each Scheduler instance (this avoids issues that may arise when multiple services try to access the same files simultaneously).

To specify a different temporary folder for reach Scheduler instance, edit the Project key by ensuring you use non-repeated, different values in each configuration file.

For example, for two instances in a single node:

<add key="Project" value="Scheduler1" /> and <add key="Project" value="Scheduler2" />.

 

At this point you can save your changes and then start up each Scheduler service (an error-free start-up validates that all of them will work together):

 

Schedulers_startup

 

Considerations when using Asynchronous Activities

As an additional configuration, you may tune the Schedulers processing parameters by including the following key in their .config file (in the <appSettings> element) to configure the number of threads each Scheduler service will use:

<add key="MaxThreadsForAsynchWorkitems" value="[number_of_threads]"/>

This key is especially useful when your project may handle a large number of asynchronous tasks executions, incoming in large blocks.

 

note_pin

When modifying the number of threads used by a Scheduler service (by default it uses one), consider an appropriate balance between the number of Scheduler services you will be using and the number of threads each one runs in parallel.

 

Modifying this value should be properly analyzed and tested, according to your project's estimated number of background tasks, the characteristics and estimated processing involved in each of these tasks, and, most importantly, according to the characteristics of the underlying hardware (i.e number of cores and processors in your servers).

We recommend that you monitor this value and tune it as needed while carrying out proper acceptance tests for this scenario to use the most accurate distribution.

 

When you use multiple Scheduler services to process multiple Asynchronous Activities, we recommend that you include the following key:

<add key="DisableInterfaceErrorLogger" value="1"/>

 

This key optimizes performance since it skips logging to the .csv file for thresholds and timeouts, and it avoids potential issues when having multiple services writing into the same file.

 

Important notes

Acknowledge that when having multiple Scheduler services, all of these services should be stopped before performing a process deployment.

Similarly, with this setup, consider your multiple Scheduler services when upgrading your Bizagi version.