Maximizing Performance On-premises
This section will focus on improving the performance and responsiveness of the file and print service in an on-premises environment.
Before trying the recommendations below, it would be best to read about the polling mechanism.
Disable signaling
When running on-premises, Internet connectivity can be slow or non-existent. In scenarios like that, it is recommended to turn off the signaling of new jobs on the queue. Even in installations where the Business Central service tier has a fast Internet connection, turning off the signaling can improve the overall performance.
Please remember that disabling the signaling will make your print service poll Business Central directly. If you have many instances running, this may cause database locks.
Disable signaling in Business Central
First, you turn off the signaling in Business Central. This is done on the ForNAV Direct Print and File Setup page.
When signaling is disabled, Business Central will no longer notify the signaling hub about ready print and file jobs on the queue. Signaling is usually fast, but it still introduces a short delay in the process.
Disable signaling in the print service
Now that we no longer get signals from Business Central, polling of the signal hub must be turned off in the print service configuration.
Below is an example of a config.json without any intervals in the SignalHub section. This will turn off the polling for signals.
Instead, we have one interval for polling the queue in Business Central. In this example, it will call the API and let it run for a maximum of 5 seconds before returning. If a job is found before the time is up, the job is returned. It is also specified that it will wait 0 (zero) seconds before calling the API again.
{
"Version": 1,
"Environments": [
{
"Name": "default",
"InstanceCount": 3,
"Strategy": {
"SignalHub": {
"Intervals": [
]
},
"PrintQueue": {
"Intervals": [
{
"LocalWait": 0,
"RemoteWait": 5
}
]
}
}
}
]
}
Database poll pause
The example configuration will monitor the queue for 5 seconds every time the Business Central API is called. During that time, Business Central will wait for new jobs in a loop. If it does not find a ready job, it will pause for a moment before looking again. This pause will take some load off the SQL server.
Lower the default pause on the ForNAV Direct Print and File Setup page to improve printing speed and responsiveness. Try setting it to 100 milliseconds.
Additional instances
On a standard installation of the print and file service, only one process polls the queue in Business Central for new jobs. When this process is printing or working with files, it cannot handle other jobs at the same time. Therefore, it is recommended to increase the number of instances to improve performance.
Try setting the instance count to 3, as shown in the example configuration above.
Final notes
Turning off the signaling, lowering the poll pause, and increasing the instance count should give you a fast printing solution.
The downside may be an increased load on Business Central, but usually not much. Also, by adding additional instances, you can no longer ensure the order of execution for the jobs.