Sun GlassFish Enterprise Server v2.1.1 High Availability Administration Guide

Configuring Shared Memory and Semaphores

You must configure shared memory and semaphores before installing HADB. The procedure depends on your operating system.

If you run other applications than HADB on the hosts, calculate these applications' use of shared memory and semaphores, and add them to the values required by HADB. The values recommended in this section are sufficient for running up to six HADB nodes on each host. You need only increase the values if you either run more than six HADB nodes, or the hosts are running applications that require additional shared memory and semaphores.

If the number of semaphores is too low, HADB can fail and display this error message: No space left on device. This can occur either while starting the database, or during run time.

ProcedureTo configure shared memory and semaphores on Solaris

Since the semaphores are a global operating system resource, the configuration depends on all processes running on the host, and not HADB alone. On Solaris, configure the semaphore settings by editing the /etc/system file.

  1. Log in as root.

  2. Configure shared memory.

    • Set shminfo_shmmax, which specifies the maximum size of a single shared memory segment on the host. Set this value to the total amount of RAM installed on the HADB host machine, expressed as a hexadecimal value, but no more than 2 GB.

      For example, for 2 GB of RAM, set the value as follows in the /etc/system file:

      set shmsys:shminfo_shmmax=0x80000000

      Note –

      To determine a host machine’s memory, use this command:

      prtconf | grep Memory

    • On Solaris 8 or earlier, set shminfo_shmseg, the maximum number of shared memory segments to which one process can attach. Set the value to six times the number of nodes per host. For up to six nodes per host, add the following to the /etc/system file:

      set shmsys:shminfo_shmseg=36

      On Solaris 9 and later, shmsys:shminfo_shmseg is obsolete.

    • Set shminfo_shmmni, the maximum number of shared memory segments in entire system. Since each HADB node allocates six shared memory segments, the value required by HADB must be at least six times the number of nodes per host. On Solaris 9, for up to six nodes per host, there is no need to change the default value.

  3. Configure semaphores.

    Check the /etc/system file for the following semaphore configuration entries, for example:

    set semsys:seminfo_semmni=10
    set semsys:seminfo_semmns=60
    set semsys:seminfo_semmnu=30

    If the entries are present, increment the values as indicated below.

    If the /etc/system file does not these entries, add them at the end of the file:

    • Set seminfo_semmni, the maximum number of semaphore identifiers. Each HADB node needs one semaphore identifier. On Solaris 9, for up to six nodes per host, there is no need to change the default value. For example:

      set semsys:seminfo_semmni=10
    • Set seminfo_semmns, the maximum number of semaphores in the entire system. Each HADB node needs eight semaphores. On Solaris 9, or up to six nodes per host, there is no need to change the default value. For example:

      set semsys:seminfo_semmns=60
    • Set seminfo_semmnu, the maximum number of undo structures in the system. One undo structure is needed for each connection (configuration variable NumberOfSessions, default value 100). For up to six nodes per host, set it to 600:

      set semsys:seminfo_semmnu=600
  4. Reboot the machine.

ProcedureTo configure shared memory on Linux

On Linux, you must configure shared memory settings. You do not need to adjust the default semaphore settings.

  1. Log in as root.

  2. Edit the file /etc/sysctl.conf.

    With Redhat Linux, you can also modify sysctl.conf to set the kernel parameters.

  3. Set the values of kernel.shmax and kernel.shmall, as follows:

    echo MemSize > /proc/sys/shmmax
    echo MemSize > /proc/sys/shmall

    where MemSize is the number of bytes.

    The kernel.shmax parameter defines the maximum size in bytes for a shared memory segment. The kernel.shmall parameter sets the total amount of shared memory in pages that can be used at one time on the system. Set the value of both of these parameters to the amount physical memory on the machine. Specify the value as a decimal number of bytes.

    For example, to set both values to 2GB, use the following:

    echo 2147483648 > /proc/sys/kernel/shmmax
    echo 2147483648 > /proc/sys/kernel/shmall
  4. Reboot the machine using this command:

    sync; sync; reboot

Procedure for Windows

Windows does not require any special system settings. However, if you want to use an existing J2SE installation, set the JAVA_HOME environment variable to the location where the J2SE is installed.