Configuring the Number of Threads Used by the Metadata Server

About the MAXACTIVETHREADS, THREADSMIN, and THREADSMAX Options

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.
For example:
  • 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.

Specify Values for the MAXACTIVETHREADS, THREADSMIN, and THREADSMAX Options

To fine-tune the performance of the metadata server, you can specify values for the following:
  • the MAXACTIVETHREADS option in the metadata server configuration file, omaconfig.xml
  • the THREADSMIN and THREADSMAX parameters of the OBJECTSERVERPARMS metadata server invocation option
The values that you specify override the default configuration settings that are described in About the MAXACTIVETHREADS, THREADSMIN, and THREADSMAX Options.
The following are some examples of situations in which you might want to adjust these settings. You might encounter other situations in which changes are beneficial.
  • If you want to dedicate only a portion of the host machine's processors to metadata server processing, then specify values for MAXACTIVETHREADS, THREADSMIN, and THREADSMAX that are lower than the default settings. The following settings are recommended as a starting point:
    • If you want to dedicate more than one processor to metadata server processing, then set MAXACTIVETHREADS to the number of processors that you want to use. For example, if your host machine has eight processors, but you want to dedicate only five of those processors to metadata server processing, then set MAXACTIVETHREADS to 5.
      Note: As a best practice, you should not set MAXACTIVETHREADS to a value less than 2.
    • After you determine the correct setting for MAXACTIVETHREADS, specify a value for THREADSMIN and THREADSMAX that is equal to (MAXACTIVETHREADS * 2) + 1. For example, if you set MAXACTIVETHREADS to 5, then set THREADSMIN and THREADSMAX to 11.
  • If clients of the metadata server are experiencing processing delays, and if you have observed that some of the processors that are dedicated to the server are underutilized, then you might want to specify values for MAXACTIVETHREADS, THREADSMIN, and THREADSMAX that are higher than the default settings. Follow these guidelines:
    • As a general rule, THREADSMIN and THREADSMAX should be set to a value that equals (MAXACTIVETHREADS * 2) + 1.
    • Increase the settings in small increments. For example, you could first set MAXACTIVETHREADS to number-of-processors + 2 and set THREADSMIN and THREADSMAX to a value that equals (MAXACTIVETHREADS * 2) + 1.
      After each change, check to see whether processor utilization increases and delay times decrease. If so, gradually increase the settings to determine which level results in the best performance. (When the settings are too high, the performance benefits will diminish.)
To specify a value for MAXACTIVETHREADS, update the metadata configuration file omaconfig.xml. See Reference Information for omaconfig.xml. To specify values for THREADSMAX and THREADSMIN, update the metadata server's sasv9_usermods.cfg file. See Modifying the Metadata Server Invocation Options. Both of these files are located in the following path:
SAS-configuration-directory/Lev1/SASMeta/MetadataServer
After modifying the configuration files, you must restart the metadata server to enable the changes. The server reads the configuration settings only during initialization.