Skip to end of metadata
Go to start of metadata

Overview

This document provides guides for setting appropriate values of kernel parameters and various user environment settings for installing and operating Altibase in Hewlett Packard Unix (UPUX) Operating System.

In this document, the guide is presented only for the operating system related items to be set before Altibase is installed, and refer to the separate document "Altibase Configuration File Guide" for setting Altibase properties for setting Altibase itself.

Kernel Parameters

When operating Altibase on the HPUX operating system, it describes the types of kernel parameters that need to be changed and why they need to be changed and introduces how to change the kernel parameters.

For details related to each kernel parameter, please refer to the guide provided by HP.

Shared Memory

When developing an application program, there is a need for two or more processes to exchange information. The operating system provides a resource called IPC (Inter Process Communication). Among various IPC resources, the memory area used by two or more processes to exchange information is called shared memory.

When the Altibase server and client use the IPC connection method, shared memory is used as a communication buffer, so the kernel parameter values such as the maximum size for the part using memory or the number of segments must be set correctly.

The recommended kernel parameters and Altibase values related to shared memory in a typical Unix system are as follows.

Kernel ParameterDescriptionRecommended Value
shmmaxThe maximum size of one shared memory segment2GB+1
shmmniThe maximum number of shared memory segments in the system500 or more
shmsegThe maximum number of shared memory segments attached to one process200 or more
  • IPC_CHANNEL_COUNT: Maximum number of IPC connections that can connect to the Altibase server at the same time

Semaphore

This is a kind of IPC resource like shared memory. The difference is the shared memory is provided as a way to shared data between processes, while semaphores are resources provided by the operating system as a way to implement synchronization between processes.

Synchronization means that only one process can access and change a specific resource or object at a time (unlike mutex, an inquiry is possible at the same time).

As described above, Altibase uses shared memory as a communication buffer between both ends when the Altibase server and client exist in the local server. At this time, it is necessary to control the concurrency of the memory. (Because the user should not write at the same time)

In this case, a semaphore operation occurs to control access to read/write access to memory.

Depending on the semaphore operation, the process can go into a waiting state or a progress state. Since these semaphore operations occur simultaneously, it is necessary to set the appropriate number of semaphores and kernel parameters for the operation.

The kernel parameters related to semaphores in a typical Unix system are as follows.

Kernel ParameterDescriptionRecommended Value
semmniThe maximum number of semaphore sets in the system. 84 bytes of kernel memory are allocated per set5029
semmnsThe maximum number of semaphores in the system, with 16 bytes of kernel memory allocated8192
semmslThe maximum number of semaphores in a set of semaphores and must be logically less than or equal to semmns If set too large, several semaphore IDs can monopolize the entire system semaphore.2000
semmnuThe maximum number of undo structures in the system1024
semumeThe maximum number of undo entries per process512
semvmxThe maximum value of one semaphore32767
  • IPC_CHANNEL_COUNT: The maximum number of IPC connections that can connect to the Altibase server at the same time

File Cache 

This kernel parameter is not required to be changed, but it suppresses the requirement of swap out the memory area used by Altibase by setting the appropriate file cache. It is also recommended because the disk I/O latency of the operating system layer due to swapping leads to Altibase's performance degradation.

File cache is a kind of system buffer managed at the operating system level to solve the bottleneck caused by the speed difference between main memory device and auxiliary memory device. These file caches are managed by unique policies of each operating system. But commonly have a direct correlation with the swap policy.

Swapping itself has the usefulness of handling applications or data files larger than main memory, but in systems where long-term resident applications such as DBMS are operated, the disk I/O delay of the operating system layer due to swappdbc_min_pcting since the response time of the DBMS may be irregular or delayed with time. So file cache is a consideration factor depending on the system use.

Therefore, in order to guarantee Altibase's consistent response time, it is recommended to set file cache and swap-related kernel parameters in advance so that swap does not occur as much as possible.

