Table of Contents

Class WorkerTuner

Namespace
Temporalio.Worker.Tuning
Assembly
Temporalio.dll

Implements IWorkerTuner by holding the different ISlotSuppliers.

public class WorkerTuner : IWorkerTuner
Inheritance
WorkerTuner
Implements
Inherited Members

Constructors

WorkerTuner(ISlotSupplier, ISlotSupplier, ISlotSupplier)

Initializes a new instance of the WorkerTuner class composed of the provided slot suppliers.

public WorkerTuner(ISlotSupplier workflowTaskSlotSupplier, ISlotSupplier activityTaskSlotSupplier, ISlotSupplier localActivitySlotSupplier)

Parameters

workflowTaskSlotSupplier ISlotSupplier

The supplier of workflow task slots.

activityTaskSlotSupplier ISlotSupplier

The supplier of activity task slots.

localActivitySlotSupplier ISlotSupplier

The supplier of local activity slots.

Properties

ActivityTaskSlotSupplier

Gets a slot supplier for activity tasks.

public ISlotSupplier ActivityTaskSlotSupplier { get; init; }

Property Value

ISlotSupplier

A slot supplier for activity tasks.

LocalActivitySlotSupplier

Gets a slot supplier for local activities.

public ISlotSupplier LocalActivitySlotSupplier { get; init; }

Property Value

ISlotSupplier

A slot supplier for local activities.

WorkflowTaskSlotSupplier

Gets a slot supplier for workflow tasks.

public ISlotSupplier WorkflowTaskSlotSupplier { get; init; }

Property Value

ISlotSupplier

A slot supplier for workflow tasks.

Methods

CreateFixedSize(int, int, int)

Create a fixed-size tuner with the given slot capacities.

public static WorkerTuner CreateFixedSize(int workflowTaskSlots, int activityTaskSlots, int localActivitySlots)

Parameters

workflowTaskSlots int

The number of available workflow task slots.

activityTaskSlots int

The number of available activity task slots.

localActivitySlots int

The number of available local activity slots.

Returns

WorkerTuner

The tuner.

CreateResourceBased(double, double, ResourceBasedSlotSupplierOptions?, ResourceBasedSlotSupplierOptions?, ResourceBasedSlotSupplierOptions?)

Create a resource based tuner with the provided options.

public static WorkerTuner CreateResourceBased(double targetMemoryUsage, double targetCpuUsage, ResourceBasedSlotSupplierOptions? workflowOptions = null, ResourceBasedSlotSupplierOptions? activityOptions = null, ResourceBasedSlotSupplierOptions? localActivityOptions = null)

Parameters

targetMemoryUsage double

A value between 0 and 1 that represents the target (system) memory usage. It's not recommended to set this higher than 0.8, since how much memory a workflow may use is not predictable, and you don't want to encounter OOM errors.

targetCpuUsage double

A value between 0 and 1 that represents the target (system) CPU usage. This can be set to 1.0 if desired, but it's recommended to leave some headroom for other processes.

workflowOptions ResourceBasedSlotSupplierOptions

Options for the workflow task slot supplier.

activityOptions ResourceBasedSlotSupplierOptions

Options for the activity task slot supplier.

localActivityOptions ResourceBasedSlotSupplierOptions

Options for the local activity slot supplier.

Returns

WorkerTuner

The tuner.

Remarks

WARNING: Resource based tuning is currently experimental.