Behind the Site »

Zend - The PHP Company

Shared memory tweaking

Article #173
Product: Zend Performance Suite


Shared Memory Configuration

You can customize your Zend Performance Suite as part of the installation process. In this section, Host System Parameters and Zend Performance Suite Configuration Options are discussed.

Overview
The Zend Performance Suite makes use of Shared Memory during the course of its operation. Sometimes, the default settings of your operating system may not allow the Zend Performance Suite to allocate enough shared memory and will reduce its efficiency, or even prevent it from working altogether. It is recommended that you go over the recommendations in this section, to maximize the efficiency of your Zend Performance Suite.

Shared Memory Allocation Background
The Zend Performance Suite tries to allocate shared memory segments to accommodate the memory size defined in the control panel (Accelerator Memory). The default memory consumption is 32MB. Some operating systems (namely, certain versions of Solaris and FreeBSD) cannot offer that much shared memory in their default configuration, and have to be tuned. The tuning process is typically easy, but it�s recommended that the system administrator apply the recommendations in this section.

There are several configuration values the Zend Performance Suite depends on:
� Maximum size of a single shared memory segment (SHMMAX). The recommended value is
at least 16MB.
� Maximum number of shared memory segments (SHMMNI).
� Maximum number of attached shared memory segments per process (SHMSEG).

Note: Your system should be configured so that SHMMAX*SHMMNI is greater than
the Zend Performance Suite memory consumption (Accelerator Memory). Since
other applications may also make use of shared memory, it�s recommended to
configure your system to allow more shared memory than the amount used by the
Zend Performance Suite. Increasing SHMMNI does not noticeably degrade
system performance.
You must also ensure that SHMSEG is set so that SHMMAX*SHMSEG is also
greater than the Accelerator Memory. Since Apache itself also makes use of
shared memory and will be sharing the SHMSEG segments with the Zend
Performance Suite, an even higher setting is recommended.
Warning: If you plan on using Apache's apachectl graceful command to restart your
Apache web server, be sure to double the amount of allocated shared memory
that you would otherwise expect to use. apachectl graceful leaves active
processes running when the server is restarted, and temporarily allocates shared
memory while validating the new configuration. When the new configuration has
been validated, this temporarily allocated memory is released.

Configuration under Linux
Modern Linux installations require no additional configuration for using the Zend Performance Suite. Their default configuration allows for enough shared memory and semaphore structures.

Configuration under FreeBSD
By default, FreeBSD usually has too little shared memory available for the Zend Accelerator to be effective (maximum segment size and segments per process depend on the setup).
For optimal performance of the Zend Accelerator on FreeBSD 4.x and 5.x, consider placing the following entries in /etc/sysctl.conf:

kern.ipc.shmmax=67108864
kern.ipc.shmmni=200
kern.ipc.shmseg=20
kern.ipc.semmni=70


For optimal performance of the Zend Accelerator on FreeBSD 3.x , consider placing the following entries in /etc/rc.local:
sysctl -w "kern.ipc.shmmax=67108864"
sysctl -w "kern.ipc.shmmni=200"
sysctl -w "kern.ipc.shmseg=20"
sysctl -w "kern.ipc.semmni=70"

Note: Please reboot the server for the changes to take effect.

Configuration under Solaris
By default, Solaris defines the maximum shared segment size to 1MB, which is insufficient for the Zend Accelerator's memory requirements. For optimal Zend Accelerator performance, the following settings are recommended for the file /etc/system:
set shmsys: shminfo_shmmax = 67108864
set shmsys: shminfo_shmmni = 200
set shmsys: shminfo_shmseg = 20
set semsys: seminfo_semmni = 70


Last Updated: 2005-12-12 15:41:09

 

» Send us feedback