Configuration on HPUX

It is recommended to adjust the file cache through the kernel parameters below.

Kernel ParameterDescriptionRecommended Value
dbc_min_pctLimits the minimum size of the file cache to a percentage of total memory. The default value is 5%.
Since HPUX 11.31, the name is changed to filecache_min.
5%
dbc_max_pctLimits the maximum size of the file cache to a percentage of total memory. The default value is 50%. Since HPUX 11.31, the name is changed to filecache_max.5~20%

For reference, HP's recommendation for dbc_max_pct is 20% for systems with 8 GB or less physical memory and 10% for systems with 8 GB or more, so refer to it.

Resource Limitation

In the case of HPUX, some of the resource limit items are set through the following kernel parameter changes, not the user configuration file set using the ulimit, which is commonly used.

Kernel ParameterDescriptionRecommended Value
maxdizThe sum of allocable data segments by one 32-bit process2 GB
maxdsiz_64bitThe sum of allocable data segments by one 64-bit process1 TB Up to 4 TB 
Considering the maximum size of the predicted Altibase process
max_thread_procThe maximum number of threads a process can have600 or more
maxfilesThe maximum number of files that a process can open simultaneously (soft-limit) Can be increased to maxfiles_lim (hard-limit).2048 or more
nprocThe maximum number of processes in the system6142
maxusersDefault values of nproc, callout, ninode, and file124 
Only under 11.23

In the case of “maxusers”, since HPUX 11.23 has disappeared, it is not necessary to consider it in HPUX 11.23 or later. In HPUX 11.23 and below, instead of setting “nproc” directly, setting “maxusers” to 124 is replaced.

How to Change

In the case of HPUX, the Tunable kernel parameter utility (kmtune in HPUX 11.11, kctune is mainly used in HPUX 11.23 or later) or the utility called sam, which can change all kernel parameters in the system, is mainly used to modify kernel parameters. Here is an example of using kctune.

Generally, the user needs to connect with the root account, and it is recommended to restart the system after changing to properly apply when the kernel parameters applied in real-time.

Shared Memory

If there was no separate configuration before, the user can change shmmni and shmseg by changing kernel parameters related to shared memory.

Shared memory change example

Semaphore

If there was no separate setting before, the user can change only semmns, semmni, semmnu, and semume by changing kernel parameters related to semaphores.

Semaphore change example

File Cache

For dbc_max_pct, according to HP's recommendation, 20% is recommended for systems with 8 GB or less physical memory, and 10% for systems with 8 GB or more.

Example of file cache change

Resource Limitation 

The method to change the kernel parameters related to the resource limit mentioned above is as follows.

Example of changing resource limits

In HPUX 11.23 and below, "nproc" is not set directly, but "maxusers" is set to 124.


User Settings

This section describes resource limits, environment variables, and various environment settings of user accounts in the system for operating Altibase in the HPUX operating system.

Refer to the guide provided by HP for specific commands and specifics related to configuration.

Resource Limitation

In the UNIX operating system, logical limits are set for available resources on a user account basis. Among the resource limit items, the items that need to be expanded for stable service operation as follows.

ItemDescriptionRecommended Value
virtual memory (memory)The maximum size of available virtual memoryunlimited
open files (nofiles)The maximum number of files that can be accessed simultaneously by one process
unlimited
max user processThe number of processes that can be created per userunlimited
max memory size (rss)The maximum size of available memoryunlimited
file size (fsize)The maximum size of files that can be createdunlimited
data seg size(data)The maximum size of one process data areaunlimited

The resource limit change is to proactively remove problems that may occur due to logical limitations even when there is a lot of physical resources when expanding the memory and data file area used by a specific user. It is recommended to set as unlimited as possible.

For example, the meaning of open files includes the number of communication sockets as well as the files accessed by the process, so the maximum number of concurrent clients, the number of data files used simultaneously, the number of redo log files, and the number of trace log files must be considered.

