---
title: "Ice.ThreadPool.*"
url: https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties
language: python
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Ice.ThreadPool.\*

Programming language: Python. Other languages: [C++](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/php.md), [Ruby](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/property-reference/ice-threadpool-properties/swift.md).

In language mappings that support thread pools, a communicator creates two [thread pools](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md):

- the client thread pool is associated with outgoing connections: it reads [Reply](https://docs.zeroc.com/ice/3.8/protocol/protocol-messages/python.md) messages and executes AMI callbacks; it also reads and dispatches Request messages.
- the server thread pool is associated with incoming connections: it reads and dispatches [Request](https://docs.zeroc.com/ice/3.8/protocol/protocol-messages/python.md) messages; it also reads Reply messages and executes AMI callbacks for [bidir](https://docs.zeroc.com/ice/3.8/runtime/connection-management/bidirectional-connections/python.md) invocations on these connections.

This page describes configuration properties for the client and server thread pools. These thread pools are named `Client` and `Server`, respectively. In the property descriptions below, replace `name` with `Client` or `Server`.

## Ice.ThreadPool.*name*.Serialize

`Ice.ThreadPool.name.Serialize=num`

If `num` is a value greater than `0`, the `Client` or `Server` [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md) serializes all messages from each connection. It is not necessary to enable this feature in a thread pool whose maximum size is 1 thread. When a thread pool dispatches requests implemented with AMD, it serializes the dispatching of requests from each connection, but it does not wait for a request to complete before it dispatches the next request.

In a multi-threaded pool, enabling serialization allows requests from different connections to be dispatched concurrently while preserving the order of messages on each connection. Note that serialization can have a significant impact on latency and throughput. If not defined, the default value is `0`.

See also: [Ice.Connection.MaxDispatches](https://docs.zeroc.com/ice/3.8/property-reference/ice-connection-properties/python.md)

## Ice.ThreadPool.*name*.Size

`Ice.ThreadPool.name.Size=num`

`num` is the number of threads that Ice starts in the `Client` or `Server` [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md). When a thread becomes busy and no idle thread remains in the pool, Ice adds a thread, up to [Ice.ThreadPool.*name*.SizeMax](#ice.threadpool.name.sizemax). Ice reaps idle threads as [Ice.ThreadPool.*name*.ThreadIdleTime](#ice.threadpool.name.threadidletime) specifies, but always keeps at least 1 thread in the pool. The default value is `1`.

To monitor the thread pool activities of the Ice runtime, set [Ice.Trace.ThreadPool](https://docs.zeroc.com/ice/3.8/property-reference/ice-trace-properties/python.md) to `1`.

## Ice.ThreadPool.*name*.SizeMax

`Ice.ThreadPool.name.SizeMax=num`

`num` is the maximum number of threads for the `Client` or `Server` [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md). Refer to the [Ice.ThreadPool.*name*.Size](#ice.threadpool.name.size) property for more information on configuring the size of a thread pool.

The default value for `SizeMax` is the value of `Size`, meaning the thread pool can never grow larger than its initial size.

Setting `SizeMax` to `-1` sets the maximum to the larger of `Size` and the number of processors available to the runtime.

To monitor the thread pool activities of the Ice runtime, set [Ice.Trace.ThreadPool](https://docs.zeroc.com/ice/3.8/property-reference/ice-trace-properties/python.md) to `1`.

## Ice.ThreadPool.*name*.SizeWarn

`Ice.ThreadPool.name.SizeWarn=num`

Whenever `num` threads are active in the `Client` or `Server` [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md), a "low on threads" warning is printed. The default value is `0`, which disables the warning.

To monitor the thread pool activities of the Ice runtime, set [Ice.Trace.ThreadPool](https://docs.zeroc.com/ice/3.8/property-reference/ice-trace-properties/python.md) to `1`.

## Ice.ThreadPool.*name*.ThreadIdleTime

`Ice.ThreadPool.name.ThreadIdleTime=num`

Ice can automatically reap idle threads in the `Client` or `Server` [thread pool](https://docs.zeroc.com/ice/3.8/runtime/threading-model.md) to conserve resources. This property specifies the number of seconds a thread must be idle before it is reaped. If not specified, the default value is 60 seconds.

> **Tip**
>
> The threads in Ice thread pools are assigned jobs at random, and this randomness affects how quickly a thread in an under-utilized thread pool will get reaped.

To disable the reaping of idle threads, set `ThreadIdleTime` to `0`. In this situation, the thread pool is initialized with [Ice.ThreadPool.*name*.Size](#ice.threadpool.name.size) active threads and may grow to contain [Ice.ThreadPool.*name*.SizeMax](#ice.threadpool.name.sizemax) active threads, but the size of the pool never decreases.

To monitor the thread pool activities of the Ice runtime, set [Ice.Trace.ThreadPool](https://docs.zeroc.com/ice/3.8/property-reference/ice-trace-properties/python.md) to `1`.
