You are currently viewing Zend Server 5.x documentation. Click here to view the latest Zend Server online documentation.
You are here: Zend Server User Guide > Tasks > Working with Optimizer+

Working with Optimizer+

The Optimizer+ runs out-of-the-box (by default, after installation). Optimizer+ allows you to gain a performance boost by reducing code compilation time. When PHP code is compiled for the first time, it is saved in the server’s memory. Each time the code is called, the pre-compiled version is used instead of waiting for the code to compile, which causes a delay each time the code is used.

Note:

Using the Optimizer+ should not be confused with caching. The Optimizer+ saves a compiled script to the server's memory, while Caching saves the script’s output to the server’s memory.

The general recommendation is to always keep the Optimizer+ set to 'On' to boost Web application performance.

When not to Use Optimizer+ (Blacklist)?

There are some instances where it is preferable not to store PHP byte-code for certain PHP files. To do so, you can make a list (a blacklist) of file names that you want the Optimizer+ to ignore or increase the Optimizer+ resource allocation.

 

Files and directives should be blacklisted under the following conditions:

Increasing Optimizer+ Resource Allocation

The following procedure describes how to change Optimizer+ resource allocation. This procedure is used as an alternative to blacklisting files and should be tried first, before adding a file to a blacklist (unless the file meets one of the criteria above). Optimizer+ settings can be changed to increase allocated memory and the maximum quantity of files. This alternative depends on the amount of memory available to allocate to the Accelerator.

Memory allocation can only be increased when the Optimizer+ is set to 'On'.

 

 

To increase the Optimizer+ memory allocation:

  1. Go to Server Setup | Components and verify that the "Zend Optimizer+" component is set to 'On'.

  2. Click the "Configure" link in the directives column to display the list of Optimizer+ directives.

  3. Locate the directive: zend_optimizerplus.memory_consumption and increase the value according to your system's memory allocation abilities.

 

To increase the quantity of files:

  1. Go to Server Setup | Components and verify that the "Zend Optimizer+" component is set to 'On'.

  2. Click the "Configure" link in the directives column to display the list of Optimizer+ directives.

  3. Locate the directive: zend_optimizerplus.max_accelerated_files and increase the value according to your system's memory allocation abilities.

If the memory fills up quickly (especially if there are only a few files), increase the memory allocation or blacklist the file. Files which exceed the allocated memory or file quantity are not accelerated.

Blacklisting Files

If none of the alternatives (described above) are suitable, or if the file meets one of the criteria for blacklisting a file, use the following procedure to create a blacklist file that contains the file names of the files you do not want to be byte-code cached by Optimizer+.

 

 

To create a blacklist file:

  1. Create a .txt file using a text editor.

  2. Write a list of the file names to blacklist (i.e., ignored by the Optimizer+).
    List each file name in a new line.

  3. In Server Setup | Components, verify that the "Zend Optimizer+" component is set to 'On'.

  4. Click the "Configure" link in the directives column to display the list of Optimizer+ directives.

  5. Locate the directive: zend_optimizerplus.blacklist_filename  and specify the full path to the file location.

The files in the blacklist are now ignored by Optimizer+.

Optimizer+ Duplicate Functions Fix

In situations where certain functions were (or were not) defined, some PHP code produces different opcodes, depending on the circumstances. This causes a discrepancy for the Optimizer+ in the situation where the Optimizer+ caches one version and a sequence of eventsEvents are a result of the monitoring component checking your system and collecting information about a specific occurrence that indicates that your environment is displaying uncharacteristic behavior. arises that requires a different function. If the discrepancy is not addressed, the script stops working and raises a "duplicate functions" error.

To maintain proper performance in these and similar situations, activate the zend_optimizerplus.dups_fix parameter. This parameter shuts down the Optimizer+ duplicate function check to prevent these errors from occurring.

This parameter can be defined in Server Setup | Directives by searching for zend_optimizerplus.dups_fix.

 

 

Related Links

Related Links:

Optimizer+

Components 

 

 

 

© 1999-2013 Zend Technologies, Ltd. All rights reserved.