Feature Wiki

Information about planned and released features

Tabs

Support for HipHop Virtual Machine (HHVM)

1 Requirements

ILIAS should officially support HHVM. Suggestion is to add the support in ILIAS 4.5 (or even 4.4), because no behavioural (or 'big') changes are neccessary and the performance gain with hhvm is really huge.
 
A patch for ILIAS 4.4.3 is included below (see implementation).
 
It can be tested here: sigperf-hhvm.iliasnet.de.

1.1 Configuration

The following settings (/etc/hhvm/php.ini) should be set when running ILIAS with HHVM.
 
The ILIAS-Pageeditor requires the following setting:

hhvm.libxml.ext_entity_whitelist = file

On Ubuntu/Debian you need to set the following line to be able to connect with a local MySQL-Server (since HHVM 3.6.0) via socket - you might want to double check if this path is correct for you:

hhvm.mysql.socket=/var/run/mysqld/mysqld.sock

Error-Handling in ILIAS require the following settings:

hhvm.error_handling.call_user_handler_on_fatals = true ; <=> enable the error handler of ILIAS
hhvm.log.runtime_error_reporting_level = 22519 ; <=> corresponds to "error_reporting" in PHP
; 22517 = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING
; 22519 = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
; 22527 = E_ALL & ~E_DEPRECATED & ~E_STRICT
; 8191 = E_ALL

hhvm.debug.server_error_message = false ; <=> corresponds to "display_errors" in PHP - set it to 'true' on test systems

Documentation of HHVM-Configuration:
https://docs.hhvm.com/hhvm/configuration
 

1.2 PHP-Extensions

All major php-extensions are ported to HHVM
This includes APC, memcache, xdebug.
The list of supported extensions can be found in the extensions directory of the hhvm codebase:
https://github.com/facebook/hhvm/tree/master/hphp/runtime/ext
 
A possibly already outdated (=incomplete) list can also be found in the Wiki: https://github.com/facebook/hhvm/wiki/Extensions

2 Additional Information

  • Funding: Not Required
  • Maintainer: (will be set by Jour Fixe)
  • Implementation of the feature is done by (company, developer)
  • Contract settled: (fill in "Yes" if a contract is already settled, otherwise "No" )
  • Tested by / status: all users at http://hhvm50.ilias.de

3 Discussion

Colin Kiegel, 12.07.2014: These are the slides discussed by the SIG Performance and Core-Developers on 07.07.2014 in Cologne (PDF below).

JF 21 July 2014: We support the idea and would like to integrate the existing fixes into the trunk. All maintainers paricipating in the JF agreed to support the migration of the fixes.
  • Colin, could you please provide the changes in an SVN branch? This will make it easier to track changes and merge them into the trunk.
  • Max asked for a vagrant reference machine. He would like to support this, to make it possible to run HHVM on windows machines.
  • Max volunteers to setup a jenkins inspection for common heuristics related to HHVM.
  • We will move the 4.5 test environment to HHVM
  • Developer should downgrade bugfixes (e.g. non static called as static) to 4.4 if possible.
CK, 21 July 2014:
  • Hurray. :-)
  • I don't expect to do additional hhvm-fixes in the near future (no known bugs left!), so right know the patch should really be sufficient imho. And to be honest: I don't want to have an official SVN-account, because I don't want to be regarded being an ILIAS programmer. At least not officially (personal reasons). Anyway, a patched version of ILIAS can be checked out here using subversion: svn co https://github.com/colin-kiegel/ilias-hhvm (<- should be a valid SVN-URL).
  • PS: If anyone has questions regarding my patches, or if you want me to change something - just mail me. But I would really prefer to use patches (or github) instead of official svn for my contributions.

CK, 24 Nov 2014: In my understanding, the plan was to run the 5.0-tests against hhvm, i.e. to move the test installation to hhvm before the release of 5.0. What is the status? Do you need help or assistance?

JF 24 Nov 2014: Yes, Matthias will ask Anton to setup HHVM on the test installation.

4 Implementation

The following patch for ILIAS 4.4.3 makes ILIAS compatible with HHVM (included since ILIAS 5.0)

The patch includes the following:
  • Fallback-Error-Handler (/Services/Utilities/classes/class.ilEnvironment.php)
    class ilEnvironment {
    public static function isHHVM();
    public static function setFallbackErrorHandler();
    //...
    }
    // set custom error handler to enable on-screen stacktraces
    // see https://github.com/facebook/hhvm/issues/2571
  • fixing illegal static function calls
    Example 1: ilLanguage::_lookupEntry() - which does not behave like a proper static function and should thus be called as a method. Fixing this is as simple as:
    - ilLanguage::_lookupEntry();
    + $lng->_lookupEntry();

    Example 2: DOMDocument::loadXML() cannot be called statically in HHVM (in PHP it is possible but throws E_STRICT violation). The fix is as simple as:
    - $xslt->importStyleSheet(DomDocument::loadXML($args));
    + $xslt_doc = new DomDocument();
    + $xslt_doc->loadXML($args);
    + $xslt->importStyleSheet($xslt_doc);
  • Two minor fixes in PEAR/lib/MDB2
    Fix 1: use "new mysqli" instead of "@mysqli_connect"
    - $connection = @mysqli_connect($args)
    + $connection = new mysqli($args)

    Fix 2: $args must be of correct type (and may not be unset)
    + if(!is_string($this->dsn['socket'])) {
    +      $this->dsn['socket'] = "";
    + }
 
Open Todos:
  • The Fallback-Error-Handler is currently only set in ilInitialisation::initILIAS() - it also needs to be set in the equivalents for SETUP and SCORM2004. Which is as easy as:
    + include_once('./Services/Utilities/classes/class.ilEnvironment.php');
    + if(ilEnvironment::isHHVM()) {
    +     ilEnvironment::setFallbackErrorHandler();
    + }

Last edited: 21. Dec 2015, 12:58, Kiegel, Colin [kiegel]