Chapter 4 Database Access
When EAServer uses an Adaptive Server Enterprise database running on UNIX, you can configure the number of user connections, but it cannot exceed the number of file descriptors available to Adaptive Server on the operating system. When configuring Adaptive Server user connections, the system administrator should consider the number of file descriptors available for each process. Although most of the open file descriptors are available for user connections, a few are used by Adaptive Server for opening files and devices.
When EAServer uses an Adaptive Server Enterprise database running on Windows NT or Windows 2000, you can create more than 6000 user connections.
For additional information on user connections, see the Adaptive Server Enterprise System Administration Guide on the Sybase Product Manuals Web site .
For Sun Solaris, you can set both soft and hard limits for file descriptors. The soft limit can be increased up to the hard limit by the user, but the hard limit can be increased only by someone with "root" permissions. The soft limit determines the number of open file descriptors available to an Adaptive Server engine.
To display the current soft limit, for C shells, enter:
limit descriptors
For Bourne shells, enter:
ulimit -n
To display the current hard limit for C shells, enter:
limit -h descriptors
For Bourne shells, enter:
ulimit -Hn
To increase the soft limit for C shells, enter:
limit descriptors n
For Bourne shells, enter:
ulimit -Sn new_value
where n is the current value for the soft limit, and new_value is the value to which you want to increase the soft limit.
You can use the preceding commands in your runserver file
to increase the hard and soft limits. Because the runserver file
is a Bourne shell script, be sure to use the Bourne shell versions
of these commands in the runserver file.
Setting up the sample program to increase the
hard limit
cc file_name.c -o program_name
chmod 755 program_name chown root program_name
program_name dataserver -d master_device_name
The number of file descriptors per process is determined by the operating system parameter open_max. The default value of open_max is 4096. For more information on setting open_max, see the Compaq Tru64 operating system documentation.
To obtain the current value of the open_max parameter, use the Korn or Bourne shell ulimit command:
ulimit -n
Adaptive Server can use a maximum of 1024 file descriptors, regardless of the value of open_max.
Use the sysconf or getdtablesize C library functions to obtain the number of current file descriptors.
The kernel parameters maxfiles and maxfiles_lim control the number of file descriptors available to any one process.
The following example shows the source code you can use to increase the hard limit:
#include <sys/time.h> #include <sys/resource.h> #include <sys/types.h> /* ** define MAX_CONNECTIONS to a number less than ** 10000. The number defined will then become the ** maximum number of connections allowed by an ** Adaptive Server. */ #define MAX_CONNECTIONS 9999 extern int errno; main(argc,argv) char **argv; { struct rlimit rlp; uid_t uid; rlp.rlim_cur = MAX_CONNECTIONS; rlp.rlim_max = MAX_CONNECTIONS; /* set the number of open file desriptors to ** MAX_CONNECTIONS */ if (setrlimit (RLIMIT_NOFILE,&rlp) == -1) { perror("setrlimit"); exit(1); } /* reset the user id to disable superuser ** privileges */ uid = getuid(); setuid(uid); /* run the program */ execv(*++argv, argv); }
Copyright © 2002 Sybase, Inc. All rights reserved. |
![]() |