HHVM support in Custombuild 2.0

thesilentman

Verified User
Joined
Jun 17, 2003
Messages
51
Hi guys,

I believe it' s time that HHVM is also included / supported in CustomBuild 2.0.

HHVM in many ways faster and needs less resources than the PHP we knew until now.

It also has a lot of goodies like:

- being able to write extensions in PHP besides C++
- async support
- generics

HHVM also supports the Hack language besides & at the same time as PHP, which is a great thing.

It should be noted that HHVM is not 100% compatible to vanilla PHP, but nonetheless they have managed to get very close until now and it can in many cases be used as a drop-in replacement to PHP.

The pace at which HHVM is being pushed forward is absolutely amazing and needless to say, since it's backed by Facebook, I wouldn't be surprised if it gets the "new PHP" very soon.

Here are a few more links on HHVM in general and HHVM 3.0, which was just released a few days ago.



Building a Better PHP with HHVM and Hack: Part 1

Magento and HHVM

HHVM and Drupal (i.e. Drupal drinks some RedBull)

HHVM vs Zephir vs PHP: The showdown

HHVM and WordPress*
* note MySQLi extension is now implemented in HHVM 3.0.1


What do you think?

Greetings,
Frank
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Could be interesting as an alternative for people who don't offer traditional hosting or only have geeks as customers. It's currently compatible with so few frameworks and extensions that lots of things will break and that will lead to an increase in support requests.
http://hhvm.com/frameworks
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Could be interesting as an alternative for people who don't offer traditional hosting or only have geeks as customers. It's currently compatible with so few frameworks and extensions that lots of things will break and that will lead to an increase in support requests.
It's beginning to get there in terms of cmpatibility, and if I were building (for example) WordPress-only systems, I'd probably give it a try. But it's likely always going to be behind the php curve so if any of your clients are writing to the latest PHP (and if you're currently forced to serve the latest PHP for that reason) then it might not be a good solution.

I'm also wondering about:

PHPmyAdmin
PHPInfo (will it tell us it's not real PHP?)
RoundCube (all our servers running email services need to run RoundCube)

and of course about that stated 10x faster. Faster than which implementation of PHP? We're running it using mod_ruid2, and we think it's quite fast on modern servers.

If it were available I'd probably build out a VPS for someone to do tests, but not before then.

Let's see if others join in the dialog, and if so, depending on what they write, perhaps I should move the thread and make it a feature request.

Jeff
 

thesilentman

Verified User
Joined
Jun 17, 2003
Messages
51
Edit:
This Answer was for interfasys.

Yes, that's true, however, I'd rather make that feature request now and maybe have the feature in x months when people start wanting it, instead of not having it. Note: Of course I can set it up myself, but the "correct way" would be to have it installed by the CP tools.

BTW, there are many frameworks supported and also many modules written as we speak. HHVM is gaining a lot of momentum and support from the community, that it might very quickly become a necessity to have, as it evolves much faster than vanilla PHP and provides performance and tools that PHP should have had long ago.
 

thesilentman

Verified User
Joined
Jun 17, 2003
Messages
51
@nobaloney
It's beginning to get there in terms of cmpatibility, and if I were building (for example) WordPress-only systems, I'd probably give it a try. But it's likely always going to be behind the php curve so if any of your clients are writing to the latest PHP (and if you're currently forced to serve the latest PHP for that reason) then it might not be a good solution.
Actually, with this pace, I guess they'll overtake PHP :D
Joke aside, I believe that they'll be able to port any new functionality in PHP very quickly to HHVM and provide immediate compatibility.

I guess, when they're done with trying to get as much as possible "PHP compatible", for the current and upcoming PHP version they'll get even more into optimizations and expanding the Hack language.
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
It's beginning to get there in terms of cmpatibility, and if I were building (for example) WordPress-only systems, I'd probably give it a try. But it's likely always going to be behind the php curve so if any of your clients are writing to the latest PHP (and if you're currently forced to serve the latest PHP for that reason) then it might not be a good solution.

I'm also wondering about:

