PHP HHVM support for better performance

Caelum shared this idea 3 years ago
Open Discussion

HHVM has been in development for quite some time now. As of December last year, HHVM has supported FastCGI. For those not in the loop, HHVM, or HipHop Virtual Machine, is Facebook's method of handling PHP. It translates PHP into x64 machine code using a JIT compiler. It has almost complete support for everything you can normally do with PHP (you can find its compatibility with popular frameworks here), and it performs absurdly well in benchmarks - see http://hhvm.com/blog/1817/fastercgi-with-hhvm for example. It's fully open-source, and very actively being developed.

I'd love to see cPanel implementing this as it provides tremendous performance gains.

Comments (57)

photo
1

Yes, sounds nice!

Please cPanel, do consider this.

Thanks,

photo
1

Yes! CPanel, we would love to see this support. Hack support would be handy as well...

Thanks!

photo
1

I've voted for this too. However we would either have to have a specific hhvm cpanel server and move Customers to it or we would need to all customers to choose this for their virtualhost. I'm about to give this à try on a plain os without cpanel to check out the performance increase, compatibility, stability etc

photo
1

This should be implemented like ASAP. Tired of ZEND stuff around.

photo
2

Has anyone had any success implementing PHP HHVM on their own? It's very helpful for us to hear about real world experiences with features we are considering to add in cPanel & WHM.

photo
1

@cPScottT right now I'm not in position to try to deploy that, since I don't have a spare WHM server and/or time. However I've been deploying HHVM/facebook hack on Debian machines for a while (for SaS solutions) and the performance improvement is notable.

I guess WHM/cPanel would take a big benefit from HHVM specially since it's fully compatible (or near) with previously written PHP software and it support facebook hack.

photo
1

TCB13 wrote:

@cPScottT right now I'm not in position to try to deploy that, since I don't have a spare WHM server and/or time. However I've been deploying HHVM/facebook hack on Debian machines for a while (for SaS solutions) and the performance improvement is notable.

I guess WHM/cPanel would take a big benefit from HHVM specially since it's fully compatible (or near) with previously written PHP software and it support facebook hack.

Is there any data on how well HHVM supports the various loaders (e.g. ioncube)? How compatible is HHVM with wordpress (likely the most popular PHP application out there)?

cPanel & WHM itself would not benefit from HHVM as it is not written in PHP.

What concerns are known about using HHVM in a shared environment? The vast majority of people that use cPanel & WHM do so in a shared, multi-user environment.

photo
1

Kenneth Power wrote:

Is there any data on how well HHVM supports the various loaders (e.g. ioncube)? How compatible is HHVM with wordpress (likely the most popular PHP application out there)?

cPanel & WHM itself would not benefit from HHVM as it is not written in PHP.

What concerns are known about using HHVM in a shared environment? The vast majority of people that use cPanel & WHM do so in a shared, multi-user environment.

HHVM is a drop-in replacement for the ZEND PHP engine, that is actually much faster.

From their own website HHVM is completely compatible with the most PHP frameworks

Wordpress is also compatible, their team issues a specific update for HHVM https://core.trac.wordpress.org/ticket/27231

