Consultor Eletrônico



Kbase P61278: Tips on tuning the Unix Kernel for Applications
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/31/2011
Status: Verified

GOAL:

Tuning the UNIX Kernel tips and recommendations for Progress Applications.

GOAL:

What are the Progress related kernel parameters?

GOAL:

Suggestions for tuning the UNIX Kernel parameters for Progress

GOAL:

Tips on tuning the UNIX Kernel for Applications

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
UNIX

FIX:

This solution outlines the UNIX kernel parameters that might require tuning as a result of installing a Progress application.

In many cases the default values for most of the UNIX kernel are sufficient. In other cases, the Progress application runs for some time without requiring any kernel tuning but as more users are added to the UNIX system and/or the number of processes executed increases, Progress might return system errors that indicate a shortage of some resource (memory, number of files that can be opened by a user ...).

When this happens it might be necessary to re-tune the kernel parameters and generate a new kernel.

Where applicable, this solution indicates whether a particular parameter is no longer required, where the value for the parameter is now dynamically allocated in some UNIX or Linux Systems, or where parameter in a Version of UNIX is superseded by another UNIX Version kernel parameter.

NOTE: Kernel parameter names vary from system to system. This solution provides an overview so that you can direct the user/customer to the correct kernel parameter on the particular system. If you are in doubt, consult your UNIX system documentation.

This Solution is only for informative purposes.

What is the kernel?

The kernel is the heart of the UNIX operating system. It manages memory, schedules processes, manages I/O, and does all other lower-level tasks that make the system work. The kernel is not a process (like the programs that you run from a terminal). It pre-exists all processes and is responsible for starting the first process.

Because it is so important, the kernel has some key privileges. It is always resident in the processor's physical memory. Other programs can be swapped or paged to disk, but not the kernel.

Current kernel parameter values can be seen as follows:

The name of the kernel configuration file and its location varies from system to system.

On System V machines, look for the configuration files in /etc/conf/cf.d. The tunable parameters are usually located in the mtune file. Normally there is a second file in the kernel configuration directory that is used to modify the parameters (Never modify the master file mtune).
This second file (sometimes called stune) is used to modify a parameter to any value between the minimum and maximum values defined in the master file (mtune).

NOTE: If you are in doubt, consult your system documentation.

On some System V systems, you can log in as root and type "sysdef" at the command line to see the current values. If this is not possible, you could enter the system administration shell (a menu-driven interface SMIT on AIX, sysadmsh on SCO) and view the kernel settings.

Some example directory locations for the files are:

/etc/conf/cf.d
/usr/kvm/sys/sun4/conf
/stand/system

The most common important kernel parameters are as follows.

General Kernel Parameters:

NPROC:
The maximum number of simultaneous processes that the system can run.

MAXPROC, MAXUP:
The maximum number of processes that any user (any user ID number) can have at one time.

NFILE:
The maximum number of files (system-wide) that can be open at any time.

NOFILES or NFILE:
The maximum number of open files the process might have. When this limit is exceeded, attempts to open files fails and errno is set to EMFILE.

ULIMIT:
The size of the largest file that a process can create. There are user-level ways of overriding this kernel limit, such as the ulimit command and the ULIMIT line in /etc/default/login.

Memory Management Parameters:

MAXUMEM:
The maximum amount of memory that is used to run a process.

MAXPMEM:
Specifies the amount of physical memory in use ages. The value 0 means "use all of. physical memory".

SVMMLIM and HVMMLIM:
NOTE: In the following parameters, the "S" prefix indicates soft limits, and "H" the hard limits. Any user process can change its soft limits up to the corresponding hard limit. Only root can increase the hard limits.

SVMMLIM:
The soft limit that specifies the maximum address space that can be mapped to a process. Attempts to increase a process's address space beyond this value fails with an ENOMEM error.

HVMMLIM:
The maximum value of SVMMLIM.

Streams Parameters:

Progress only requires STREAMS to be installed. It does not require specific values for the streams parameters. When you see the system Error:

793 - Select Ret -1, errno 11 you must install streams.

Inter-Process Communication (IPC) Parameters:

SHMMNI:
The maximum number of shared memory identifiers allowed for the system.

SHMALL:
The maximum number of in-use shared memory segments allowed for the system. Some systems do not have this parameter. Some Systems increase this value dynamically.

SHMMAX:
The maximum size of a single shared memory segment. Some systems call this parameter SHMSIZE.


SHMSEG:
The maximum number of shared memory segments a single process can attach to. Some systems do not have this parameter. Some Systems increase this value dynamically.

SEMMNI:
The maximum number of semaphore identifiers that are allowed for the system.

SEMMSL:
The maximum number of semaphores allowed per semaphore identifier (semaphore set).

SEMMNS:
The total number of semaphores allowed for the system.

SEMMNU:
The maximum number of semaphore undo structures allowed for the system.

Progress and General Kernel Parameters:

As more processes are executed simultaneously on a machine, it might be necessary to increase the NPROC parameter. If you exceed the NPROC or NSWAP parameter, Progress returns the error message:

Too many subprocesses, cannot fork. Errno=<number>. (358)

Unable to fork process.

Progress statements OUTPUT THROUGH and INPUT THROUGH open pipes to UNIX that create additional processes on the system. If the problem is related to NSWAP, you could try reducing the local buffer (-l) or edit buffer (-e) start up parameters.

In some cases, one particular user could require additional processes to be executed and might require the MAXPROC, MAXUP parameter to be increased.
If additional files are opened as a result of increasing the number of processes that are executed or as a result of converting a database from single volume to multi volume, you might need to increase the NFILE, NFILES parameters.

