[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Communications Programming Concepts

STREAMS Tunable Parameters

Certain system parameters referenced by STREAMS are configurable during system boot or while the system is running. These parameters are tunable based on requirements. There are two types of STREAMS tunable parameters: load-time configurable and run-time configurable parameters. At boot time, the strload command loads the STREAMS framework in the AIX kernel. This command is used to set both types of parameters using a configuration file. To configure the run-time parameters, use the no command. The no command also displays all the parameter values.

Load-Time Parameters

The load-time parameters can only be set at initial STREAMS load time. The strload command reads the parameter names and values from the /etc/pse_tune.conf file. This file can be modified by privileged users only. It contains parameter names and values in the following format:

# Streams Tunable Parameters
#
# This file contains Streams tunable parameter values. 
# The initial values are the same as the default values. 
# To change any parameter, modify the parameter value and
# the next system reboot will make it effective. 
# To change the run-time parameter, use the no command any time.
strmsgsz        0        # run-time parameter
strctlsz        1024     # run-time parameter
nstrpush        8        # load-time parameter
psetimers       20       # run-time parameter
psebufcalls     20       # run-time parameter
strturncnt      15       # run-time parameter
strthresh       85       # run-time parameter, 85% of "thewall"
lowthresh       90       # tun-time parameter, 90% of "thewall"
medthresh       95       # run-time parameter, 95% of "thewall"
pseintrstack    12288    # load-time parameter, (3 * 4096)

The initial values are the same as the default values. If the user changes any values, they are effective on the next system reboot. If this file is not present in the system or if it is empty, the strload command will not fail, and all the parameters are set to their default values.

The load-time parameters are as follows:

nstrpush Indicates the maximum number of modules that can be pushed onto a single STREAM. The default value is 8.
psetintrstack Indicates the maximum number of the interrupt stack size allowed by STREAMS while running in the offlevel. Sometimes, when a process, running other than INTBASE level, enters a STREAM, it encounters stack overflow problems because of not enough interrupt stack size. Tuning this parameter properly reduces the chances of stack overflow problems. The default value is 0x3000 (decimal 12288).

Run-Time Parameters

These parameters can be set using the no -o command or the no -d command, and they become effective immediately. If a user tries to set a load-time parameter to its default value or to a new value using the no command, it returns an error. The no -a Parameter and no -o Parameter commands show the parameter's current value.

The run-time parameters are as follows:

strmsgsz Specifies the maximum number of bytes that a single system call can pass to a STREAM to be placed into the data part of a message (in M_DATA blocks). Any write subroutine exceeding this size will be broken into multiple messages. A putmsg subroutine with a data part exceeding this size will fail returning an ERANGE error code. The default value is 0.
strctlsz Specifies the maximum number of bytes that a single system call can pass to a STREAM to be placed into the control part of a message (in an M_PROTO or M_PCPROTO block). A putmsg subroutine with a control part exceeding this size will fail returning an ERANGE error code. The default value is 1024.
strthresh Specifies the maximum number of bytes STREAMS are allowed to allocate. When the threshold is passed, users without the appropriate privilege will not be allowed to open STREAMS, push modules, or write to STREAMS devices. The ENOSR error code is returned. The threshold applies only to the output side; therefore, data coming into the system is not affected and continues to work properly. A value of 0 indicates there is no threshold.

The strthresh parameter represents a percentage of the value of the thewall parameter, and its value can be set between 0 and 100, inclusively. The thewall parameter indicates the maximum number of bytes that can be allocated by STREAMS and sockets using the net_malloc subroutine. The user can change the value of the thewall parameter using the no command. When the user changes the value of the thewall parameter, the threshold gets updated accordingly. The default value is 85, indicating the threshold is 85% of the value of the thewall parameter.

psetimers Specifies the maximum number of timers allocated. In AIX, the STREAM subsystem allocates a certain number of timer structures at initialization time, so the STREAMS driver or module can register the timeout requests. Lowering this value is not allowed until the system reboots, at which time it returns to its default value. The default value is 20.
psebufcalls Specifies the maximum number of bufcalls allocated. In AIX, the STREAM subsystem allocates a certain number of bufcall structures at initialization time. When an allocb subroutine fails, the user can register requests for the bufcall subroutine. Lowering this value is not allowed until the system reboots, at which time it returns to its default value. The default value is 20.
strturncnt Specifies the maximum number of requests handled by the currently running thread for module- or elsewhere-level STREAMS synchronization. The module-level synchronization works in such a way that only one thread can run in the module at any given time, and all other threads trying to acquire the same module enqueue their requests and exit. After the currently running thread completes its work, it dequeues all the previously enqueued requests one at a time and starts them. If there are large numbers of requests enqueued in the list, the currently running thread must serve everyone. To eliminate this problem, the currently running thread serves only the strturncnt number of threads. After that, a separate kernel thread starts all the pending requests. The default value is 15.
lowthresh Specifies the maximum number of bytes (in percentage) allocated by the thewall parameter using allocb for the BPRI_LO priority. When the total amount of memory allocated by the net_malloc subroutine reaches this threshold, the allocb request for the BPRI_LO priority returns 0. The lowthresh parameter can be set to any value between 0 and 100, inclusively. The default value is 90, indicating the threshold is at 90% of the value of the thewall parameter.
medthresh Specifies the maximum number of bytes (in percentage) allocated by the thewall parameter using allocb for the BPRI_MED priority. When the total amount of memory allocated by the net_malloc subroutine reaches this threshold, the allocb request for the BPRI_MED priority returns 0. The medthresh parameter can be set to any value between 0 and 100, inclusively. The default value is 95, indicating the threshold is 95% of the value of the thewall parameter.

[ Previous | Next | Contents | Glossary | Home | Search ]