Every connection requires two file descriptors—one for the client connection and one for the connection to the Adaptive Server® Enterprise. An additional connection is required to allow the administrative thread to log in. If you are using cached connections, you must also consider the number of cached connections. Sybase recommends that you configure 100 additional file descriptors for overhead such as Open Client/Server™ shared libraries, character set and locale files, and connection monitor (CMON) threads.
For example, to calculate the minimum number of file descriptors needed for 1000 connections with 50 cached connections:1000 * 2 + 1 + 50 + 100 for a total of 2151 file descriptors per process.
Set the CONNECTIONS parameter to a lesser value than
the maximum number of file descriptors (see the UNIX ulimit -Ha command)
to prevent OpenSwitch from attempting to use more descriptors than
are available to it.
If several short-lived applications, such as Web applications, are continuously connecting to OpenSwitch, Sybase recommends that you observe the TIMED_WAIT state through netstat. The default TIMED_WAIT limit is 2MSL (maximum segment lifetime), which is four minutes. The default limit can result in the maximum file descriptors per process being exceeded as the sockets are held until the 2MSL limit is reached. You can either increase the maximum number of file descriptors per process or reduce the 2MSL limit in the TCP configuration.
For instructions on increasing the file descriptor limit or reducing the 2MSL limit in the TCP configuration, see your operating system vendor documentation.
OpenSwitch uses 30 threads for internal functions. Therefore, you should set the maximum threads per process to at least 30 + maximum OpenSwitch users + 20 (for any additional overhead). For example, if you plan to have 1200 connections at any given time, increase the maximum threads per process to at least 1229.
On HP-UX, set the maxusers and max_thread_procs to the maximum value that HP allows.
Updating maxusers to a value greater than the maximum number of desired OpenSwitch users automatically increases other machine-wide limits, such as nkthread, nproc, nfile, and ninode. Changing nproc changes nkthread.
To see what maxusers and max_thread_procs are currently set to, at a command prompt, enter:
/usr/sbin/kmtune
Check with the operating system vendor for any limits on threads, process size, open files, and memory allocation per process.
Other configurable parameters are:
maxfiles – maximum number of files that can be opened at one time.
maxuproc – number of processes per user.
maxdsize – size of data segment.
If you get memory allocation failures, increase the maxdsize parameter.
On Solaris, increase rlim_fd_max to a value greater than the number of users that you intend to run through OpenSwitch according to the file descriptor calculations in the first paragraph of “Limitations”.
To see what rlim_fd_max is currently set to, at a command prompt, enter:
cat/etc/system
Other configurable parameters are:
maxusers
max_nprocs
maxuprc
Increase the maximum threads per process to a value greater than the number of connections you expect to be connected at any given time. The value is PTHREAD_THREADS_MAX and is located in /usr/include/bits/local_lim.h.
This requires you to rebuild your kernel. Consult your Linux documentation for more information.