To change the method, edit the environment configuration file using the ulimit command, edit the system resource configuration file, or use the kernel-related utilities provided for each operating system.

Hard-Limit & Soft-Limit

Resource limit values are divided into the concept of hard-limit and soft-limit.

The hard-limit means the maximum value of the kernel-wide resource limit that cannot be changed except the root account, and the soft-limit means that the current user account can change up to the hard-limit. (Refer to the ulimit –S / -H option for details.)

The soft-limit is effective while the user maintains a session by accessing it, and changes are immediately reflected. However, if other sessions of the same user account are connected, the existing soft-limit is reflected, so it is recommended to add the ulimit command to the user account configuration file.

However, this method may not be intended due to the global hard-limit, so it is recommended to systematically apply it through editing system-wide resource configuration files rather than applying user account units using environment configuration files.

However, since HPUX does not have a system-wide resource configuration file, sam or kctune is used to change the hard-limit for resource limitation.

Environment Variables

The environment variables that must be set are as follows. Set the following environment variables in the environment configuration file of the user account according to the user's shell syntax.

Environment VariableDescription
ALTIBASE_HOMESpecifies the path where Altibase is installed.
PATHSpecifies the path where Altibase's utilities and shell scripts. Adds ALTIBASE_HOME/bin.
LD_LIBRARY_PATHSpecifies the path where Altibase's dynamic library. Adds ALTIBASE_HOME/lib.

In addition, the following environment variables that exist only in HPUX must be added.

Environment VariableDescription
SHLIB_PATHAdds ALTIBASE_HOME/lib. Set when linking a dynamic library with 32 bits.

Settings for Multi-threaded Application (1)

For Altibase, a multi-thread-based application program, a separate environment variable setting is required. For reference, this document mentions only representative ones, and it should be noted that all multi-thread-related environment variables supported by HPUX need to be considered.

All of the elements below are essential. Among them, the environment variable PTHREAD_FORCE_SCOPE_SYSTEM related to the MxN thread model must be set.

Environment VariableDescriptionRemark
PTHREAD_FORCE_SCOPE_SYSTEMSet the thread contention area as the systemSupported in HPUX 11.23 or later
PERF_ENABLEOmit part of user-space sleep queue operationHPUX 11.23 only
PTHREAD_FAST_SHARED_OBJECTSApplication of the private algorithm to shared objectsSupported in HPUX 11.31 or later
PTHREAD_DISABLE_HANDOFFApplication of multiple CPU environmentSupported in HPUX 11.23 or later

For PERF_ENABLE, from HPUX 11.31 onwards, it is included in PTHREAD_FORCE_SCOPE_SYSTEM and is not considered in HPUX 11.31 or later.

Settings for Multi-threaded Application (2)

It is mentioned that this is also a tunable element that cannot provide a recommended value as a setting for a multi-thread-based application, or something to be considered in the initial stage.

In an operating system that uses only one memory allocation area to request memory for a specific process, when multiple threads of a multi-threaded application program concurrently request memory (malloc, free), contention due to a lock operation occurs, resulting in performance degradation.

To solve this problem, HPUX provides up to 64 memory allocations per process, called arenas, to distribute threads between arenas to reduce lock contention caused by memory request.

It can be set with the following environment variables.

Environment VariableDescriptionRemark
_M_ARENA_OPTS=x:yx: The number of arenas to be allocated per process. The default value is 8. [Range: 1-64]  
y: The expansion unit of the arena, expressed as the number of memory pages. The default is 32. [Range: 1-4096]
The larger the number of arenas (x), the more the system memory usage increases, and the smaller the performance of the Altibase decreases, so it is necessary to set the appropriate number.

Generally, if it is not a multi-threaded application, it operates as one arena regardless of setting, and when it is set as an invalid value, it operates as a default.

For example, if the user sets up as follows, 24 arenas are allocated to multi-threaded applications only, and each arena increases in units of 64*4KB (typical memory page size) when expanded.

