IBM Streams 4.2

Specifying how threads in a PE execute operators

Within a processing element (PE), IBM® Streams can use threads to execute operators in parallel to achieve better performance. The threading model of a PE determines how threads execute operators. When you submit a job, you can optionally change the threading model for all of the PEs in an application.

About this task

The threading model for your application might be specified directly in the SPL application through the @threading annotation or by the default threading model that is configured at the domain or instance level. When you submit a job, you can override the existing threading model by specifying the threadingModel submission-time configuration parameter.

You do not need to recompile your application to change the threading model when you submit the job.

You can override the threading model by using a job configuration overlay file or from the IBM Streams Console, IBM Streams Studio, or the streamtool submitjob command.

Use the threadingModel option to override the threading model when you submit the job. The values for the threadingModel option are the same as the values for the @threading annotation:
manual
Each operator input port is executed by the thread that executed the upstream operator, unless the application programmer manually adds a threaded port to an operator input port.
dynamic
Each operator input port can be executed by any thread. The assignment of threads to input ports can change at runtime, as can the number of available threads. If you set the threading model to dynamic, you can also configure the following options:
  • The dynamicThreadingThreadCount parameter specifies the number of threads to start with. The value must be an integer greater than or equal to 1.

    If you do not specify a value for this parameter, IBM Streams uses the default value that is configured for the instance on which you deploy the application. If the instance does not have a default value, then the PE uses the default value for threads in the @threading annotation.

  • The dynamicThreadingElastic parameter specifies whether the number of dynamic threads can change at runtime to maximize throughput. Specify true to make the number of dynamic threads elastic or false to keep the number of dynamic threads static.

    If you do not specify a value for this parameter, IBM Streams uses the default value that is configured for the instance on which you deploy the application. If the instance does not have a default value, then the PE uses the default value (true) for elastic in the @threading annotation.

automatic
During PE initialization, the SPL runtime chooses between the dynamic threading model and the manual threading model.
dedicated
Each operator input port has a dedicated thread that processes all tuples on that input port for that operator.

For a full description of threading models, see the SPL @threading annotation reference information.

If you do not specify a threading model, IBM Streams uses the default threading model from the instance on which you deploy the application (instance.threadingModel). If the instance.threadingModel is not set, the default value (automatic) for model in the @threading annotation is used.