A request processing thread might also be instructed to send the request to a dierent thread
pool for processing. For example, if the request processing thread must perform some work that
is not thread-safe, it might be instructed to send part of the processing to the NativePool. Once
the NativePool completes its work, it communicates the result to the request processing thread
and the request processing thread continues processing the request.
At startup, the server only creates the number of threads dened in the thread pool minimum
threads, by default 16. As the load increases, the server creates more threads. The policy for
adding new threads is based on the connection queue state.
Each time a new connection is returned, the number of connections waiting in the queue (the
backlog of connections) is compared to the number of request processing threads already
created. If the number of connections waiting is greater than the number of threads, more
threads are scheduled to be added the next time a request completes.
The process of adding new session threads is strictly limited by the maximum threads value. For
more information on maximum threads, see
“Maximum Threads (Maximum Simultaneous
Requests)” on page 58
.
You can change the settings that aect the number and timeout of threads, processes, and
connections in the Admin Console, on the conguration's Performance tab (HTTP settings),
and on the HTTP listener. You can also use the wadm commands set-thread-pool-prop and
set-http-listener-prop and set-keep-alive-prop.
Low Latency and High Concurrency Modes
The server can run in one of two modes, depending upon the load. It changes modes to
accommodate the load most eciently.
■
In low latency mode, for keep-alive connections, session threads themselves poll for new
requests.
■
In high concurrency mode, after nishing the request, session threads give the connection to
the keep-alive subsystem. In high concurrency mode, the keep-alive subsystem polls for new
requests for all keep-alive connections.
When the server is started, it starts in low latency mode. When the load increases, the server
moves to high concurrency mode. The decision to move from low latency mode to high
concurrency mode and back again is made by the server, based on connection queue length,
average total sessions, average idle sessions, and currently active and idle sessions.
Disabled Thread Pools
If a thread pool is disabled, no threads are created in the pool, no connection queue is created,
and no keep-alive threads are created. When the thread pool is disabled, the acceptor threads
themselves process the request.
UnderstandingThreads,Processes,andConnections
Chapter2 • TuningSunJavaSystemWebServer 41