making bbPress (and WordPress) work better!

PHP 7 Opcache adds Huge Pages support for extra performance

The PHP 7 opcache (open sourced by Zend, which replaced APC) gets a little performance boost from the added support of Huge Pages by Dmitry Stogov:

Added an experimental ability to move PHP code pages (PHP TEXT segment) into
HUGE pages.

; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.

Note that PHP must first be compiled with the appropriate configure option:

./configure --enable-huge-code-pages  (... etc.)

Essentially, Huge Pages (on OS that support them) reduces the size of the index that has to be searched to find allocated memory by allowing larger chunks of memory to be claimed instead of smaller blocks.

See the Debian wiki for a better explanation of huge pages:

This will have to benchmarked to prove if it really enhanced performance and by how much (I suspect low single digits but everything helps).

Also new to PHP 7 will be a file-based cache for the opcache which can be used as either the primary or a secondary cache level:

Added second level file based opcode cache. 
It may be enabled by setting opcache.file_cache=<DIR> configuration directive in php.ini
The second level cache may improve performance when SHM is full, at server restart or SHM reset. 
In addition, it's possibe to use file cache without SHM at all,
using opcache.file_cache_only=1 (this may be useful for sharing hosting),
and disable file cache consistency check, to speedup loading at the cost of
safety, using opcache.file_cache_consistency_checks=0.
; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.

; Enables or disables opcode caching in shared memory.

; Enables or disables checksum validation when script loaded from file cache.

3 responses

  1. i think they renamed it to shorter name now = opcache.huge_code_pages

    September 19, 2015 at 9:59 pm

  2. Will Huge Pages also work when using mod_php or only with (f)cgi implementation?

    September 15, 2016 at 7:29 am

  3. Yes Opcache makes the site loads fast. Yesterday i install and enable it with php7.

    September 28, 2016 at 6:00 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s