-
Notifications
You must be signed in to change notification settings - Fork 15
TaskSchedulerConfiguration
The async consumer queue uses a task scheduler to limit concurrency. Generally speaking in this mode, you use just 1 worker to feed messages to the task scheduler. If processing many short tasks, you may find that you need multiple workers reading messages from the transport.
- Maximum threads
This controls how many threads the task scheduler will use to process messages. If the scheduler is full, workers will block until a thread is free.
taskScheduler.Configuration.MaximumThreads = 4;
- Minimum threads
If the idle timeout is reached for a thread, the scheduler will remove it, down to this limit. The thread will be re-created if needed. If you have queues that spend a lot of their time idle, you may wish to use this setting to free up resources.
taskScheduler.Configuration.MinimumThreads = 1;
- Max Queue Size
The task scheduler can 'queue' work and hold on to it until a thread is free. This allows the workers to pull more messages from the queue than you can currently process. This allows the threads to stay busy, and spend less time idle. However, this does increase resources used by the queue; for instance, heartbeats must still be sent for items sitting in the memory queue.
taskScheduler.Configuration.MaxQueueSize = 4;
- Thread idle timeout
How long a thread can be idle for, before it's removed from the pool. The MinimumThreads setting applies here.
taskScheduler.Configuration.ThreadIdleTimeout = TimeSpan.FromSeconds(30);
- Wait for thread pool to finish
How long to wait for the thread pool to finish before panicing. Generally speaking, the queue waits for all tasks to finish before trying to shutdown the thread pool.
taskScheduler.Configuration.WaitForTheadPoolToFinish = TimeSpan.FromSeconds(5);
For any issues please use the GitHub issues