Scheduler
The purpose of the Perfion Scheduler is to execute Actions at certain points in time.
For knowledge on actions, please see Action.
Installing the Scheduler
The Scheduler can be installed either as a Windows Service or as a Console App. This means, that the scheduler is a “server process” and will run despite that all Perfion Clients in some installation are shut down.
Both versions work exactly the same. Perfion recommends installing it as a service, since it is simpler to set up a service so that it restarts with the server.
NOTE: The scheduler treats all file/directory paths in actions as “local” references. If you create an action that includes a reference to C:\[something], the scheduler will use the C-drive on the server where it is installed. Best practice is to use UNC paths (\\server\[something]) in actions.
Installing as a Console App
These are the steps to install the Scheduler as a Console App
Find a suitable server for running the Scheduler. It can be any Windows Computer having the .net 4.0-framework installed and being able to reach the Perfion Database
Obtain the zip-file from the Perfion Knowledge Base.
Unzip the contents of the zip-file to the folder on the chosen server, in which you want to install the scheduler.
Open the file named Perfion.Scheduler.ConsoleApp.exe.config (not Perfion.Scheduler.Service.exe.config) and edit the connection string so that it connects to the correct database.
Start the Perfion.Scheduler.ConsoleApp.exe (not Perfion.Scheduler.Service.exe)
NOTE: A single scheduler can only schedule tasks for one Perfion Database. If you have more Perfion Databases you need to install a scheduler per database.
The final step will launch the scheduler as a console app. It looks like shown in the figure below:
If you get an error message when launching it, please check your database connection string again. If problem persists, please create a support ticket.
The ConsoleApp can be stopped by clicking “return”-key in the windows after which the window closes.
Installing as a Service
These are the steps to install the Scheduler as a Service:
Do steps 1-3 as when installing as a Console App.
NOTE: A scheduler can only schedule actions for one Perfion Database. Since a service can only be installed once per machine and since the scheduler can only schedule actions for one Perfion Database, you should run Console Apps to schedule actions residing in additional databases.
Open the file named Perfion.Scheduler.Service.exe.config (not Perfion.Scheduler.ConsoleApp.exe.config) and edit the connection string so that it connects to the correct database.
Open a Command-prompt as an administrator and navigate to the installation folder.
Type the command: InstallUtil.exe "Perfion.Scheduler.Service.exe"
Assuming this succeeds, the scheduler is installed and only needs to be started.
Open the Services-Window and find the Scheduler service which is named Perfion Scheduling Service
Double-click it to edit it and do the following two changes:
Set startup to “Automatic” assuming you want the service to start with the server.
Click “Start” to start it now
This should make the service go into status “running” as shown in the screenshot below:
If you have problem getting it to run, please check the connection string in the config-file. If you cannot figure out what the problem is, you can copy its content to the config-file for the console app and see what error message you get from the console app.
Upgrading Service
Upgrading the Scheduler Service is simple.
Download new version of Perfion Scheduler
MAKE SURE to Unblock the zip file before extracting content
Stop the Perfion Scheduler in Services
Overwrite existing files in the installation folder with the Perfion Scheduler files
Restart the Perfion Scheduler Service
Uninstalling Service
Uninstalling the Scheduler Service is simple.
Stop the Perfion Scheduler in Services
Open a Command-prompt as an administrator and navigate to the installation folder
Type the command: InstallUtil.exe /u "Perfion.Scheduler.Service.exe"
Exit Command-prompt and delete the installation folder
Scheduler window
The purpose of the scheduler is indeed to schedule actions to run at certain points in time. This chapter will take you through scheduling an action to run.
In order to access the scheduler-window you need to have Actions installed. Furthermore, you must have the role “Can edit schedules” or be a super user or an administrator.
With this in place you can go to “Tools” and click “Scheduling” which will take you to the Scheduler Main Window:
On top you have the main menu, on the left you have a folder structure allowing you to create folders to structure your scheduled actions, in the middle you have the Scheduled Actions (one named My Export at the moment), and at the bottom you have a log showing you everything the currently selected scheduled action has done.
The Menu-items (reading from left to right) are as following:
New: Creates a new scheduled action and opens it in the edit window
Edit: Edits the currently selected scheduled action.
Delete: Deletes the currently selected scheduled action.
Refresh: Refreshes all lists (Folders, Actions and Log)
Auto refresh: This is a toggle (when enabled, the background is blue as in the above screen shot): Schedule Actions and Log is refreshed periodically (default every 5 seconds).
Start: Starts the currently selected action.
Stop: Attempts to stop the selected action. This only has effect if the selected action has Status = Running. If the selected action is currently running a long-running Action-command it will not stop before that command has been completed.
Log: This is also a toggle: When enabled the log table bottommost is shown.
Settings: This takes you to the settings dialog where various settings regarding the scheduler and this window can be found.
Creating a Scheduled Action
To create a Scheduled Action click “New” and a new Task will be created and opened in the Scheduled Task Editor:
As can be seen we here have 3 pages with information:
General tab
Name: Here you can give your scheduled action a name. Names need not to be unique, but in order to be distinguishable it is a good idea with a telling and unique name.
Action to execute: Here you must pick the action to run.
Log every X command: This is mainly for debug-purposes. Enabling this will log all Action Commands carried out.
Description: This is an optional description of the Scheduled Action.
Enabled: Here you can choose to enabled/disable your scheduled action.
Disabled simply means, that the Scheduled Action will not be executed automatically, but it may still be started manually by clicking Start in the main window.
Action Settings
Execute an action: Select the action to execute and the log level.
Update Widget: Select the Dashboard Widget to update.
Delete old log entries: Delete logs in the Feature Data Log older than x days.
Update Database Statistics: See SQL Server documentation for the Update statistics
Rebuild Database Indexes: See SQL Server documentation for the Rebuild indexes
Synchronize inactive Active Directory users:
Triggers tab
In this tab you control what triggers the scheduled action, i.e. executes the action. Currently you can only trigger a scheduled action by a scheduler, but in a later version of Perfion it could be possible to trigger an action when an item changes, a certain user logs in to Perfion etc.
So right now, there can only be one trigger in the list and that trigger can only be an “On a Schedule”-trigger, that is, something that triggers the action at a certain point (or certain points) in time.
On the triggers tab, click the New-button, which opens the “Edit trigger”-window as shown below:
As can be seen, the trigger is “On a schedule” and that cannot be changed until Perfion supports other kinds of triggers. When a trigger is “On a schedule” you can pick when a Scheduled Action should execute its action. There are different kinds of frequencies to pick from (Hourly is picked in the screenshot above).
All scheduled actions have a start, which designates that first time it should be executed. In most cases it will run more than once determined by the selected frequency. Each possible frequency is described below:
Run once: When picked the action will only be executed once (at picked start time). After that, it will never be executed again (unless start time is edited or action is started manually). This is the only frequency where theaction is only executed once.
Minutely: This will execute the action every x’th minute. Here you have the additional option to specify an interval in which to run (f.x. from 8.00 to 16.00).
Hourly: Same as for minutes, except that you specify the interval between.
Daily: Action will run every X day at a time you choose
Weekly: Action will run on selected weekdays every X week
Monthly: Action will run in selected months on specified dates or weekdays
Note the list of the first 100 run times. This list shows the first 100 times the Scheduled Action will be executed. This can be helpful if you are in doubt of when the scheduler intends to execute the action with the current values of the frequency and its associated controls. Looking at the shot screenshot above, the action is set to execute at 11:00 and hereafter every 2 hours, but only from 9:00 to 18:00. This means that at the time of writing (which is April 12, 2023) it will only run at 11:00, 13:00 and 15:00 before starting again tomorrow, April 13 at 9:00 and continue. Note that, if this list is empty you have specified a schedule that is either erroneous or does not have any future run times (using frequency “Run once” at a day in the past).
Settings tab
In this tab you can select whether the action should attempt to restart if it fails. You can specify how many retry attempts should be made and at what interval.
Best practices
A few best practices when creating scheduled actions.
Schedule large import jobs to only run at night (as they can affect performance for users)
Avoid scheduling two or more import jobs with same run times
Schedule frequently running actions (minutely, hourly) to only run at day time (to avoid conflicts with large import jobs running at night)
System Tasks
Besides executing an Action, the scheduler can execute various System Tasks that mainly are concerned with maintaining or updating the Perfion installation. In this section the various System Tasks will be described.
Update Widget
To be written
Check for updated license
To be written
Delete old log entries
When the “Logging”-functionality is enabled in “Settings”, all changes to Items and Specs and optionally also Binaries are logged in the Perfion database. With this logged data users get the three functionalities: “Recycle bin”, “Previous values“-dialog and the “Log Viewer”.
Changes logged are generally kept forever. The “Delete old log entries”-task, however, is capable of cleaning up old log-entries in order for the database not to grow too big.
When this action is picked, it has two settings:
Delete log entries older than: As the name suggests, you can here pick how old data should be in order for the Task to clean it up. The default is 30 days.
Command Timeout: This controls how much time (in seconds) you allow the database to spend on cleaning up task logs per command it needs to invoke. 300 seconds, which is the default, should be enough in most cases. You may, however, for example if you have used logging for a long time without cleaning old entries, see that the task (or rather the database-operations it tries to carry out) times out. If that happens it may be a solution to allow the database to spend more time. Another solution could be to increase number of days log-entries are kept. That way fewer entries need to be deleted the task hereby succeed. After first success it is likely possible to lower the number of days and/or the command timeout again, if wanted.
It is usually a good idea to run a maintenance task like this when the database is not too busy. Running it weekly should be adequate.
Update Database Statistics
SQL Server internally keeps statistics on all data it stores. These statistics are used when it needs to figure out how a SQL query should be carried out, in order to do it with the least use of time and computer resources. In default settings SQL Server does have rules that triggers the update of statistics. Perfion, however, still recommends you to run this “Update Database Statistics”-task periodically since the default rules used by SQL Server may not be sufficient for the non-normalized Perfion Data.
This task has two settings:
Update statistics with row sample percentage indicates the percentage of how many sample data SQL Server should use from each table and index in order to determine the statistics. The default of 80% should be fine.
Command Timeout (per index updated): Usually updating statistics on a single index or table is quite fast (a few seconds), but Perfion holds a few tables that may grow very big and hereby requires some time to update statistics for. For this reason, the default command timeout is set to 3600 seconds (one hour).
Please note that in newer versions of Perfion the Database Installer will encourage you to create and enable this task whenever installing and/or upgrading the database.
It is usually a good idea to run a maintenance task like this when the database is not too busy. Running it weekly should be adequate.
Rebuild Database Indices
To retrieve data fast SQL Server keeps and maintains indices of the data it stores. These indices are maintained whenever data is either inserted, update or deleted. Indices may become cluttered or fragmented after a lot of changes. If that fragmentation gets too bad query performance will deteriorate.
You can lower index fragmentation by either reorganizing or rebuilding an index or table. Rebuilding is dropping an index/table entirely before reconstructing it. Reorganizing is less resource intensive since it “only” reorganizes an existing index.
If some index or table is only slightly fragmented a reorganization is usually adequate while if it is highly fragmented, you might be better off by doing a rebuild. You control what the “Rebuild Database Indices”-task should do based on four settings:
Reorganize index when fragmentation is above: Here you tell the task how high the fragmentation for some index should be before a “reorganization” on that index is allowed. Default is 10% or more. If fragmentation is below that percentage for some index/table, nothing will be done for that particular index/table. Similarly, if fragmentation is above the trigger for doing a rebuild, since there is no need to reorganize an index/table about to be rebuilt.
Rebuild index when fragmentation is above: Same as previous setting, except that you here indicate how high the fragmentation should be for the task to rebuild the index/table as opposed to only reorganize.
Least page count in INDEX in order to Rebuild/Reorganize: A table/index might be highly fragmented but since it is it also very small, it doesn’t really impact performance. With this setting you indicate how many pages a table/index at least should take up of space in order to be rebuilt/reorganized. A page is 8kb of size in SQL Server.
Command Timeout (per index handled): Here you can set how much time SQL Server may use per table/index. 3600 seconds (1 hour) should be adequate.
If you are unsure about the above settings the defaults are in most cases fine. It is usually a good idea to run a maintenance task like this when the database is not too busy. Running it weekly should be adequate.
As for the “Update Database Statistics”-task, please be aware that in newer versions of Perfion the Database Installer will encourage you to create and enable this task whenever installing and/or upgrading the database.
Synchronize inactive Active Directory Users
To be written
Cleanup binaries marked for deletion
Because of performance, when a user deletes a binary in Perfion, it will typically only be logically marked for deletion. This means that these logically deleted binaries still take up space in the database. The ‘Cleanup binaries marked for deletion’ system task will physically delete these.
The Command Timeout parameter allows the admin to configure a timeout for executing the task. Images are deleted in chunks of 10 images. The timeout is in effect per chunk. Per default, timeout is set to 3600 seconds.
This system task is available from the 2024-R1 release.
Troubleshooting
This section acts as a first point of reference for issues with the Scheduler. It is currently quite limited, but will be elaborated, whenever customer issues are seen and resolved.
Symptom: No logs are saved
In the event that scheduled tasks do not appear to generate log entries, it is possibly because the log only allows ~2 billion rows. If the scheduler is run in “debug” mode for an extended period of time, this limit can be reached.
Resolution: Contact Perfion support, who can manually reset the counter for the logs.
An upgrade to a larger datatype is planned in a later release of Perfion.