Facebook team also tested Wordpress in HHVM vs PHP-FPM in terms of requests/sec and these are the results:

  • PHP-FPM: 23.17 [#/sec]
  • HHVM-FastCGI: 184.71 [#/sec]

As you can see the results are impressing. I've noticed this on my own company software as I told before.

About shared environments: I guess there might be some fundamental differences regarding the way HHVM manages threads and pools internally. You should read this: http://hhvm.com/blog/1817/fastercgi-with-hhvmHHVM can provide means to execute PHP much faster and reduce server costs and... IMHO the best thing in support for Hack, probably the future of PHP.http://hhvm.com/

photo
1

Actually on the performance test they got:

Requests per second: 949.21 [#/sec]

The second time the test was run.

photo
1

Check out this page: http://hhvm.com/frameworks/

Regarding WordPress:While WP runs VERY fast on HHVM, it may not be possible to use HHVM for every WP installation. Reason being: Plugins may use code that is not compatible with HHVM.

Regarding ioncube:This forum post suggest that ioncube will (have to) run on HHVM in the near future, but at the moment it is not: http://forum.ioncube.com/viewtopic.php?p=10357

photo
1

The advantage of HHVM is its JIT (custom in time compiler).

PHP NG (most likely called PHP 7 as this is the next major version of PHP) is actually almost as fast as HHVM as they have greatly reduced the number of calls required.

https://wiki.php.net/phpng

We mustn't forget that HHVM is designed to be compatible with scripts that work with PHP but can still have some bugs in some situations.

I think users should have the choice between hhvm and normal PHP and that hhvm for shared hosting shouldn't be the only or even the default PHP engine.

I also think that PHP is catching up with HHVM, apart from hack, maybe there could be no use for it in a couple of years as PHP will be the most compatible solution.

HHVM is fully compatible with Wordpress as well as alot of other scripts

Here is the official list of compatible php frameworks :

http://hhvm.com/frameworks/

photo
1

http://hhvm.com/blog/1817/fastercgi-with-hhvm#comment-143129

That comment suggests HHVM PHP code will execute as a common, shared user (e.g. 'nobody'). That tends to be a security problem in multi-user environments.

photo
2

Usually this problem is fixable by having a HHVM process peer user. Same as PHP but a if a request is coming for the same user the existing HHVM process (for that user) will be used instead of creating a new one.

photo
1

Very very good idea!

photo
1

Any update on cpanel support for HHVM?

photo
1

Yes, is there any update about adding HHVM to WHM/cPanel?

photo
1

I am throwing my hat in the ring, too. Our network will grow rapidly this year from mom and pop to enterprise, and HHVM vis cPanel would be a huge help.

photo
1

We would like to switch to Hack as soon as our IDE support it. So please have it as soon as possible. Thanks

photo
1

This is certainly desirable on our end as well. I think that it could be compiled in to allow security in a multi-user environment from what I'm seeing here.

photo
1

+1 on this!

photo
1

+1 , waiting a year for this

photo
1

hello, can we get some timframe when thus prihect will be completed?

thank you

photo
1

We have no immediate plans to add HHVM support.

photo
1

Why?

Whats stopping cPanel?

photo
1

There are simply other features prioritized ahead of a new PHP engine.

photo
1

I think it would be nice if there are no plans to at least 'unofficially' come up with a guide on how to manually implement it :)

photo
1

Well, cPanel is a Paid product, and it is not cheap. Give customers what thay want...

photo
1

Sure, which is why we are delivering CentOS 7, the ability to sync calendars and contacts to your phones, and more. We are delivering what customers are asking for :)

photo
photo
1

is there any plan ;) ?

photo
1

I'd like us to get to a point where we can easily roll out things like HHVM in an experimental capacity. That would allow early adopters the ability to quickly move onto emerging technologies on a cPanel & WHM server. The changes we are making to our web stack (see https://forums.cpanel.net/threads/easyapache4-announcement.447882/) and our adoption of yum package deployments should make that easier, from the technical point of view.

We'd still need to consider support overhead. Adding additional things has a corresponding cost in support for us, and our partners. Many of the really cool things produced are designed for single application, or single user execution. Getting those to work in an environment where there are hundreds of users, and thousands of applications, can be complicated.

photo
photo
1

Is HHVM still worth implementing with the future arrival of PHP 7 ?

The current benchmarks seem to imply that PHP 7 can be faster than HHVM without JIT and they say that PHP 7 is much more optimised for JIT which if implemented could make it much faster than HHVM.

photo
1

guys php 7 will come as i see in several years to cpanel. 5.6 is still in experimental status.

hhvm is speed providing system and i hope it will ve added to cpanel. why do we need? until php 7 will available and software builder make their scripts compatible we will depend on hiphop ;)

photo
1

Actually cPanel's plan is to release PHP7 soon after it becomes stable, not like what happend with PHP 5.6.

I can't see HHVM being released before PHP7 which hopefully will be the proof that new versions will be made available much faster after EA4 has made it to stable.

photo
photo
1

@monarobase is right... cPanel is probably waiting for PHP7 instead of implementing HHVM.

@Luka, they are... and HHVM support simply did not get enough votes compared to other feature requests.

@Tcalp you mean something like this?

http://wiki.mikejung.biz/HHVM#How_to_run_HHVM_in_a_Ubuntu_docker_container_on_cPanel

photo
1

nDeploy has HHVM support .

photo
1

HHVM is only secure if you run one process per user. I hope they run a HHVM instance per user and not a single HHVM instance shared by all users.

photo
1

