Live data from Hacker News

Experimenting with HHVM at Etsy

codeascraft.com

31–39 of 39 posts

Re: Experimenting with HHVM at Etsy

#31

I guess the question I've been having is that if I want to begin a new project with performance as a main priority, should I use HHVM+PHP or HHVM+Hack over something like Java or Go, or is it more for making existing PHP codebases more performant.

The development cycle with PHP/Hack is fast. You code, then press F5 in the browser and see result instantaneous. With other languages, a static compilation time of even just a few seconds is very contra productive and annoying. Writing less (redundant) code helps a lot with prototyping too (dynamic typing, optional static types). The documentation on php.net with comments on each page (from the community) is very good.

Node/IO.js and Go have their advantages, especially if one wants to use WebSocket.

Nowadays, half of the code is client side anyway (be it HTML5 JS (maybe with React/Angular) or mobile apps) - in such cases the server output and receives a lot of JSON. And then Node.js/Go/HHVM are about equal as good in benchmarks, at least in my personal benchmarks (10.000 -100.000 requests/s with Apache AB tool).

Re: Experimenting with HHVM at Etsy

#32

Calling setlocale because the user you're currently processing has a different locale? What the..? Notice: what works in UNIX utilities is not what works for web apps serving many users simultaneously. In fact, I'm pretty sure this doesn't work for UNIX utilities either and is just something you should never touch with your libc. It's like calling non-reentrant strtok, some of this stuff just doesn't exactly fit into…

It ends up changing the output of icu-based libraries, localizing stuff like number formatting. Otherwise you're re-implementing that in userland code, which is likely to be much slower.

Re: Experimenting with HHVM at Etsy

#33

Calling setlocale because the user you're currently processing has a different locale? What the..? Notice: what works in UNIX utilities is not what works for web apps serving many users simultaneously. In fact, I'm pretty sure this doesn't work for UNIX utilities either and is just something you should never touch with your libc. It's like calling non-reentrant strtok, some of this stuff just doesn't exactly fit into…

The PHP library is (surprise!) sort of a mess when it comes to things that use the libc locale (which tend to offer no other way of switching locale or encoding), things that use the locale settings from the intl extension, things that respect the default_charset setting (and/or the input_encoding setting, output_encoding setting, or internal_encoding setting), and things that actually take one or more of these settings as arguments.

Re: Experimenting with HHVM at Etsy

#34
Is a comprehensive test suite for PHP a byproduct if this?

Last time I checked PHPs own tests only had about 30% coverage, and with a famously idiosyncratic language like PHP, which apparently needs a massive internal overhaul to increase speed, that seems less than optimal.

I thought the test suite was one of the best things to come our of multiple ruby implementations, though I read recently that core Ruby ignore it and so regularly introduce bugs that it would catch.

Re: Experimenting with HHVM at Etsy

#36

And later this year, PHP 7 is coming, which should bring huge performance improvements.

Beyond HHVM, in fact, has oob compiler. We've opted to hold off until 7 is out - HHVM extension support is still patchy.

Plus the whole "warm-up" procedure just seems immensely patchy to me - hopefully no such thing will be needed in PHP7.

Re: Experimenting with HHVM at Etsy

#38

I guess the question I've been having is that if I want to begin a new project with performance as a main priority, should I use HHVM+PHP or HHVM+Hack over something like Java or Go, or is it more for making existing PHP codebases more performant.

I'm a little surprised that HHVM would make or break anyone's decision to use PHP, since I'd think that there are more important language design concerns and features that ought to figure before it came down to that... at least in a PHP-vs-Java sort of fight, anyway. Big questions like your preferred form of typing (strong/weak, dynamic/static/Hindley-Miller inference, etc), threading, ease of writing list comprehens…

For me I guess it's choosing the right weapon for the right enemy. If my greatest priority is shipping something tomorrow, I'll choose PHP or Python because I can code that in a blink.

However, if I'm able to hang back and take some time to develop something, priorities like being able to handle X I/O writes or, as you point out, threading becomes more relevant.

Re: Experimenting with HHVM at Etsy

#39
post #8

The good news about hhvm is that with the newest builds from the past few months you can finally run it longer than a week without memory leaks and crashing under high loads. If you look at the changelog, you can see it really is a beta product that people use in production anyway https://raw.githubusercontent.com/facebook/hhvm/master/NEWS "Ditko" 26-Feb-2015 finally solved me having to restart it every several days…

This is what caused me to abandon HHVM for plain ol' PHP around a year ago. I was running it in Docker containers and the memory leaks would regularly crash my containers if left unattended for more than a couple of days. It was quite frustrating because I noticed some definite performance gains (e.g., ~2x faster page loads, etc.), but ultimately opted for PHP's stability. The benefit to running all this in Docker is…

Update: we had an hhvm install today that crashed after 15 days or so.

Apparently this still happens but instead of several times per month, it is now a couple times per month.

Sigh, well PHP7 is right around the corner.

Post reply on HN