PHPmyAdmin
PHPInfo (will it tell us it's not real PHP?)
RoundCube (all our servers running email services need to run RoundCube)

and of course about that stated 10x faster. Faster than which implementation of PHP? We're running it using mod_ruid2, and we think it's quite fast on modern servers.

If it were available I'd probably build out a VPS for someone to do tests, but not before then.

Let's see if others join in the dialog, and if so, depending on what they write, perhaps I should move the thread and make it a feature request.

Jeff
Since DA now offers a way for the customer to select a PHP version to use, I guess the customer can switch to HHVM to see if things still work and that won't create a support headache as it's easy to print a large disclaimer saying that they're on their own if using this particular setup. Having said that, we all know that we're going to try and help them and that means learning how to debug that extra layer.

However, it could be beneficial to be able to use this for webapps if those are using a significant amount of the server's resource. I'm particularly interested in the reduced memory footprint since mobile syncing is using a lot of persistent PHP connections.
As far as loading pages of a CMS, I'm not convinced the VM will be any faster than using a caching mechanism such as varnish, nginx, APC, redis, etc.

thesilentman said:
Edit:
This Answer was for interfasys.

Yes, that's true, however, I'd rather make that feature request now and maybe have the feature in x months when people start wanting it, instead of not having it. Note: Of course I can set it up myself, but the "correct way" would be to have it installed by the CP tools.

BTW, there are many frameworks supported and also many modules written as we speak. HHVM is gaining a lot of momentum and support from the community, that it might very quickly become a necessity to have, as it evolves much faster than vanilla PHP and provides performance and tools that PHP should have had long ago.
I see what you mean, but why prioritise this "language" when Ruby, node.js, java, python, etc. are not yet available in CB/DA? Those languages have larger user bases per example and would allow a hosting company to offer a broader range of apps and services instead of a different, less compatible PHP.
I'm just mentioning it because if this becomes officially supported, then it will take a chunk of resources out of other projects the CB team might want to work on.
 

thesilentman

Verified User
Joined
Jun 17, 2003
Messages
51
Since DA now offers a way for the customer to select a PHP version to use, I guess the customer can switch to HHVM to see if things still work and that won't create a support headache as it's easy to print a large disclaimer saying that they're on their own if using this particular setup. Having said that, we all know that we're going to try and help them and that means learning how to debug that extra layer.

However, it could be beneficial to be able to use this for webapps if those are using a significant amount of the server's resource. I'm particularly interested in the reduced memory footprint since mobile syncing is using a lot of persistent PHP connections.
As far as loading pages of a CMS, I'm not convinced the VM will be any faster than using a caching mechanism such as varnish, nginx, APC, redis, etc.


I see what you mean, but why prioritise this "language" when Ruby, node.js, java, python, etc. are not yet available in CB/DA? Those languages have larger user bases per example and would allow a hosting company to offer a broader range of apps and services instead of a different, less compatible PHP.
I'm just mentioning it because if this becomes officially supported, then it will take a chunk of resources out of other projects the CB team might want to work on.
Hm, OK, I would prioritize HHVM because it is "almost" a drop-in replacement for PHP, for a quickly growing sample of cases. So it's not another language, like node Jave, etc...
Hack on the other hand is PHP 'extended' with a lot of goodies, but it can run in HHVM even in mixed mode (php + Hack scripts).
Also, it works with FastCGI, so it could work without all to many changes to CB.

Now, for the VM vs redis varnish comparison, I think you are comparing different things. You cannot compare execution with external caching... ;)

What you can compare of course is PHP with APC or Opcache against HHVM.

Now, HHVM uses a Just-InTime (JIT) compiler to compile the bytecode into machine code, which it then runs very fast. Surely there is a penalty for compile time, but when it starts running, it runs a lot faster than the zend engine (even with opcache) in PHP. This one is comparable.
In caching HHVM goes a different path and stores its cache on disk, contrary to Opcache and APC, but it also does not need to recompile every time, which brings a lot of performance, especially in heavy web tasks, like a CMS.

As for Nginx, Redis, Memcached, etc, with all those you can and should implement additional performance on top of both PHP and HHVM (or any other language), so that is no unique benefit for PHP.

Finally, since Facebook is, and will be using HHVM for its infrastructure, where every tiny bit of performance-gain or -loss, means a lot of $$$$$$, they will be making a lot of effort to squeeze the most out of HHVM in terms of performance. So, I strongly believe that a CMS will very much benefit from HHVM as well, given compatibility of course.

Wow, this got longer than expected. Hope I did not bore you. :)

Greetings,
Frank
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hm, OK, I would prioritize HHVM because it is "almost" a drop-in replacement for PHP, for a quickly growing sample of cases. So it's not another language, like node Jave, etc...
Hack on the other hand is PHP 'extended' with a lot of goodies, but it can run in HHVM even in mixed mode (php + Hack scripts).
Also, it works with FastCGI, so it could work without all to many changes to CB.

