Chapter 4 Database Access


Configuring Adaptive Server Enterprise connections

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 and SGI

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.

Displaying current soft and hard limits

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

Increasing the soft limit

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.

Note   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.

Increasing the hard limit

Steps Setting up the sample program to increase the hard limit

  1. Use an ASCII editor to create file_name.c (where file_name is the name you give the file). Type the text shown in the sample in "Sample program".
  2. Compile the file:

    cc file_name.c -o program_name
    


    where file_name is the name of the source file you created, and program_name is the name you want to give the program.
  3. Change the program's permissions and ownership so that it will execute as "root":

    chmod 755 program_name 
    chown root program_name
    


    where program_name is the name of the compiled program.
  4. The "root" user can run the program to start Adaptive Server with increased user connections by typing this at the operating system prompt:

    program_name dataserver -d master_device_name
    


    where program_name is the name of the compiled program, and master_device_name is the full path of Adaptive Server's master device. Instead of typing the command at the operating system prompt, you can add program_name before the dataserver command line in the Adaptive Server runserver file.

For Compaq Tru64

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.

For HP-UX

The kernel parameters maxfiles and maxfiles_lim control the number of file descriptors available to any one process.

Sample program

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.