PHP Opcode Caches
Opcode (operation codes) caching is used to accelerate execution of browser request by caching the operational code. Caching the compiled bytecode(Opcode) of php script avoid the overhead of parsing & compiling code every time.
The cached code is stored in shared memory or ram and directly is available for execution, without spending time for slow disk reads and memory copying at runtime.
Fig 1 : Execution of PHP script without an Opcode Cache |
Fig 2: Execution of PHP script with an Opcode Cache |
There are number of Opcode Caches available. Some of them are :
- APC (Alternative PHP Cache) is a free and open opcode cache for PHP. APC framework optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in memory.
- Zend Cache - commercial (developed by zend the php company).
- IonCube Accelerator - free, but closed source, Launched in 2001.
- XCache is a fast, stable PHP opcode cacher that has been tested and is now running on production servers under high load.