[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Performance Management Guide

Environment Variables

This section discusses the following topics:

Thread Support Tunable Parameters

Following is a list of thread support parameters that can be tuned:

  1. AIXTHREAD_COND_DEBUG (AIX 4.3.3 and subsequent versions)
    Purpose: Maintains a list of condition variables for use by the debugger.
    Values: Default: ON
    Range: ON, OFF
    Display: echo $AIXTHREAD_COND_DEBUG (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_COND_DEBUG={ON|OFF}
    export AIXTHREAD_COND_DEBUG
    Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_COND_DEBUG={ON|OFF} command to the /etc/environment file.
    Diagnosis: Leaving it on makes debugging threaded applications easier, but may impose some overhead.
    Tuning: If the program contains a large number of active condition variables and frequently creates and destroys condition variables, this may create higher overhead for maintaining the list of condition variables. Setting the variable to OFF will disable the list.
    Refer to Thread Debug Options.
  2. AIXTHREAD_ENRUSG
    Purpose: Enable or disable pthread resource collection.
    Values: Default: OFF
    Range: ON, OFF
    Display: echo $AIXTHREAD_ENRUSG (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_ENRUSG={ON|OFF}
    export AIXTHREAD_ENRUSG
    Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_ENRUSG={ON|OFF} command to the /etc/environment file.
    Diagnosis: Turning it on allows for resource collection of all pthreads in a process, but will impose some overhead.
    Tuning:
    Refer to Thread Environment Variables.
  3. AIXTHREAD_GUARDPAGES (AIX 4.3 and later)
    Purpose: Controls the number of guard pages to add to the end of the pthread stack.
    Values: Default: 0Range: A positive integer
    Display: echo $AIXTHREAD_GUARDPAGES (This is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_GUARDPAGES=nexport AIXTHREAD_GUARDPAGESChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_GUARDPAGES=n command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: N/A
    Refer to Thread Environment Variables.
  4. AIXTHREAD_MINKTHREADS (AIX 4.3 and later)
    Purpose Controls the the minimum number of kernel threads that should be used.
    Values: Default: 8
    Range: A positive integer value
    Display: echo $AIXTHREAD_MINKTHREADS (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_MINKTHREADS=nexport AIXTHREAD_MINKTHREADSChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_MINKTHREADS =n command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: The library scheduler will not reclaim kernel threads below this figure. A kernel thread may be reclaimed at virtually any point. Generally, a kernel thread is targeted as a result of a pthread terminating.
    Refer to: Variables for Process-Wide Contention Scope
  5. AIXTHREAD_MNRATIO (AIX 4.3 and later)
    Purpose: Controls the scaling factor of the library. This ratio is used when creating and terminating pthreads.
    Values: Default: 8:1
    Range: Two positive values (p:k), where k is the number of kernel threads that should be employed to handle p runnable pthreads
    Display: echo $AIXTHREAD_MNRATIO (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_MNRATIO=p:kexport AIXTHREAD_MNRATIOChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_MNRATIO=p:k command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: May be useful for applications with a very large number of threads. However, always test a ratio of 1:1 because it may provide for better performance.
    Refer to: Variables for Process-Wide Contention Scope
  6. AIXTHREAD_MUTEX_DEBUG (AIX 4.3.3 and later)
    Purpose: Maintains a list of active mutexes for use by the debugger.
    Values: Default: OFF
    Range: ON, OFF
    Display: echo $AIXTHREAD_MUTEX_DEBUG (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_MUTEX_DEBUG={ON|OFF}export AIXTHREAD_MUTEX_DEBUGChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_MUTEX_DEBUG={ON|OFF} command to the /etc/environment file.
    Diagnosis: Setting the variable to ON makes debugging threaded applications easier, but may impose some overhead.
    Tuning: If the program contains a large number of active mutexes and frequently creates and destroys mutexes, this may create higher overhead for maintaining the list of mutexes. Leaving the variable off disables the list.
    Refer to: Thread Debug Options
  7. AIXTHREAD_RWLOCK_DEBUG (AIX 4.3.3 and later)
    Purpose: Maintains a list of read-write locks for use by the debugger.
    Values: Default: ON
    Range: ON, OFF
    Display: echo $AIXTHREAD_RWLOCK_DEBUG (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_RWLOCK_DEBUG={ON|OFF}export AIXTHREAD_RWLOCK_DEBUGChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_RWLOCK_DEBUG={ON|OFF} command to the /etc/environment file.
    Diagnosis: Leaving it on makes debugging threaded applications easier, but may impose some overhead.
    Tuning: If the program contains a large number of active read-write locks and frequently creates and destroys read-write locks, this may create higher overhead for maintaining the list of read-write locks. Setting the variable to OFF will disable the list.
    Refer to: Thread Debug Options
  8. AIXTHREAD_SCOPE (AIX 4.3.1 and later)
    Purpose: Controls contention scope. P signifies process-based contention scope (M:N). S signifies system-based contention scope (1:1).
    Values: Default: P
    Possible Values: P or S
    Display: echo $AIXTHREAD_SCOPE (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_SCOPE={P|S}export AIXTHREAD_SCOPEChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_SCOPE={P|S} command to the /etc/environment file.
    Diagnosis: If fewer threads are being dispatched than expected, then system scope should be tried.
    Tuning: Tests on AIX 4.3.2 have shown that certain applications can perform much better with system based contention scope (S). The use of this environment variable impacts only those threads created with the default attribute. The default attribute is employed when the attr parameter to pthread_create is NULL.
    Refer to: Thread Environment Variables
  9. AIXTHREAD_SLPRATIO (AIX 4.3 and later)
    Purpose: Controls the number of kernel threads that should be held in reserve for sleeping threads.
    Values: Default: 1:12
    Range: Two positive values (k:p), where k is the number of kernel threads that should be held in reserve for p sleeping pthreads
    Display: echo $AIXTHREAD_SLPRATIO (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_SLPRATIO=k:pexport AIXTHREAD_SLPRATIOChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_SLPRATIO=k:p command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: In general, fewer kernel threads are required to support sleeping pthreads, because they are generally woken one at a time. This conserves kernel resources.
    Refer to: Variables for Process-Wide Contention Scope
  10. AIXTHREAD_STK=n (AIX 4.3.3 ML 09 and later)
    Purpose: The decimal number of bytes that should be allocated for each pthread. This value may be overridden by pthread_attr_setstacksize.
    Values: Default: 98,304 bytes for 32bit applications, 196,608 bytes for 64bit applications.
    Range: Decimal integer values from 0 to 268,435,455 which will be rounded up to the nearest page (currently 4,096).
    Display: echo $AIXTHREAD_STK (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: AIXTHREAD_STK=size export AIXTHREAD_STK Change takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding AIXTHREAD_STK=size to the /etc/environment file.
    Diagnosis: If analysis of a failing program indicates stack overflow, the default stack size can be increased.
    Tuning: If trying to reach the 32,000 thread limit on a 32 bit application, it may be necessary to decrease the default stack size.
  11. MALLOCBUCKETS (Version 4.3.3.25 and later)
    Purpose: Enables buckets-based extension in the default memory allocator which may enhance performance of applications that issue large numbers of small allocation requests.
    Values: MALLOCTYPE=buckets

     

    MALLOCBUCKETS=[[ number_of_buckets:n | bucket_sizing_factor:n | blocks_per_bucket:n | bucket_statistics:[stdout|stderr|pathname]],...]

    The following table displays default values of MALLOCBUCKETS. MALLOCBUCKETS Default Values

    MALLOCBUCKETS Options
    Default Value
    number_of_buckets1
    16
    bucket_sizing_factor (32-bit)2
    32
    bucket_sizing_factor (64-bit)3
    64
    blocks_per_bucket
    10244

    Notes:

    1. The minimum value allowed is 1. The maximum value allowed is 128.

    2. For 32-bit implementations, the value specified for bucket_sizing_factor must be a multiple of 8.

    3. For 64-bit implementations, the value specified for bucket_sizing_factor must be a multiple of 16.

    4. The bucket_statistics option is disabled by default.

    Display: echo $MALLOCBUCKETS; echo $MALLOCTYPE
    Change: Use the shell specific method of exporting the environment variables.
    Diagnosis: If malloc performance is slow and many small malloc requests are issued, this feature may enhance performance.
    Tuning: To enable malloc buckets, the MALLOCTYPE environment variable has to be set to the value "buckets".

     

    The MALLOCBUCKETS environment variable may be used to change the default configuration of the malloc buckets, although the default values should be sufficient for most applications.

     

    The number_of_buckets:n option can be used to specify the number of buckets available per heap, where n is the number of buckets. The value specified for n will apply to all available heaps.

     

    The bucket_sizing_factor:n option can be used to specify the bucket sizing factor, where n is the bucket sizing factor in bytes.

     

    The blocks_per_bucket:n option can be used to specify the number of blocks initially contained in each bucket, where n is the number of blocks. This value is applied to all of the buckets. The value of n is also used to determine how many blocks to add when a bucket is automatically enlarged because all of its blocks have been allocated.

     

    The bucket_statistics option will cause the malloc subsystem to output a statistical summary for malloc buckets upon typical termination of each process that calls the malloc subsystem while malloc buckets is enabled. This summary will show buckets configuration information and the number of allocation requests processed for each bucket. If multiple heaps have been enabled by way of malloc multiheap, the number of allocation requests shown for each bucket will be the sum of all allocation requests processed for that bucket for all heaps.

     

    The buckets statistical summary will be written to one of the following output destinations, as specified with the bucket_statistics option.
    stdout
    Standard output
    stderr
    Standard error
    pathname
    A user-specified pathname

     

    If a user-specified pathname is provided, statistical output will be appended to the existing contents of the file (if any). Avoid using standard output as the output destination for a process whose output is piped as input into another process.
    Refer to: Malloc Buckets
  12. MALLOCMULTIHEAP (AIX 4.3.1 and later)
    Purpose: Controls the number of heaps within the process private segment.
    Values: Default: 16 for 4.3.1 and 4.3.2, 32 for 4.3.3 and later
    Range: A positive number between 1 and 32)
    Display: echo $MALLOCMULTIHEAP (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: MALLOCMULTIHEAP=[[heaps:n | considersize],...] export MALLOCMULTIHEAPChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding MALLOCMULTIHEAP=[[heaps:n | considersize],...] command to the /etc/environment file.
    Diagnosis: Look for lock contention on the malloc lock (located in segment F) or fewer than expected runnable threads.
    Tuning: Smaller number of heaps can help reduce size of the process. Certain multithreaded user processes which use the malloc subsystem heavily may obtain better performance by exporting the environment variable MALLOCMULTIHEAP=1 before starting the application.

     

    The potential performance enhancement is particularly likely for multithreaded C++ programs, because these may make use of the malloc subsystem whenever a constructor or destructor is called.

     

    Any available performance enhancement will be most evident when the multithreaded user process is running on an SMP system, and particularly when system scope threads are used (M:N ratio of 1:1). However, in some cases, enhancement may also be evident under other conditions, and on uniprocessors.

     

    If the considersize option is specified, an alternate heap selection algorithm is used that tries to select an available heap that has enough free space to handle the request. This may minimize the working set size of the process by reducing the number of sbrk() calls. However, there is a bit more processing time required for this algorithm.
    Refer to: Thread Environment Variables
  13. SPINLOOPTIME
    Purpose: Controls the number of times to retry a busy lock before yielding to another processor (only for libpthreads).
    Values: Default: 1 on uniprocessors, 40 on multiprocessors
    Range: A positive integer
    Display: echo $SPINLOOPTIME (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: SPINLOOPTIME=nexport SPINLOOPTIMEChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding SPINLOOPTIME=n command to the /etc/environment file.
    Diagnosis: If threads are going to sleep often (lot of idle time), then the SPINLOOPTIME may not be high enough.
    Tuning: Increasing the value from default of 40 on multiprocessor systems might be of benefit if there is pthread mutex contention.
    Refer to: Thread Environment Variables
  14. YIELDLOOPTIME
    Purpose: Controls the number of times to yield the processor before blocking on a busy lock (only for libpthreads). The processor is yielded to another kernel thread, assuming there is another runnable kernel thread with sufficient priority.
    Values: Default: 0
    Range: A positive value
    Display: echo $YIELDLOOPTIME (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: YIELDLOOPTIME=nexport YIELDLOOPTIMEChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding YIELDLOOPTIME=n command to the /etc/environment file.
    Diagnosis: If threads are going to sleep often (lot of idle time), then the YIELDLOOPTIME may not be high enough.
    Tuning: Increasing the value from default value of 0 may benefit if you do not want the threads to go to sleep when waiting for locks.
    Refer to: Thread Environment Variables

Miscellaneous Tunable Parameters

Following is a list of miscellaneous parameters that can be tuned:

  1. EXTSHM (AIX 4.2.1 and later)
    Purpose: Turns on the extended shared memory facility.
    Values: Default: Not set
    Possible Value: ON
    Display: echo $EXTSHM
    Change: EXTSHM=ON export EXTSHMChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding EXTSHM=ON command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: Setting value to ON will allow a process to allocate shared memory segments as small as 1 byte (though this will be rounded up to the nearest page); this effectively removes the limitation of 11 user shared memory segments. Maximum size of all segments together can still only be 2.75 GB worth of memory for 32-bit processes. 64-bit processes do not need to set this variable since a very large number of segments is available. Some restrictions apply for processes that set this variable, and these restrictions are the same as with processes that use mmap buffers.
    Refer to: Extended Shared Memory (EXTSHM)
  2. LDR_CNTRL
    Purpose: Allows tuning of the kernel loader.
    Values: Default: Not set Possible Values: PREREAD_SHLIB, LOADPUBLIC, IGNOREUNLOAD, USERREGS, MAXDATA, DSA
    Display: echo $LDR_CNTRL
    Change: LDR_CNTRL={PREREAD_SHLIB | LOADPUBLIC| ...} export LDR_CNTRLChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding LDR_CNTRL={PREREAD_SHLIB | LOADPUBLIC| ...} command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: The LDR_CNTRL environment variable can be used to control one or more aspects of the system loader behavior. You can specify multiple options with the LDR_CNTRL variable. When doing this, separate the options using an @ character (that is, LDR_CNTRL=PREREAD_SHLIB@LOADPUBLIC). Specifying the PREREAD_SHLIB option will cause entire libraries to be read as soon as they are accessed. With VMM readahead tuned, a library can be read in from disk and be cached in memory by the time the program starts to access its pages. While this method can use more memory, it can enhance performance of programs that use many shared library pages providing the access pattern is non-sequential. (for example, Catia). Specifying the LOADPUBLIC option directs the system loader to load all modules requested by an application into the global shared library segment. If a module cannot be loaded publicly into the global shared library segment then it is loaded privately for the application. Specifying the IGNOREUNLOAD option will cause modules that are marked to be unloaded and used again (if the module has not been unloaded already). As a side effect of this option, you can end up with two different data instances for the module. Specifying the USERREGS option will tell the system to save all general-purpose user registers across system calls made by an application. This can be helpful in applications doing garbage collection. The MAXDATA option for the LDR_CNTRL variable allows you to set or override maxdata value specified in an executable. If you want to use Large Program Support with a data heap size of 0x30000000, then specify LDR_CNTRL=MAXDATA=0x30000000. To turn off Large Program Support, specify LDR_CNTRL=MAXDATA=0. Specifying the DSA (Dynamic Segment Allocation) option will tell the system loader to run applications using Very Large Program Support. The DSA option is only valid for 32-bit applications with a non-zero maxdata value.
  3. NODISCLAIM
    Purpose: Controls how calls to free() are being handled. When PSALLOC is set to early, all free() calls result in a disclaim() system call. When NODISCLAIM is set to True, this does not occur.
    Values: Default: Not set
    Possible Value: True
    Display: echo $NODISCLAIM
    Change: NODISCLAIM=true export NODISCLAIMChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding NODISCLAIM=true command to the /etc/environment file.
    Diagnosis: If number of disclaim() system calls is very high, you may want to set this variable.
    Tuning: Setting this variable will eliminate calls to disclaim() from free() if PSALLOC is set to early.
    Refer to: Early Page Space Allocation
  4. NSORDER
    Purpose: Overwrites the set name resolution search order.
    Values: Default: bind, nis, local
    Possible Values: bind, local, nis, bind4, bind6, local4, local6, nis4, or nis6
    Display: echo $NSORDER (this is turned on internally, so the initial default value will not be seen with the echo command)
    Change: NSORDER=value, value, ... export NSORDERChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding NSORDER=value command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: NSORDER overrides the /etc/netsvc.conf file.
    Refer to: Tuning Name Resolution
  5. PSALLOC
    Purpose: Sets the PSALLOC environment variable to determine the paging-space allocation policy.
    Values: Default: Not set
    Possible Value: early
    Display: echo $PSALLOC
    Change: PSALLOC=early export PSALLOCChange takes effect immediately in this shell. Change is effective until logging out of this shell. Permanent change is made by adding PSALLOC=early command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: To ensure that a process is not killed due to low paging conditions, this process can preallocate paging space by using the Early Page Space Allocation policy. However, this may result in wasted paging space. You may also want to set the NODISCLAIM environment variable.
    Refer to: Allocation and Reclamation of Paging Space Slots and Early Page Space Allocation
  6. RT_GRQ (AIX 4.3.3.1 and later)
    Purpose: Causes thread to be put on a global run queue rather than on a per-CPU run queue.
    Values: Default: Not set; Range: ON, OFF
    Display: echo $RT_GRQ
    Change: RT_GRQ={OFF/ONexport RT_GRQChange takes effect immediately. Change is effective until next boot. Permanent change is made by adding RT_GRQ={ON|OFF} command to the /etc/environment file.
    Diagnosis: N/A
    Tuning: May be tuned on multiprocessor systems. Set to ON, will cause the thread to be put on a global run queue. In that case, the global run queue is searched to see which thread has the best priority. This might allow to get the thread dispatched sooner and can improve performance for threads that are running SCHED_OTHER, and are interrupt driven.
    Refer to: Scheduler Run Queue
  7. RT_MPC (AIX 4.3.3 and later)
    Purpose: When running the kernel in real-time mode (see bosdebug command), an MPC can be sent to a different CPU to interrupt it if a better priority thread is runnable so that this thread can be dispatched immediately.
    Values: Default: Not set; Range: ON
    Display: echo $RT_MPC
    Change: RT_MPC=ON
    export RT_MPC
    Change takes effect immediately. Change is effective until next boot. Permanent change is made by adding RT_MPC=ON command to the /etc/environment file.
    Diagnosis: N/A

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]