Thread Pool

From Grooper Wiki
Jump to navigation Jump to search

Thread Pools allow Grooper to allocate system resources to different Unattended Activities.

New Grooper Repositories initialize with a single Thread Pool named "Default". In many cases, this is sufficient to run all activities. However, one can alter how many processing threads are allocated to an activity in a Batch Process.  This is done by creating a new Thread Pool, assigning it to an Activity Processing Grooper Service from Grooper Config, specifying how many threads that Thread Pool should use, and referencing the Thread Pool on that activity's Batch Step properties.


Some activities only allow one instance of the activity to execute at a time per machine executing the activity (For example the Render activity). In such case, you would first create a new Thread Pool, specifying a PerMachine for the Concurrency Mode property. Then, you would create an Activity Processing service, assign it the newly created Thread Pool and drop the number of available threads to one. Last, you would configure the activity's step in the Batch Process to run using the newly created Thread Pool instead of the "Default". By doing this, the activity will be forced to run on a single thread, one instance at a time, one server or workstation at a time. If another instance of that activity tries to run while the first is running (such as a second Batch running on the same machine trying to run the same activity already running in another Batch Process), the second will be forced to wait its turn.

Thread Pools are also used to control the concurrency of operations to an external system. Imagine you are exporting to a content management system using a CMIS Connection. Assume your system has 64 threads available for processing. If the content management system allows 64 concurrent connections (allowing 64 documents exporting at a time in this case), then there's no problem. The system has one thread for each document exporting to the content management system. The Export activity would run with no problems. However, what if the content management system only allows for 16 connections at a time? Grooper is going to try and use all 64 threads to export unless told otherwise. The first 16 documents might export with no problems, but the next 48 (64 threads minus 16 threads) will error out. By creating a Thread Pool using only 16 threads for the Export activity, Grooper will hold off from using all 64 threads for the activity. Only 16 threads, one for each allowable concurrent connection to the content management system, will be used at a time.

More detailed information about how to add a new Thread Pool and assign it to an Activity Processing service can be found in the Activity Processing article.