When the metadata server
is initialized, the server creates a pool of available threads to
run client requests. The metadata server's configuration settings
control the minimum and maximum number of threads in the pool.
When a client request
is received, one of the available threads is used to process the request.
If no threads are available, the server creates a new thread. If
the thread pool has reached the maximum size, the request waits until
a thread is returned to the pool.
The client request is
then executed in the thread as resources become available. The server's
configuration settings control the maximum number of threads that
can be executed concurrently. When processing is complete, the thread
is returned to the pool. If the number of available threads exceeds
the minimum thread pool size, unused threads are destroyed after a
period of time to conserve system resources.
The management and use
of threads is controlled by the following configuration settings:
minimum number of threads
determines the minimum
number of threads that are maintained in the server's thread pool,
regardless of the number of client requests that are received or accepted.
If the number of available threads exceeds this minimum, then the
excess unused threads are destroyed after a period of time to conserve
system resources.
By default, the server
uses this formula to compute the minimum number of threads:
MAX(5,((number-of-processors *
2) + 1))
This means that the
value is set to either 5 or to ((
number-of-processors *
2) + 1), whichever is greater.
-
If the host machine has eight processors,
then the minimum number of threads is set to 17.
-
If the host machine has two processors,
then the minimum number of threads is set to 5.
-
If the host machine has one processor,
then the minimum number of threads is set to 5.
If the metadata server's
invocation options include a value for THREADSMIN, then that value
is used instead of the default.
maximum number of threads
determines the maximum
number of threads that are maintained in the server's thread pool,
regardless of the number of client requests that are received or accepted. If
no threads are available when a client request is received, then a
new thread is created only if the number of the threads in the thread
pool is less than the maximum. If the maximum has already been reached,
the client request waits for a thread to be returned to the pool.
As a best practice
for the metadata server, THREADSMAX and THREADSMIN should be set to
the same value to avoid thread resource thrashing.
By default, if no value
is specified for maximum number of threads, it is set to the computed
value of THREADSMIN.
maximum number of active threads
determines the number
of threads that are allowed to run concurrently on the metadata server.
This number controls the number of queries that can be active on the
server at any one time.
By default, the server
sets the maximum number of active threads as follows:
-
If the host machine has one processor,
then the maximum active number of threads is set to 2.
-
If the host machine has two or
more processors, then the maximum active number of threads is set
to the number of processors.
If the metadata server's
configuration file includes a value for MAXACTIVETHREADS, then that
value is used instead of the default.
The default settings that are described in the preceding
list provide a good starting point for most sites. To fine-tune the
configuration to meet your specific workload and performance requirements,
you can set different values in your configuration files. For instructions
and guidance, see the next topic.