Progress and UNIX shared memory:

Progress uses shared memory to allow multiple server processes and self-service client processes concurrent access to a database, and to coordinate their activities.

The shared memory area contains the buffer pool, lock table, log buffers, and other shared data structures. When the database is started (via the PROSERVE command), the broker creates and initializes the shared memory area of the required size. The size is based on the values of various startup parameters that determine the sizes of the data structures.

In UNIX systems, shared memory consists of one or more segments. Each segment is identified by a system-wide unique number that is assigned by the process that creates the segment. Progress derives the identifier from the inode of the .db file.

There are several UNIX kernel parameters that limit the number and size of shared memory segments. In addition, Progress has an internal limit on the size of a single shared memory segment. If the shared memory size computed by the broker is larger than the maximum segment size allowed, the broker creates multiple s.egments to reach the required total.

The total amount of shared memory that can be allocated is:

SHMMAX * SHMALL (or SHMMAX * SHMMNI).

When you install Progress, you might have to increase the values of these parameters. Note that if you are running other software that also uses shared memory, you must take into account the combined requirements.

Recommended settings:

NOTE: The following recommended settings are for Progress applications. The values required by Progress must be added to the current kernel parameter values. In other words, the following recommendations do not take into account the requirements of the UNIX operating system and/or any other application that uses shared memory and semaphores. Consult your system documentation to determine UNIX's requirement.

SHMMNI:
Depends on the number of active databases, the values of startup parameters, and the value of SHMMAX. The larger SHMMAX is, the fewer segments Progress creates. 64 is probably a good value to start with. If you set this value too low, you might get Progress Error 1137 or 1138.

SHMALL:
The same as SHMMNI. If you set this value too low, you might get Progress Error 1137 or 1138.

SHMSEG:
The setting depends on the number of active databases, the values of startup parameters, and the value of SHMMAX. The larger SHMMAX is, the fewer segments Progress creates. When self-service clients connect to multiple databases, the shared memory segments for the database are attached. 16 is probably a good value to start with. If you set this value too low, you may get Progress Error 1175, 1719, or 1720.

SHMMAX:
This parameter limits the size of a single segment. Progress creates one smaller segment if less shared memory is needed.

If you set this value too low, Progress creates many small segments, possibly overflowing the limits SHMMNI, SHMSEG, or SHMALL.

The units that you use to specify a value for SHMMAX vary from system to system. Some units use bytes, others use "clicks" (page size). Consult your system manuals for the proper units.

NOTE: The amount of kernel memory required for shared memory descriptions (not the shared memory itself) is relatively small, so setting SHMSEG, SHMMNI, SHMALL higher than your current needs probably won't affect performance.

Shared memory is not used for single-user sessions. Clients that connect to a remote database on a server machine do not use shared memory on the client machine.

NOTE: The Blocks in Database Buffers (-B), Lock-table Entries (-L), and Number of Users (-n) startup parameters all affect shared-memory usage. The Number of Users (-n) and Maximum Servers (-Mn) parameters affect semaphore usage (each user or server process uses one semaphore). Before reconfiguring your kernel to increase shared memory or semaphore allocation, see whether you can lower these startup values.

Progress and UNIX Semaphores:

Progress uses UNIX Semaphores to synchronize the activities of server processes and self-service client processes that are connected to a database. The semaphores are created and initialized by the broker when the database is started.

UNIX semaphores are grouped into semaphore sets. Each semaphore set has a unique identifying number called a semid. Within a semaphore set, individual semaphores are identified by an integer that ranges from 0 to one less than the size of the semaphore set.

The Progress broker creates a semaphore set when the database is started. The original recommended size of the semaphore set is the number of users (-n parameter) plus the number of servers (-Mn parameter) plus 4, however, the newer versions have add more auxiliary processes. The number of semaphores within a semaphore set is determined by the -n and -Mn startup parameter for each database. You need to include any Progr.ess auxiliary process in the -n count in addition to the license count, i.e. APWs, AIW,BIW, WDOG, replication process, online backup, extra promon sessions, etc. As we plan to utilize additional auxiliary process, we need to add more to the -n values to account for them.

Recommended settings:

SEMMNI:
One per active database. If you set this value too low, you might get Progress Error 1131.

SEMMSL:
Maximum number of users on any database plus (+) the maximum number of servers for any database plus (+) 4 plus (+) the number of Asynchronous Page Writers (APW) plus (+) Before Image Writer (BIW) plus (+) After Image Writer (AIW) plus (+) Watchdog Process. The newer versions have additional auxiliary process that need to be added to the -n count if they plan to utilize them.
If you set this value too low, you might get Progress Error 1093 or 1130.

SEMMNS:
SEMMSL multiply by (*) the number of active databases. If you set this value too low, you might get Progress Error 1093, 1131 or 1195.

SEMMNU:
Set equal to one per Progress process connecting to a database. (each server process, self-service client, page writer [6.3], BI writer [6.3], AI writer [6.3], watchdog[6.3], PROSHUT. PROMON.
If you set this value too low, you might get Progress Error 1081.

To avoid system errors set SEMMNU = SEMMNS. Some systems do not have this value as a tunable.

NOTE: The amount of kernel memory required for semaphores is relatively small, so setting the limits higher than your current needs probably won't affect performance.

Semaphores are not used for single user sessions. Clients that connect to a remote database on a server machine do not use semaphores on the client machine.

MAXUMEM: Maximum address space for a single user.
.