How Do I Improve Performance When a Task is Being Called Repeatedly by a Batch Task? (Magic xpa 4.x)
Sometimes, when one batch task is called repeatedly by another batch task, performance can be very slow. This often turns out to be due to the overhead required to open and close the files used by the subtask. There are a few simple steps you can take to improve performance in these cases.
-
The first and most important step is to make sure that the files used by the subtask are pre-opened in the parent task. Different file systems have different amounts of overhead for a file open, but it often takes longer to open a file than to read the records.
If the file is not being used in the parent task, you can pre-open it by inserting a declare line in the data view. The Access used in this line must match the Access used when the subtask opens the file.
-
Secondly, make sure the batch task is loaded as resident. This keeps the batch task from being reloaded every time it is called.
To make the subtask load as resident:
-
Last, make sure that the transaction mode in the parent task is not deferred. When the transaction mode is deferred, all the subtask transactions “stack up” and can seriously degrade performance. To check the transaction mode:
-
Go to the parent task.
-
Go to Task Properties (Ctrl+P).
-
Go to the Data tab.
-
Set the transaction mode to what you need for the task. In this case, we turned off transactions totally. Since many large batch tasks are for reports, which do not update data we care about, there is no need for transaction processing.
The Online and Rich Client Samples projects (program TS32 and RTS32)