Runtime thread pool configuration

The implementation of the Asset Gateway and Enterprise Gateway runtime component includes a configurable pool of worker threads. These threads are operating system threads that run in the context of the runtime process. These worker threads perform various tasks, including the support of the:

  • Execution of trigger actions
  • Reading of device variables
  • Communications with external processes, including the Workbench and the Transaction Server.

The original implementation of the pool of worker threads will be referred to as Thread Pool V1.0. A new, optional, implementation of the pool of worker threads will be referred to as Thread Pool V2.0.

Thread Pool V1.0 is the default configuration of Asset Gateways and Enterprise Gateways. Its features can be configured based on your system and application's design and resource usage.
For most applications, the Thread Pool V1.0 implementation and configurable features provide the system behavior required for the application's design and resource usage.

Thread Pool V2.0 is an optional configuration for Asset Gateways and Enterprise Gateways. Its features can be configured based on your system and application's design and resource usage.
For some high resource usage applications, the Thread Pool V2.0 implementation and configurable features provide an improvement in the system behavior required for the application's design and resource usage.
Thread Pool V2.0 was included as an optional feature, starting with the 18.1.2 release.

Runtime thread pool options

Configuration of the thread pool is an advanced topic. In most cases, you will be directed to this information and the configuration options based on interaction with your support representative.

Thread pool properties, System Variables and default values

Some of the properties are present in the properties files. Other properties are not present in the provided properties files, but have a default value in the code.

Many of the properties and their current values for a node can be seen using the Workbench -> Administration -> System Variables tab.

The default values listed in the following sections are the default values for most Asset Gateway and Enterprise Gateway products. Some products with limited system resources have different default values for some properties. If there is a question, the values can be seen for the node using the Workbench -> Administration -> System Variables tab.

Thread Pool V1.0

The properties available for the configurable features of the Thread Pool V1.0 implementation, and the associated System Variables are:

  1. Minimum thread count:
    1. The number of worker threads started during the runtime's initialization.
    2. The number of worker threads will not drop below this number during runtime, based on the dynamic worker thread allocate and deallocate logic.
    3. The defaults are:
      1. Asset Gateway: pool.threads.min=10.
      2. Enterprise Gateway: pool.threads.min=20.
    4. The System Variable is: pool.queue.threads.min.
  2. Maximum thread count:
    1. The maximum number of worker threads that will be concurrently created/active.
    2. When there are more work items than the current number of worker threads, a new worker thread will be created.
      1. Once the number of current worker threads reaches this maximum value, a new worker thread will not be created.
      2. Instead, the new work item is queued, waiting for a current worker thread to complete its work item and be available to process queued work items.
    3. The defaults are:
      1. Asset Gateway: pool.threads.max=20.
      2. Enterprise Gateway: pool.threads.max=100.
    4. The System Variable is: pool.queue.threads.max.
  3. Idle thread count:
    1. When a worker thread completes its work item, and there is no more work for it to process, there is logic that controls whether the worker thread should exit the operating system.
    2. The logic includes not finding a new work item for a number of iterations, before the worker threads exits.

    3. The defaults are:

      1. Asset Gateway: pool.threads.idle_count=10.

      2. Enterprise Gateway: pool.threads.idle_count=10.

    4. The System Variable is: pool.queue.threads.idle_count.

  4. Processor threads statically allocated at runtime initialization time:

    1. Processor threads are used for communications with external processes, including the Workbench and the Transaction Server.
    2. The defaults are:

      1. Asset Gateway: processor.threads=5.

      2. Enterprise Gateway: processor.threads=10.

    3. The System Variables are:

      1. processor.0-x.executing.

      2. processor.queue.depth.
        An increasing or steady high value (more than single digit value) in processor.queue.depth System Variable may be an indication that the processor.threads property should be increased.
        An alternative to increasing the processor.threads property used of the Thread Pool V1.0 implementation is the option of using the Thread Pool V2.0 implementation.

      3. processor.queue.watermark.

  5. Worker thread limiter percentage:

    1. The percentage of the maximum worker threads that will concurrently process a specific work item type.
    2. The system default is: pool.concurrency.limit=40.
    3. The System Variable is: pool.max_concurrent_executions.
  6. Thread stack size:
    1. The stack size, in bytes, for each worker thread.
    2. The default is: pool.threads.stack=65536.
    3. The System Variable is: pool.queue.threads.stack.

Thread Pool V2.0

The Thread Pool V2.0 implementation:

  • Is enabled with a property value
  • Has different features from the Thread pool V1.0 implementation
  • Is configurable using properties.

To enable the Thread Pool V2.0 implementation, add the property: pool.v2.enabled=true.

  • It is suggested that this property be added to a user defined properties file, such as user.solution.properties. For more information, see Properties file management.

This will enable the Thread Pool V2 implementation when the runtime is restarted and the properties are read.
This will enable the following V2 implementation changes:

    1. The processor pool threads are moved into the worker thread pool. This allows the previously dedicated processor threads to take advantage of the dynamic thread allocation and limit logic that is part of the worker thread pool.
    2. Remove the logic to deallocate idle work threads.
      1. If a system required a high number of worker threads (within the max thread count property), the chances are it will need the high number of worker threads in the future.
      2. Removing the deallocate logic removes the overhead of determining if an idle thread should exit.

The properties available for the configurable features of the Thread Pool V2.0 implementation, and the associated System Variables are:

  1. Minimum thread count:
    1. This concept is removed. The pool.threads.min property is not used.
  2. Maximum thread count:
    1. The Thread Pool V1.0 property pool.threads.max is not used, pool.v2.threads.max is used instead.
    2. The number of worker threads started during the runtime's initialization.
      1. If the number of current, in use, worker threads reaches this maximum value, a new worker thread will not be created.
      2. Instead, the new work item is queued, waiting for a current worker thread to complete its work item and be available to process queued work items.
    3. The defaults are:
      1. Asset Gateway: pool.v2.threads.max=120.
      2. Enterprise Gateway: pool.v2.threads.max=500.
    4. The System Variable is: pool.v2.threads.max.
  3. Worker thread limiter count. In the Thread Pool V2.0 implementation, this is a thread count instead of a percentage of the maximum thread count:
    1. The Thread Pool V1.0 property pool.limiter.count is not used, pool.v2.limiter.count is used instead.
    2. When the worker thread limit count is reached, the system will create a queue and put all new work items for that particular task work type into that queue.
    3. The defaults are:
      1. Asset Gateways: pool.v2.limiter.count=40.
      2. Enterprise Gateways: pool.v2.limiter.count=150.
    4. The System Variable is: pool.v2.limiter.count.
  4. Thread stack size:
    1. The stack size, in bytes, for each worker thread.
    2. The default is: pool.threads.stack=65536.
    3. The System Variable is: pool.queue.threads.stack.

Properties file management

For information on properties file management, including overwritten of files during a product installation or a product update, see Properties file management.


Related topics

System Variables

Diagnostics

Properties file management

Troubleshooting node resource utilization problems