_M_ARENA_OPTS setting example

In general, the higher the number of threads in an application program, the higher the number of arenas to improve performance.

However, if it is set too large, fragmentatiCompatible with data seg sizeon of the heap area may occur, and the size of the process may be too large due to the inefficient use of memory.

For example, if there is a concern about insufficient memory due to the lack of physical memory of the system itself, in some cases, it is set to 1: 8 to operate as a single-threaded application program. If the bottleneck is related to a memory request (malloc/free), it is common to increase the value within the resource range.

Multi-Thread Related Patch

Altibase is a single process, multi-threaded application. Therefore, a multi-thread related HPUX patch is needed. Among these, 'thread library cumulative patch' has a direct effect on performance, so it must be checked whether a patch exists.

The method to check the patch list of the current system is as follows.

How to check multi-thread related patch

In addition to this, it is recommended to apply the latest patch to avoid various problems known from HPUX.

Additional Considerations When Applying PHCO_33675 and PHCO_34718

When the patch was applied in HPUX 11.23, it was reported through HP that the application program kept the shared mutex for a longer period of time and deteriorated the performance.

After checking the patch list, if the patch exists, the following environment variables should be added and set to 1 to restore system performance.

Environment VariableDescriptionRemark
PTHREAD_SHARED_MUTEX_OLDSPINPerformance downgrade due to PHCO_33675, PHCO_34718Considered only on HPUX 11.23

Summary

For stable operation of Altibase in the HPUX operating system, it is necessary to perform kernel parameter settings and user environment settings in advance. If the setting is not performed properly, it should be noted that the problem can be caused by the limited values even though there are sufficient system resources.

Kernel Parameters

Refer to the table below to set the kernel parameters properly. For reference, in HPUX, some of the resource limit items are adjusted by changing kernel parameters.

ClassificationKernel ParameterRecommended ValueRemark
Shared memoryshmmni500 or more> shmseg
Shared memoryshmseg200 or more 
Semaphoresemmns8192 
Semaphoresemmni5029 
Semaphoresemmnu5029semmni
Semaphoresemume5029semmni
File cachedbc_min_pct5 or less 
File cachedbc_max_pct20 or less20% recommended for systems with 8 GB or less physical memory, 10% recommended for systems with 8 GB or more
Resource limitmaxdsiz2GBCorresponds to data seg size (32bit)
Resource limitmaxdsiz_64bit1 TB / Maximum: around 4TBCorresponds to data seg size (64bit)
Resource limitmaxfiles5029 or moreCorresponds to open files
Resource limitmax_thread_proc5029 or more 
Resource limitnproc6142Corresponds to max user process 
>= semmnu + 4
Resource limitemaxusers124Not available starting in HPUX 11.23

User Resource Limitation

Please refer to the table below and set it as unlimited as possible.

ClassificationDescriptionRecommended Value
data set size (data)The maximum size of process data areamaxdsiz maxdsiz_64bit unlimited
file sizeThe maximum size of created fileunlimited
open files (no files)The maximum number of files that can be accessed by more process at the same timemaxfiles unlimited
max memory size (rss)The maximum size of available memoryunlimited
max user processThe number of processes that can be created per usernproc unlimited

User Environment Variables

In the case of sh, bash, ksh, examples of setting required environment variables using the environment setting file are as follows. In the case of csh, it is set through a shell command such as setenv instead of export.

User environment variable setting example

For reference, in the case of ksh, an error may occur when defining another environment variable using the environment variable without the environment variable being predefined.

In the above example, “_M_ARENA_OPTS” is simply a default value, and should be properly set according to the system. For details, refer to “Configuration for Multi-threaded Application (2)” in the [Environment Variables] section.

In addition, refer to "Additional consideration when applying PHCO_33675 and PHCO_34718" in the [Multi-thread related patches] section.



  • No labels