Now, for the VM vs redis varnish comparison, I think you are comparing different things. You cannot compare execution with external caching... ;)

What you can compare of course is PHP with APC or Opcache against HHVM.

Now, HHVM uses a Just-InTime (JIT) compiler to compile the bytecode into machine code, which it then runs very fast. Surely there is a penalty for compile time, but when it starts running, it runs a lot faster than the zend engine (even with opcache) in PHP. This one is comparable.
In caching HHVM goes a different path and stores its cache on disk, contrary to Opcache and APC, but it also does not need to recompile every time, which brings a lot of performance, especially in heavy web tasks, like a CMS.

As for Nginx, Redis, Memcached, etc, with all those you can and should implement additional performance on top of both PHP and HHVM (or any other language), so that is no unique benefit for PHP.

Finally, since Facebook is, and will be using HHVM for its infrastructure, where every tiny bit of performance-gain or -loss, means a lot of $$$$$$, they will be making a lot of effort to squeeze the most out of HHVM in terms of performance. So, I strongly believe that a CMS will very much benefit from HHVM as well, given compatibility of course.

Wow, this got longer than expected. Hope I did not bore you. :)

Greetings,
Frank
That's the almost which is a problem ;).
Almost runs most major frameworks and CMS as long as you only use the top extensions
Almost has the most commonly used PECL extensions
etc.
No hosting company can offer only that instead of PHP to the general public, so it's something which consumes more company resources without adding a whole lot of advantages to most use cases from my pov.
That's assuming, it's not simply a 2 hour job to add another function in CB2 to compile another PHP version and add it to the list of available PHP version, in which case it's a no brainer for the CB/DA team, once PHP-FPM finally works out of the box.

Regarding caching, the point I'm trying to make is that execution time doesn't matter if all you're serving is the cached page and objects.
Facebook is the perfect customer for HHVM because they dynamically generate different views for every user and so needed something which could do that very quickly. Other good customers would be anything which can't be cached, of course, like a forum.

I'm not trying to bring down your proposal btw ;). I just want to make sure that development resources are properly allocated based on what could bring the biggest benefit to our community.
I'm sure that if you were to provide the couple of needed templates and the buildHHVM() function, it could be easily tested and implemented by the dev team :)
 

thesilentman

Verified User
Joined
Jun 17, 2003
Messages
51
:D
Yes, you are right, that "almost" is the "thing" and your points are correct. But that's why I'd like it in addition to PHP, not instead of it. ;)

As for caching, yes, but execution time still does matter, cause even in CMS there are cases were things cannot be cached, and execution performance does indeed matter. :)
Caching is a really big discussion, as for how to cache and what to cache, etc.. so many use-cases which can be solved with different approaches...

I'd gladly work on including HHVM into CB2, but I am tied up in so many different things atm, that I just don't have the time to dig into that, at least at the moment... Who knows, maybe I'll find some time in the near future, if the DA/CB team have not included it by then ;)

Thank you very much for your thoughts on this. :)
 
Last edited:

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
No hosting company can offer only that instead of PHP to the general public, so it's something which consumes more company resources without adding a whole lot of advantages to most use cases from my pov.
You make a good point. To a great extent the cost of supporting clients can be much higher than the cost of hosting them. For my company it certainly is. So I want compatibility as much as possible.

That said, I've discussed HHVM with one of our webmasters, and he and I agree that it holds great future promise. I'd like to see it put in the list of projects to work on. I've moved the thread and I've made it a Feature Request. But i imagine it will need more interest than simply the three of us before I'd expect DirectAdmin staff to prioritize the work.

And I'd expect to see it more useful in a specialty environment (single-site hosting, or for example, Wordpress hosting if virtually all of the plugins work with it.

Thread moved. Let's see now if it gains traction as a Feature Request.

Jeff
 

Freek

New member
Joined
Mar 6, 2013
Messages
2
+1

Hello,

We would love this feature! It is not just that HACK is kinda cool but also the performance of software like Magento is way better.
 

jkirker

Verified User
Joined
Nov 22, 2012
Messages
97
Has anyone written a step-by-step on implementing HHVM w/ DA?

Has anyone written a step-by-step on implementing HHVM w/ DA? Just curious.

If you've done it I'd love to see it. I want to start testing HHVM with certain applications.
 
Top