PHP Opcode Caches, switching between

A PHP accelerator is an extension designed to boost the performance of software applications written using the PHP programming language. Most PHP accelerators work by caching the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request (some or all of which may never even be executed). For best performance, caching is to shared memory with direct execution from the shared memory and the minimum of memory copying at runtime. A PHP accelerator typically reduces server load and increases the speed of PHP code anywhere from 2-10 times, depending on factors such as the inherent execution time of the PHP application and the percentage of source code actually executed on a given request. While a code optimizer may even slow down overall performance when used in isolation, it can provide an additional performance boost when coupled with a code cache as the optimization effort is performed just once.
Code Cache is just an extension of the basic accelerator engine, where the compiled code is cached and the updates are transparent. Most if not all, accelerators available do offer one or other way to utilize in memory cache for user defined variables, to reduce costly repetitive database calls or file system IO. More to read at wikipedia.

We at Saturn were using APC for a long time, though only on our colocated servers, not in the test server located in our lab. Then came kerala online which we built around wordpress, and was best with eaccelerator (as some one suggested). This was a turn. We had to utilize the benefits of user space caching across the three servers, without breaking the morale of our developers. End result is an opcode class which had the same methods, but different underlying engine or method. Effectively an abstraction of APC methods, Eaccelerator methods or raw ramdisk methods.

In the last case, since the activity is on shm, which is a ram disk and more or less half the full system memory. So a disk pruning system with the help of find as below in the system cron, would be best to maintain the balance, unless the system is restarted frequently (in case of a web server or test server). This would delete any file, which was created 6 hours or more ago.

find /dev/shm -type f -cmin +360 -delete

The last piece can be used by those who do not have any kind of opcode cache. Though there seems to be a small over head with the cache ttl checks, we could ignore that when we think of the advantages of utilizing this.

The PHP development team announces the immediate availability of PHP 5.6.29. This is a security release. Several security bugs were fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version.For source downloads of PHP 5.6.29 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The […]

The PHP development team announces the immediate availability of PHP 7.1.0. This release is the first point release in the 7.x series.PHP 7.1.0 comes with numerous improvements and new features such asNullable typesVoid return typeIterable pseudo-typeClass constant visiblity modifiersSquare bracket syntax for list() and the ability to specify keys in list()Catching multiple exceptions typesMany more […]

The PHP development team announces the immediate availability of PHP 5.6.28. This is a security release. Several security bugs were fixed in this release. All PHP 5.6 users are encouraged to upgrade to this version.For source downloads of PHP 5.6.28 please visit our downloads page, Windows source and binaries can be found on windows.php.net/download/. The […]