HHVM with Opcache


How to use HHVM with Opcache?

HHVM compiles PHP-code in a different way and cannot make use of Opcache. So it’s pretty normal you will not be able to install HHVM with opcache.

Opcache and HHVM don’t go together.

HHVM can utilize APC

HHVM can be configured to use APC caching instead. Consider the following ini settings:

APC Settings

INI Setting Documentation Default
hhvm.server.apc.expire_on_sets Enables item purging on expiration False
hhvm.server.apc.purge_frequency Expired items will be purged every this many APC sets 4096
hhvm.server.apc.purge_rate Evict at most this many items on each purge. No limit if -1. -1

JIT Translation Cache Size

The translation cache stores the JIT’d code. It’s split into several sections depending on how often the code is (or is expected to be) executed.

INI Setting Documentation Default
hhvm.jit_a_size Size in bytes of main translation cache. 62914560 (60 MB)
hhvm.jit_a_cold_size Size of cold code cache. Code that is unlikely to be executed is deemed cold. (Recommended: 0.5x hhvm.jit_a_size) 25165824 (24 MB)
hhvm.jit_a_frozen_size Size of extremely cold code cache. Code that is almost never executed, or executed once and then freed up, is deemed frozen. (Recommended: 1x hhvm.jit_a_size) 41943040 (40 MB)
hhvm.jit_a_hot_size Size of hot code cache. (Enabled only in RepoAuthoritative mode) 0
hhvm.jit_a_prof_size Size of profiling code cache. (Recommended: 1x hhvm.jit_a_size) 67108864 (64 MB)
hhvm.jit_a_max_usage Maximum amount of code to generate. (Recommended: 1x hhvm.jit_a_size) 62914560 (60 MB)

These settings have been take from the Github page linked below.

Putting the HHVM cache in a ramdisk

HHVM generates a cachefie in /var/lib/hhvm/hhvm.hhbc , you can move this file onto a ramdisk and slightly speed it up.

PHP with Opcache

Vanilla PHP can make use of opcache (other alike extensions are apc and xcache).

It speeds up the pageload time between 20% and 300%.

PHP with opcache is still slower than HHVM in most cases.

Further Links


Leave a Reply

Your email address will not be published. Required fields are marked *