Ice.ThreadPool.*

5 min read

6 min read

6 min read

5 min read

5 min read

5 min read

5 min read

5 min read

5 min read

In language mappings that support thread pools, a communicator creates two thread pools:

  • the client thread pool is associated with outgoing connections: it reads Reply 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 messages; it also reads Reply messages and executes AMI callbacks for bidir 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.

The Ice.Admin object adapter uses the Server thread pool by default. Properties with the Ice.Admin.ThreadPool prefix configure a dedicated thread pool for this adapter.

Ice.ThreadPool.name.Serialize=num

If num is a value greater than 0, the Client or Server thread pool 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

Ice.ThreadPool.name.Size=num

Thread pools in Ice can grow and shrink dynamically, based on an average load factor. A thread pool always has at least 1 thread and may grow as load increases up to the maximum size specified by Ice.ThreadPool.name.SizeMax. If SizeMax is not specified, Ice uses the value of num as the pool's maximum size. The Client or Server thread pool is initialized with num active threads, but the pool may shrink to only 1 thread during idle periods as determined by Ice.ThreadPool.name.ThreadIdleTime.

If not specified, the default value is 1 for both properties.

To monitor the thread pool activities of the Ice runtime, enable the Ice.Trace.ThreadPool property.

Ice.ThreadPool.name.SizeMax=num

num is the maximum number of threads for the Client or Server thread pool. Refer to the 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, enable the Ice.Trace.ThreadPool property.

Ice.ThreadPool.name.SizeWarn=num

Whenever num threads are active in the Client or Server thread pool, 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, enable the Ice.Trace.ThreadPool property.

Ice.ThreadPool.name.StackSize=num

num is the stack size (in bytes) of threads in the Client or Server thread pool. The default value is 0, meaning the operating system's default is used.

Ice.ThreadPool.name.ThreadIdleTime=num

Ice can automatically reap idle threads in the Client or Server thread pool 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.

To disable the reaping of idle threads, set ThreadIdleTime to 0. In this situation, the thread pool is initialized with Ice.ThreadPool.name.Size active threads and may grow to contain Ice.ThreadPool.name.SizeMax active threads, but the size of the pool never decreases.

To monitor the thread pool activities of the Ice runtime, enable the Ice.Trace.ThreadPool property.

Ice.ThreadPool.name.ThreadPriority=value

value specifies a thread priority for the threads in the Client or Server thread pool. Leaving this property unset causes the runtime to create threads with the default priority specified by Ice.ThreadPriority.

This property is unset by default.

value can be Lowest, BelowNormal, Normal, AboveNormal, or Highest.

The named values can also include the ThreadPriority. prefix, for example ThreadPriority.AboveNormal.

You can also override the default priority for a specific object adapter using adapter.ThreadPool.ThreadPriority.

Ice.ThreadPool.name.ThreadPriority=value

value specifies a thread priority for the threads in the Client or Server thread pool. Leaving this property unset causes the runtime to create threads with the default priority specified by Ice.ThreadPriority.

This property is unset by default.

value can be MIN_PRIORITY, NORM_PRIORITY, MAX_PRIORITY, or an integer between 1 and 10.

The named values can also include the java.lang.Thread. prefix, for example java.lang.Thread.NORM_PRIORITY.

You can also override the default priority for a specific object adapter using adapter.ThreadPool.ThreadPriority.