Disable optimization for stability issues

Follow

Issue

OPcache speeds up performance in two ways.  The first is by caching precompiled byte code.  The second is by optimizing the OPcode prior to writing to cache.  PHP applications showing unexpected results can sometimes be caused by an optimization.  This happens rarely, but it can happen.  One way to check if this is the problem is to disable optimization.

Environment

Any version of Zend Server.

Resolution

The default value for the Zend OPcache directive opcache.optimization_level is:

0xffffffff

This hex value represents a bitmask flagging all optimizations to run.

Please try setting this value to:

0

That is to say, just use the decimal numeral '0', so that the OPcache optimizations do not run.  This can improve stability for some applications.  Byte code caching will still take place.

Note: Consistency checks may also increase stability.
Consistency checking verifies the cache checksum.  This can improve stability in some situations.  To enable it, set the opcache.consistency_checks directive to 1.

To set the directive, please go into the Zend Server UI, and go to Administration -> Components.  Find Zend OPcache on the list of components, and give it one mouse click to expand the directives.  On the list of directives, find opcache.optimization_level and set the value to 0 (the decimal digit zero).  You can also change the opcache.consistency_checks directive to 1 on this display.  Once you change the directive(s), the Save button on the top left of the table becomes enabled.  Click the Save button, and when prompted restart Zend Server.  The restart takes your web site down for a short while, so please schedule this operation for a time when this would be acceptable.

 

Have more questions? Submit a request

Comments

Powered by Zendesk