Jump to content

Does ProcessWire work with the HipHop Virtual Machine (HHVM)?


saml
 Share

Recommended Posts

Hi,

I watched the "Taking PHP seriously" talk by Facebook engineer Keith Adams at StrangeLoop conf, and got interested to try out the HipHop PHP VM, which seems to be able to speed things up by quite a lot.

According to this blog post on the HHVM blog, it also seems to have gained very good unit test coverage for a lot of frameworks (Drupal and Lavarel to name two), so I was interested to hear if anyone has tried it with proceswire?

(Not that ProcessWire is slow in itself - the opposite! - but with all these high performing frameworks today like node.js and golang, it would be nice to see how far we could take PHP so we can use existing awesome PHP code like ProcessWire :) )

  • Like 1
Link to comment
Share on other sites

Hi,

doesn't see hhvm before but looks interesting... 

htaccess and php.ini support seems missing at the moment, but is planned.

I'll read some more about it and maybe do some (simple) tests with it...

*update*

Simple installation (CentOS 6 yum repo) and a simple php test works fine, but to run PW, Drupal ... I think the htaccess file have to be converted, because apache, htacess, php.ini isn't supported by hhvm yet... But seems to be work in progress.

  • Like 3
Link to comment
Share on other sites

Many thanks for the info pwFoo! I really should go about test this myself asap, but have been busy developing my first PW site :)

I'm not sure the .htaccess file should be a too big problem. For rilpartner.se, .for example, we are successfully ourselves using nginx, which has its own URL handling, and I could easily add the single rewrite rule needed to get it to work ... and I from what I've hear, hhvm should be able to run with nginx, using fastCGI / fasterCGI.

Will also report if I get the time to test this out more!

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...

Yes, it does. I have it run with nginx, so I don't care about the .htaccess ;)

Read the instructions on how to get hhvm running here: http://hhvm.com/blog/1817/fastercgi-with-hhvm 

You might need some tweaking and run into a lot of issues - hhvm has not been tested with ProcessWire. I also chose to let it run at port 8999 to be easily able to switch between hhvm and php5 for reasons of comparison. Your mileage may vary, but with a modern system your chances of getting it to work are better.

Some stats using a fresh installation of Processwire with the site-beginner scheme

ab -c10 -n500 http://pwtest.gurkendoktor.de/
php5-fpm:
Concurrency Level:      10
Time taken for tests:   23.425 seconds
Complete requests:      500
Failed requests:        253
   (Connect: 0, Receive: 0, Length: 253, Exceptions: 0)
Total transferred:      1902241 bytes
HTML transferred:       1700241 bytes
Requests per second:    21.34 [#/sec] (mean)
 
hhvm:
Concurrency Level:      10
Time taken for tests:   8.702 seconds
Complete requests:      500
Failed requests:        232
   (Connect: 0, Receive: 0, Length: 232, Exceptions: 0)
Total transferred:      1900304 bytes
HTML transferred:       1700304 bytes
Requests per second:    57.46 [#/sec] (mean)

This is in no way scientific. PHP does not use an opcode cache, which speeds up things a lot. on the other hand, hhvm gets better the "warmer" it gets (ie. the more load it gets).

The nice thing is, that it still works with fcgi_cache:

Concurrency Level:      10
Time taken for tests:   5.110 seconds
Complete requests:      500
Failed requests:        491
   (Connect: 0, Receive: 0, Length: 491, Exceptions: 0)
Total transferred:      1912527 bytes
HTML transferred:       1699527 bytes
Requests per second:    97.85 [#/sec] (mean)

Yes, there are some more "failed requests" - I blame this on ab ;)

Anyway, this is just plain ol' PHP Code. What would be interesting is to actually write a module in hack (the hhvm language) and see if this actually works. Because then you'll be able to harness hhvm's full power and experience an incredible performance boost. I'll figure this out later when there's time. 

More interesting it would be to fork the ProcessWire core and move it to hack. This would incredibly boost the performance, but brings other issues. But I guess this is too much of an effort, I myself wouldn't be able to do it ;)

  • Like 8
Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...