@monarobase- HHVM needs to be run per user is big on resources as per my tests . Imagine a server with 500 users who all have an instance of HHVM running . HHVM was not created for a shared hosting type of environment . The best right now is to start a single instance and run all domains under it . Note that this was how mod_php worked and there were many people( there still are!) who runs everything under the nobody user.

nDeploy right now use a single instance ;But it should be easy to start an instance per user if we keep track of which all domains have hhvm active etc . There are some scripts which specifically starts multiple instance under different ownership readily available too

photo
1

The ressources required would be mainly memory. When we moved from litespeed's single PHP instances that was forked per user to an instance per user to allow each user to have his own private opcache we went from 45 GB of used memory to around 60, but our servers now have a minimum of 128 GB so this was not an issue.

It seems almost counter productive to run only one user on shared hosting nowerdays. I don't know any hosts that still use mod_php for shared hosting.

Any files created by a HHVM single instance will require the root user to delete them (or to delete them with the HHVM user), things like automatic WordPress updates would require all files to have write access to the HHVM user and you often have users who put all files in chmod 777 which is a huge security issue.

Most cPanel hosts start with SuPHP or Fastcgid and now cPanel encourages Mod_Ruid (which is concidered as insecure by Cloudlinux CEO). CloudLinux users now have mod lsapi (still in their testing respository) and will soon have PHP 7.0 alpha ( still in their testing respository, but hopefully will be available in stable in a week or so).

As we use Litespeed + Cloudlinux, PHP 7 seems a much better option than HHVM for the moment.

photo
2

PHP7 is faster than HHVM 3.7 out of the box:

http://talks.php.net/velocity15#/boxspecs

Consider making installing and switching between versions more trivial...

http://talks.php.net/velocity15#/php_contribute4

photo
1

With Cloud Linux you already have php7

photo
1

I've never considered facebook to be a fast site, at least on my country so, i'm not that interested in the tech it's using.

photo
1

HHVM Team also working.So HHVM will option cpanel can keep on their EasyApache 4.

photo
1

Is HHVM already in cPanel?

photo
1

Now that we have EasyApache 4, I think HHVM is something that could be done.

photo
1

I'm not really sure why EA4 has that much to do with HHVM, equally it's support in older OS's is problematic; That said, it performs just about the same as PHP7 and I imagine we will see support for that a lot sooner.

photo
1

Since PHP 7 is going to be released next month, all the attention should go on adding PHP 7 to cPanel. HHVM is no longer needed.

photo
2

I wouldn't go that far & say it's unnecessary, but PHP7 implementation should be of higher importance – yes.

photo
photo
1

Now that PHP7 has been implemented in EA4 on cPanel, has there been any movement on this development for HHVM incusion?

photo
1

PHP7 largely negates the need for HHVM ?

photo
1

I'm also interested in a response to this request. It could be interesting but maybe they want to develop the support for alternative HTTP servers, like nginx.

photo
1

you just dont understand the difference... HHVM beats all Apache mod_s' available by CPU and RAM usage.

have you tried to benchmark two setups with php7 and hhvm with a little siege ddos on 2 core cpu?

guess which one survives?

photo
1

Yes, what does HHVM do that PHP 7 doesn't do about as well?

photo
1

What OS are you using with HHVM?

From what I've readed here (https://docs.hhvm.com/hhvm/installation/linux) it comes shipped in prebuilt install packages for Ubuntu and Debian. So, will it work on CentOS? is it compatible with RHEL based systems?

And something else that's not completely clear to me right now: does HHVM REPLACE Apache+PHP? or should they be kept installed for HHVM to work?

photo
1

I'm not sure HHVM is secure for shared hosting. If you aren't doing shared hosting then OpenLitespeed + PHP7 is pretty much on par with HHVM (litespeed's benchmarks achieved 125,9 (PHP7) vs 135,3 (HHVM) WordPress page views per second. Not enough in my oppinion to warrant the developement to move to HHVM, especially as PHP could in the future versions implement JIT and start doing better than HHVM.

photo
1

Hi, Are you sure that Openlitespeed+php7 will perform similar to hhvm? I just read this article where some tests are made and it appears that nginx+ hhvm performs much better than openlitespeed

https://www.conetix.com.au/blog/apache-vs-nginx-vs-openlitespeed-part-1

photo
1

That's a two year old article with PHP 5.4...

photo