HP-UX Setup Guide for Altibase#
Overview#
This document describes the kernel parameters and OS user environment that you need to configure to run Altibase reliably on HP-UX. For each item, it first explains the recommended value and the reason for it, and then shows how to check and change the current setting.
This document is based on HP-UX 11.23 and 11.31. Differences between versions are described in the relevant sections.
For Altibase property settings, see Altibase Configuration File Guide. Also refer to Altibase 7.1 Installation Guide - Appendix A. Installation Prerequisites and Altibase Supported Platforms.
Info
For errors and improvements related to this document, please contact the technical support portal or technical support center.
- Technical support portal: http://support.altibase.com/en
- Technical support center: +82-2-2082-1114
Info
This document is provided for informational purposes only and is subject to change without prior notice. It may contain errors, and Altibase makes no express or implied warranties of any kind, including but not limited to warranties of merchantability or fitness for a particular purpose.
The development, release, and timing of any features or functionality described for Altibase products in this document are at the sole discretion of Altibase.
Altibase may hold patents, trademarks, copyrights, or other intellectual property rights related to the contents of this document.
Kernel Parameters#
On HP-UX, you check and change kernel parameters with the kctune command. You can also use sam, the system administration tool. This document shows examples that use kctune.
Changing kernel parameters requires root privileges. Some kernel parameters take effect immediately, but we recommend that you restart the OS after the change to make sure the settings are applied correctly.
Shared Memory and Semaphores#
The OS provides IPC (Inter Process Communication) resources so that multiple processes on a server can exchange information. Shared memory and semaphores are IPC resources, and Altibase needs them when the Altibase server and clients on the same server communicate over IPC.
Shared Memory#
Shared memory is the IPC resource that processes use as a memory area for exchanging information. Because Altibase uses shared memory as the communication buffer, you must set the maximum size and maximum number of shared memory segments appropriately with kernel parameters.
The shared memory kernel parameters on HP-UX and the values that Altibase recommends are as follows.
| Kernel Parameter | Description | Recommended Value |
|---|---|---|
| shmmax | The maximum size of a single shared memory segment. | 2GB+1 |
| shmmni | The maximum number of shared memory segments in the system. Set it larger than shmseg. | 500 or more |
| shmseg | The maximum number of shared memory segments that a single process can attach. | 200 or more |
Semaphores#
A semaphore is a resource that the OS provides to restrict access to shared resources in IPC. Altibase controls concurrent reads and writes on the communication buffer with semaphore operations. Semaphore operations occur concurrently in large numbers, so you must set the kernel parameters according to the number of semaphores and operations.
The semaphore kernel parameters on HP-UX and the values that Altibase recommends are as follows.
| Kernel Parameter | Description | Recommended Value |
|---|---|---|
| semmni | The maximum number of semaphore sets in the system. | 5029 |
| semmns | The maximum number of semaphores in the system. | 8192 |
| semmsl | The maximum number of semaphores in a single semaphore set. It must not exceed semmns. If it is set too large, a few semaphore IDs can monopolize all semaphores in the system. |
2000 |
| semmnu | The maximum number of undo structures in the system. | 1024 |
| semume | The maximum number of undo entries per process. | 512 |
| semvmx | The maximum value of a single semaphore. | 32767 |
Checking the Shared Memory and Semaphore Settings#
# Shared memory
$ kctune shmmax shmmni shmseg
# Semaphores
$ kctune semmni semmns semmsl semmnu semume semvmx
Changing Shared Memory and Semaphores#
If you have not previously configured the shared memory and semaphore kernel parameters, changing only the following parameters is sufficient.
# Shared memory
$ kctune shmmni=500
$ kctune shmseg=200
# Semaphores
$ kctune semmns=8192
$ kctune semmni=5029
$ kctune semmnu=1024
$ kctune semume=512
File Cache#
When the memory used by a long-running process such as Altibase is swapped out, the disk I/O latency caused by swapping makes Altibase response times irregular or slow. This setting is not mandatory, but to keep Altibase response times consistent, we recommend that you limit the file cache size in advance so that swapping occurs as little as possible.
| Kernel Parameter | Description | Recommended Value |
|---|---|---|
| dbc_min_pct | Limits the minimum file cache size as a percentage of total memory. The default value is 5%. Renamed to filecache_min in HP-UX 11.31. |
5% |
| dbc_max_pct | Limits the maximum file cache size as a percentage of total memory. The default value is 50%. Renamed to filecache_max in HP-UX 11.31. |
5-20% |
HP recommends setting dbc_max_pct to 20% on systems with 8GB or less of physical memory and to 10% on systems with 8GB or more.
Checking the File Cache Settings#
# Earlier than HP-UX 11.31
$ kctune dbc_min_pct dbc_max_pct
# HP-UX 11.31 or later
$ kctune filecache_min filecache_max
Changing the File Cache Settings#
The following example is for a system with 8GB or more of physical memory.
# Earlier than HP-UX 11.31
$ kctune dbc_min_pct=5
$ kctune dbc_max_pct=10
# HP-UX 11.31 or later
$ kctune filecache_min=5%
$ kctune filecache_max=10%
Resource Limit Kernel Parameters#
HP-UX sets some resource limits through kernel parameters instead of the ulimit command in the user environment file. These kernel parameters act as the upper bound for the user resource limits.
| Kernel Parameter | Description | Recommended Value |
|---|---|---|
| maxdsiz | The maximum size of the data segment that a single 32-bit process can allocate. Corresponds to the data seg size user resource limit (32-bit). |
2GB |
| maxdsiz_64bit | The maximum size of the data segment that a single 64-bit process can allocate. Corresponds to the data seg size user resource limit (64-bit). |
1TB (up to 4TB) Set it based on the expected maximum size of the Altibase process. |
| max_thread_proc | The maximum number of threads that a single process can have. | 600 or more |
| maxfiles | The maximum number of files that a single process can open at the same time (Soft-Limit). It can be increased up to maxfiles_lim (Hard-Limit). Corresponds to the open files user resource limit. |
2048 or more |
| nproc | The maximum number of processes in the system. It must be at least semmnu + 4. Corresponds to the max user processes user resource limit. |
6142 |
| maxusers | The base value from which the default values of nproc, ncallout, ninode, and nfile are calculated. Removed in HP-UX 11.23. | 124 (earlier than HP-UX 11.23) |
On versions earlier than HP-UX 11.23, set maxusers to 124 instead of setting nproc directly. On HP-UX 11.23 or later, you do not need to consider maxusers.
Checking the Resource Limit Kernel Parameters#
$ kctune maxdsiz maxdsiz_64bit max_thread_proc maxfiles nproc
Changing the Resource Limit Kernel Parameters#
The following example sets maxdsiz_64bit to its maximum value (about 4TB).
$ kctune maxdsiz=2147483648
$ kctune maxdsiz_64bit=4396972765184
$ kctune max_thread_proc=600
$ kctune maxfiles=2048
$ kctune nproc=6142
User Environment#
This chapter describes the user environment settings required to install and run Altibase on HP-UX: resource limits and environment variables. Here, the user means the OS user who installs Altibase and starts the Altibase process.
The examples in this chapter use sh, ksh, or bash syntax, and you add them to the user environment file (such as .profile). If you use csh, set environment variables with setenv instead of export.
Resource Limits#
HP-UX logically limits how much of the system resources, such as CPU, memory, and files, each user can use. Even when physical resources are sufficient, these limits can cause memory allocation or file creation to fail. Therefore, we recommend that you set them to the maximum values that the OS allows (unlimited if possible).
| Resource (ulimit output item) | Description | Related Kernel Parameter | Recommended Value |
|---|---|---|---|
| data seg size | The maximum size of the process data area | maxdsiz maxdsiz_64bit |
unlimited |
| file size | The maximum size of a file that can be created | - | unlimited |
| open files | The maximum number of files that a single process can open at the same time | maxfiles | unlimited |
| max memory size | The maximum size of memory that can be used | - | unlimited |
| virtual memory | The maximum size of virtual memory that can be used | - | unlimited |
| max user processes | The maximum number of processes that a user can create | nproc | unlimited |
For items that have a related kernel parameter, you can set the limit only up to the value of that kernel parameter.
Open files include not only the files that a process opens but also its communication sockets. Therefore, take into account the maximum number of concurrent client connections, the number of data files in use at the same time, the number of log files, and the number of trace log files.
Checking the Resource Limits#
# Without the -H option, ulimit prints the Soft-Limit values.
$ ulimit -a
# Print the Hard-Limit values.
$ ulimit -Ha
Changing the Resource Limits#
Add ulimit commands to the user environment file. The following example sets file size and max memory size to unlimited.
# Add to the user environment file (such as .profile): user resource limits
ulimit -f unlimited # file size
ulimit -m unlimited # max memory size
When You Need a Value Larger Than the Hard Limit#
The hard limit is the maximum resource limit, and only the root user can change it. The soft limit is the value actually applied to the user, and a regular user can raise it up to the hard limit. Therefore, ulimit commands in the user environment file cannot set a value larger than the hard limit.
HP-UX has no system resource configuration file for changing the hard limit. Instead, raise the hard limit by changing the resource limit kernel parameters with kctune or sam.
Environment Variables#
The environment variables to set after installing Altibase are as follows. SHLIB_PATH exists only on HP-UX.
| Environment Variable | Description | Value |
|---|---|---|
| ALTIBASE_HOME | Specifies the Altibase installation path. | Depends on the environment. |
| PATH | Adds the location of the Altibase utilities and shell scripts so that you can run them from any directory. | $ALTIBASE_HOME/bin |
| LD_LIBRARY_PATH | Adds the location of the Altibase dynamic libraries. Used for 64-bit linking. | $ALTIBASE_HOME/lib |
| SHLIB_PATH | Adds the location of the Altibase dynamic libraries. Set it when you link the dynamic libraries as 32-bit. | $ALTIBASE_HOME/lib |
| ALTIBASE_NLS_USE | Specifies the character set of the Altibase client. Set it to the same value as the Altibase character set. |
Same as the Altibase character set |
Checking the Environment Variables#
# Print all environment variables
$ env
# Print the value of ALTIBASE_HOME (if nothing is printed, it is not set)
$ echo $ALTIBASE_HOME
Setting the Environment Variables#
First, check the Altibase character set.
iSQL> SELECT NLS_CHARACTERSET FROM V$NLS_PARAMETERS;
Add the environment variables to the user environment file so that they are applied every time the OS user logs in. Set ALTIBASE_NLS_USE to the Altibase character set that you checked above.
# Add to the user environment file (such as .profile): Altibase environment variables
ALTIBASE_HOME=/ALTIBASE; export ALTIBASE_HOME;
PATH=$ALTIBASE_HOME/bin:$PATH; export PATH;
ALTIBASE_NLS_USE=MS949; export ALTIBASE_NLS_USE;
SHLIB_PATH=$ALTIBASE_HOME/lib:$SHLIB_PATH; export SHLIB_PATH; # 32-bit
LD_LIBRARY_PATH=$ALTIBASE_HOME/lib:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; # 64-bit
Apply the added environment variables with the following command.
$ . ~/.profile
Thread Environment Variables#
Altibase is a multithreaded application, so you need to set the HP-UX thread environment variables. All environment variables in the following table are required, and you must set PTHREAD_FORCE_SCOPE_SYSTEM, which relates to the MxN thread model.
| Environment Variable | Description | Supported Version |
|---|---|---|
| PTHREAD_FORCE_SCOPE_SYSTEM | Sets the thread contention scope to system. | HP-UX 11.23 or later |
| PERF_ENABLE | Skips some user-space sleep queue operations. | HP-UX 11.23 |
| PTHREAD_FAST_SHARED_OBJECTS | Applies the private algorithm to shared objects. | HP-UX 11.31 or later |
| PTHREAD_DISABLE_HANDOFF | Applies to multi-CPU environments. | HP-UX 11.23 or later |
Starting with HP-UX 11.31, PTHREAD_FORCE_SCOPE_SYSTEM includes the functionality of PERF_ENABLE, so you do not need to set PERF_ENABLE.
# Add to the user environment file (such as .profile): thread environment variables
PTHREAD_FORCE_SCOPE_SYSTEM=ON; export PTHREAD_FORCE_SCOPE_SYSTEM;
PTHREAD_FAST_SHARED_OBJECTS=ON; export PTHREAD_FAST_SHARED_OBJECTS;
PTHREAD_DISABLE_HANDOFF=ON; export PTHREAD_DISABLE_HANDOFF;
PERF_ENABLE=1; export PERF_ENABLE; # HP-UX 11.23 only
Memory Arena Environment Variable#
_M_ARENA_OPTS is a tuning item with no fixed recommended value, but it affects the performance of multithreaded applications, so review it when you install Altibase.
If a process uses only one memory allocation area, lock contention occurs when multiple threads of a multithreaded application request memory (malloc, free) at the same time, and performance drops. HP-UX provides up to 64 memory allocation areas, called arenas, per process and distributes threads across the arenas to reduce lock contention.
| Environment Variable | Description |
|---|---|
| _M_ARENA_OPTS=x:y | x: The number of arenas allocated per process. The default value is 8, and the range is 1-64. y: The arena expansion unit, in memory pages. The default value is 32, and the range is 1-4096. |
If you set an invalid value, the default value is used. With the following setting, a multithreaded application allocates 24 arenas, and each arena expands in units of 64 × 4KB (the typical memory page size).
$ export _M_ARENA_OPTS=24:64
In general, the more threads an application has, the more arenas it needs for better performance. However, if you set the number of arenas too high, heap fragmentation leads to inefficient memory use, which can make the process excessively large and cause a system memory shortage.
Therefore, if physical memory is small and a memory shortage is a concern, you can set the value to 1:8 so that the application behaves like a single-threaded application. Conversely, if performance drops because of a bottleneck in memory requests (malloc, free), increase the value within the available resources.
Summary#
The following table summarizes the recommended values and the check commands for the kernel parameters, resource limits, and environment variables described in this document.
| Category | Item | Recommended Setting | How to Check |
|---|---|---|---|
| Shared memory | shmmax | 2GB+1 | kctune shmmax shmmni shmseg |
| shmmni | 500 or more | ||
| shmseg | 200 or more | ||
| Semaphores | semmni | 5029 | kctune semmni semmns semmsl semmnu semume semvmx |
| semmns | 8192 | ||
| semmsl | 2000 | ||
| semmnu | 1024 | ||
| semume | 512 | ||
| semvmx | 32767 | ||
| File cache | dbc_min_pct (filecache_min) | 5% | kctune dbc_min_pct dbc_max_pctkctune filecache_min filecache_max |
| dbc_max_pct (filecache_max) | 5-20% (8GB or less of physical memory: 20%, 8GB or more: 10%) |
||
| Resource limit kernel parameters | maxdsiz | 2GB | kctune maxdsiz maxdsiz_64bit max_thread_proc maxfiles nproc |
| maxdsiz_64bit | 1TB (up to 4TB) | ||
| max_thread_proc | 600 or more | ||
| maxfiles | 2048 or more | ||
| nproc | 6142 | ||
| maxusers | 124 (earlier than HP-UX 11.23) | ||
| OS user resource limits | data seg size | unlimited | ulimit -a |
| file size | unlimited | ||
| open files | unlimited | ||
| max memory size | unlimited | ||
| virtual memory | unlimited | ||
| max user processes | unlimited | ||
| Environment variables | ALTIBASE_HOME | Altibase installation path (absolute path) | env |
| PATH | $ALTIBASE_HOME/bin | ||
| LD_LIBRARY_PATH | $ALTIBASE_HOME/lib | ||
| SHLIB_PATH | $ALTIBASE_HOME/lib | ||
| ALTIBASE_NLS_USE | Same as the Altibase character set | ||
| PTHREAD_FORCE_SCOPE_SYSTEM | ON | ||
| PTHREAD_FAST_SHARED_OBJECTS | ON (HP-UX 11.31 or later) | ||
| PTHREAD_DISABLE_HANDOFF | ON | ||
| PERF_ENABLE | 1 (HP-UX 11.23) | ||
| _M_ARENA_OPTS | Set for the system (default 8:32) | ||
| PTHREAD_SHARED_MUTEX_OLDSPIN | 1 (HP-UX 11.23 with PHCO_33675 or PHCO_34718 applied) |
Others#
Multithreading Patches#
Altibase is a single-process, multithreaded application, so it requires the HP-UX multithreading patches. In particular, the pthread library cumulative patch directly affects performance, so make sure to check whether it is applied.
Checking the Multithreading Patches#
Use the swlist command to check the pthread patches applied to the current system.
$ swlist -l patch | grep pthread
The following is an example of the output.
PHCO_38955 1.0 pthread library cumulative patch
PHKL_35709 1.0 pthread_cond_timedwait,hires timers,callout
PHKL_37122 1.0 pthread_condvar_prio_boost patch
Additional Setting for PHCO_33675 and PHCO_34718#
HP has reported that applying the PHCO_33675 or PHCO_34718 patch on HP-UX 11.23 causes applications to hold shared mutexes longer, which degrades performance. If either patch appears in the patch list, add the following environment variable and set it to 1 to restore performance.
| Environment Variable | Description | Supported Version |
|---|---|---|
| PTHREAD_SHARED_MUTEX_OLDSPIN | Restores the performance degraded by PHCO_33675 and PHCO_34718. | HP-UX 11.23 |
# Add to the user environment file (such as .profile): HP-UX 11.23 with PHCO_33675 or PHCO_34718 applied
PTHREAD_SHARED_MUTEX_OLDSPIN=1; export PTHREAD_SHARED_MUTEX_OLDSPIN;