I’m working on an application that runs long-running, heavy-duty batch jobs using Temporal workflows. Each job falls into one of three priority levels: low, medium, or high. Which is separated by creating thre type of worker queues.
To ensure high-priority jobs get precedence in terms of worker allocation and execution speed, we are configuring the following Temporal worker settings:
.setMaxConcurrentWorkflowTaskExecutionSize(x)
.setMaxWorkerActivitiesPerSecond(y)
.setMaxTaskQueueActivitiesPerSecond(z)
These settings allow us to allocate more workers and execution capacity to high-priority workflows.
Potential Issue A concern I have is resource underutilization:
- If there are few or no high-priority jobs, then low-priority jobs may remain unnecessarily throttled because their configured limits are lower.
- As a result, system resources (CPU, memory, workers) may be underutilized even when there is pending work in lower-priority queues.
Question Is this concern valid? If so, what is the best way to dynamically adjust worker allocation so that available resources are fully utilized when high/medium-priority jobs are absent, while still ensuring that high-priority jobs take precedence when they arrive?
Would love to hear best practices or strategies (e.g., dynamic scaling, adaptive rate limits, multiple worker pools) that have worked in similar use cases.
Thanks!