Facebook makes PHP 9x faster via virtual machine (HHVM?)

Luke F

Well-known member
#42
Got the homepage of my forum fully loading on HHVM 2.3.2 without any huge issues besides dodgy memcache support and having to switch to PDO, though it's still far from suitable for general use with xenforo until either hhvm supports mysqli or xenforo fully supports pdo.

Performance gain was nice though:

Before: 40-60ms (incl. 6ms mysql)
After: 20-24ms (incl. 6ms mysql)

And that's without any cache set in config.php, so it'll likely go a couple of ms faster still
 

Sheratan

Well-known member
#43
Got the homepage of my forum fully loading on HHVM 2.3.2 without any huge issues besides dodgy memcache support and having to switch to PDO, though it's still far from suitable for general use with xenforo until either hhvm supports mysqli or xenforo fully supports pdo.

Performance gain was nice though:

Before: 40-60ms (incl. 6ms mysql)
After: 20-24ms (incl. 6ms mysql)

And that's without any cache set in config.php, so it'll likely go a couple of ms faster still
I'm using percona with mysqlnd, will it works?
 
#44
Got the homepage of my forum fully loading on HHVM 2.3.2 without any huge issues besides dodgy memcache support and having to switch to PDO, though it's still far from suitable for general use with xenforo until either hhvm supports mysqli or xenforo fully supports pdo.

Performance gain was nice though:

Before: 40-60ms (incl. 6ms mysql)
After: 20-24ms (incl. 6ms mysql)

And that's without any cache set in config.php, so it'll likely go a couple of ms faster still
I had 3 problems with HHVM:
1. Some plugins are not working(PDO problems)
2. You are not able to install new plugins (PDO problems)
3. ElasticSearch not working (PHP problems)

Luke Foreman, have you tested that?

Anyway, I believe that if developers will make a few changes in the xenforo code it will work perfect. The next improvement could be using HandlerSocket to work faster with mysql :)
 
#50
Hi all! If you want to get your XenForo working with HHVM do the following:

1. (if using ElasticSearch) /library/XenES/Api.php and replace, line 35
replace
Code:
$this->_httpClient = XenForo_Helper_Http::getClient($this->_server, array('keepalive' => true, 'timeout' => 45));
with
Code:
$this->_httpClient = XenForo_Helper_Http::getClient($this->_server, array('keepalive' => false, 'timeout' => 45));
2. /library/Zend/Crypt/Hmac.php, line 150
replace
Code:
return hash_hmac(self::$_hashAlgorithm, $data, self::$_key, 1);
with
Code:
return hash_hmac(self::$_hashAlgorithm, $data, self::$_key, true);
3. /library/Zend/Db/Statement/Mysqli.php, line 72
replace
Code:
if ($this->_stmt === false || $mysqli->errno) {
with
Code:
if ($this->_stmt === false || $mysqli->mysql_errno()) {
/library/Zend/Db/Statement/Mysqli.php, line 77
replace
Code:
throw new Zend_Db_Statement_Mysqli_Exception("Mysqli prepare error: " . $mysqli->error, $mysqli->errno);
with
Code:
throw new Zend_Db_Statement_Mysqli_Exception("Mysqli prepare error: " . $mysqli->mysql_error(), $mysqli->mysql_errno());


It would be nice to have these changes in future releases of XenForo.
 
Last edited:

lazy llama

Well-known member
#52
Finally I managed to run HHVM in prod! applelife.ru (please do not consider as an ad). Keeping fingers crossed :)
Looks like those fingers need more crossing:
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.
 
#56
The end of March has been given as a release date for the version that has mySQLi (http://www.hhvm.com/blog/3689/implementing-mysqli).
That's some amazing news.
Looking at the post, they stated they intend to include MySQLi compatibility in the 2.5.0 release which, according to the Roadmap, will be cut from the branch at the 17th of March and released 10 days later. That's only 21 days from now! Time to get our party hats on and celebrate this celebration, people.
 

wcbryant

Active member
#57
From a post by Julien Verlaguet and Alok Menghrajani at code.facebook.com:
"Today we're releasing Hack, a programming language we developed for HHVM that interoperates seamlessly with PHP. Hack reconciles the fast development cycle of PHP with the discipline provided by static typing, while adding many features commonly found in other modern programming languages.

We have deployed Hack at Facebook and it has been a great success. Over the last year, we have migrated nearly our entire PHP codebase to Hack, thanks to both organic adoption and a number of homegrown refactoring tools.

We're also proud to release an open source version of Hack to the public http://www.hacklang.org/ as part of our HHVM runtime platform, which will now support both Hack and PHP."

Big and interesting development.
 
Top