Class WorkerTuner
- Namespace
- Temporalio.Worker.Tuning
- Assembly
- Temporalio.dll
Implements IWorkerTuner by holding the different SlotSuppliers.
public class WorkerTuner : IWorkerTuner
- Inheritance
-
WorkerTuner
- Implements
- Inherited Members
Constructors
WorkerTuner(SlotSupplier, SlotSupplier, SlotSupplier)
Initializes a new instance of the WorkerTuner class composed of the provided slot suppliers.
public WorkerTuner(SlotSupplier workflowTaskSlotSupplier, SlotSupplier activityTaskSlotSupplier, SlotSupplier localActivitySlotSupplier)
Parameters
workflowTaskSlotSupplier
SlotSupplierThe supplier of workflow task slots.
activityTaskSlotSupplier
SlotSupplierThe supplier of activity task slots.
localActivitySlotSupplier
SlotSupplierThe supplier of local activity slots.
Properties
ActivityTaskSlotSupplier
Gets a slot supplier for activity tasks.
public SlotSupplier ActivityTaskSlotSupplier { get; init; }
Property Value
- SlotSupplier
A slot supplier for activity tasks.
LocalActivitySlotSupplier
Gets a slot supplier for local activities.
public SlotSupplier LocalActivitySlotSupplier { get; init; }
Property Value
- SlotSupplier
A slot supplier for local activities.
WorkflowTaskSlotSupplier
Gets a slot supplier for workflow tasks.
public SlotSupplier WorkflowTaskSlotSupplier { get; init; }
Property Value
- SlotSupplier
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
intThe number of available workflow task slots.
activityTaskSlots
intThe number of available activity task slots.
localActivitySlots
intThe 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
doubleA 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
doubleA 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
ResourceBasedSlotSupplierOptionsOptions for the workflow task slot supplier.
activityOptions
ResourceBasedSlotSupplierOptionsOptions for the activity task slot supplier.
localActivityOptions
ResourceBasedSlotSupplierOptionsOptions for the local activity slot supplier.
Returns
- WorkerTuner
The tuner.
Remarks
WARNING: Resource based tuning is currently experimental.