2021:Thread Pool (Object): Difference between revisions

From Grooper Wiki
No edit summary
No edit summary
Line 6: Line 6:
New [[Grooper Repository|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 [[Thread|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 Process Step]]''' properties.
New [[Grooper Repository|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 [[Thread|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 Process Step]]''' properties.
</onlyinclude>
</onlyinclude>
== About ==
== About ==



Revision as of 10:55, 25 November 2020

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 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 Process Step properties.

About

Some activities only allow one instance of the activity to execute at a time per machine executing the activity (For example the Render (Activity)|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 Document 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 Document 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.