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, SlotSupplier)
Initializes a new instance of the WorkerTuner class composed of the provided slot suppliers.
public WorkerTuner(SlotSupplier workflowTaskSlotSupplier, SlotSupplier activityTaskSlotSupplier, SlotSupplier localActivitySlotSupplier, SlotSupplier nexusTaskSlotSupplier)
Parameters
workflowTaskSlotSupplierSlotSupplierThe supplier of workflow task slots.
activityTaskSlotSupplierSlotSupplierThe supplier of activity task slots.
localActivitySlotSupplierSlotSupplierThe supplier of local activity slots.
nexusTaskSlotSupplierSlotSupplierThe supplier of Nexus operation slots.
Remarks
WARNING: Nexus support is experimental.
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.
NexusTaskSlotSupplier
Gets a slot supplier for Nexus operations.
public SlotSupplier NexusTaskSlotSupplier { get; init; }
Property Value
- SlotSupplier
A slot supplier for Nexus operations.
Remarks
WARNING: Nexus support is experimental.
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, int)
Create a fixed-size tuner with the given slot capacities.
public static WorkerTuner CreateFixedSize(int workflowTaskSlots, int activityTaskSlots, int localActivitySlots, int nexusTaskSlots = 100)
Parameters
workflowTaskSlotsintThe number of available workflow task slots.
activityTaskSlotsintThe number of available activity task slots.
localActivitySlotsintThe number of available local activity slots.
nexusTaskSlotsintThe number of available Nexus operation slots.
Returns
- WorkerTuner
The tuner.
Remarks
WARNING: Nexus support is experimental.
CreateResourceBased(double, double, ResourceBasedSlotSupplierOptions?, 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, ResourceBasedSlotSupplierOptions? nexusOptions = null)
Parameters
targetMemoryUsagedoubleA 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.
targetCpuUsagedoubleA 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.
workflowOptionsResourceBasedSlotSupplierOptionsOptions for the workflow task slot supplier.
activityOptionsResourceBasedSlotSupplierOptionsOptions for the activity task slot supplier.
localActivityOptionsResourceBasedSlotSupplierOptionsOptions for the local activity slot supplier.
nexusOptionsResourceBasedSlotSupplierOptionsOptions for the Nexus operation slot supplier.
Returns
- WorkerTuner
The tuner.
Remarks
WARNING: Nexus support is experimental.