# Need to understand how Threads work with temporal

**URL:** <https://community.temporal.io/t/need-to-understand-how-threads-work-with-temporal/3093>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [October 5, 2021, 9:57am UTC](https://community.temporal.io/t/need-to-understand-how-threads-work-with-temporal/3093 "2021-10-05T09:57:45Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [February 8, 2022, 2:25am UTC](https://community.temporal.io/t/need-to-understand-how-threads-work-with-temporal/3093/13 "2022-02-08T02:25:57Z")

</div>

1. Task queues can be treated like distributed queues, managed by the Temporal service. Their size is also managed by the service (can grow dynamically with the number of tasks they contain). There are no configuration options for size currently.

2. Max number of threads for all workers created by a WorkflowFactory is configurable via [WorkflowFactoryOptions.maxWorkflowThreadCount](https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/worker/WorkerFactoryOptions.java#L94). Default is [600 threads](https://github.com/temporalio/sdk-java/blob/master/temporal-sdk/src/main/java/io/temporal/worker/WorkerFactoryOptions.java#L42).  
Workers have a cashing mechanism for workflows. Whenever there are no more available threads, a worker can evict a cashed workflow for other workflows to execute/continue execution.  
Check out [this forum thread](https://community.temporal.io/t/tuning-temporal-setup-for-better-performance/539/5) for worker configurations, as well as [this documentation PR](https://github.com/temporalio/documentation/pull/875).

---

_[View the full topic](https://community.temporal.io/t/need-to-understand-how-threads-work-with-temporal/3093)._
