7 ms·
PHP 7 at Tumblr
- piotrjurkiewicz 10y agoI wonder if Wikipedia regrets its switch to HHVM, having in mind that PHP7 is quite the same fast as HHVM is real apps and switching to it would require much less work than to HHVM.
- overcast 10y agoThat's quite a performance improvement. I'm curious if this was directly related to just switching to PHP7, or something under the Tumblr hood, that they improved upon as well. While reviewing their own code.
- Malic 10y agoI guessing that it was just the PHP7 switch. We are seeing similar performance/resource-usage changes just with a switch from PHP5.6 (opcache enabled) to PHP7 (opcache enabled).
- emeraldd 10y agoIt sounded like they were running the same code in both places, not a separate code base. (With the exception of extensions.) So unless those extensions are heavier than I'd guess, probably just the PHP upgrade.
- spdionis 10y agoIt's probably just the switch (didnt read the article). A 2-3x performance improvement is reported in almost every project that makes the switch.
- tyingq 10y agoSignificant improvement in response times, TPS, and memory usage are pretty universally observed when switching from PHP5.x to PHP7... https://www.symfony.fi/entry/symfony-benchmarks-php-56-hhvm-and-php-7 https://www.symfony.fi/entry/symfony-benchmarks-php-56-hhvm-... http://www.zend.com/en/resources/php7_infographic http://www.zend.com/en/resources/php7_infographic https://techblog.badoo.com/blog/2016/03/14/how-badoo-saved-one-million-dollars-switching-to-php7/#launch-into-battle-and-the-results https://techblog.badoo.com/blog/2016/03/14/how-badoo-saved-o... Edit: A slide deck with some detail on why it's so much better: http://www.slideshare.net/nikita_ppv/php-7-what-changed-internally-php-barcelona-2015 http://www.slideshare.net/nikita_ppv/php-7-what-changed-inte...
- TazeTSchnitzel 10y agoA fun thing about that slide deck: the memory use reduction is actually even better, because allocation overhead isn't counted there.
- TazeTSchnitzel 10y agoPHP 7 contains a massive overhaul of the PHP interpreter's internal data structures (phpng), which drastically cuts memory usage and improves cache locality, which leads to better performance. There's also some new optimisations, too.
- jsjohnst 10y agoI wasn't involved in the switch, but having extensive knowledge of the code base at Tumblr (used to work there for 3 years) as well as extensive knowledge of PHP (have been a PHP contributor for ~13 years), I can say that this was likely >95% directly related to the switch to PHP7. Many of the patterns used in Chorus (inhouse framework Tumblr is based on) and in the codebase in general would very much benefit from the changes in PHP7 internals.
- 0xmohit 10y agoA recent post about PHP 7 deployment at DailyMotion [0]. Another one, Taking PHP Seriously [1]. [0] https://news.ycombinator.com/item?id=12704511 https://news.ycombinator.com/item?id=12704511 [1] https://news.ycombinator.com/item?id=12703751 https://news.ycombinator.com/item?id=12703751
- return0 10y agoWow good for the environment :)
- orware 10y agoAnother piece to this (for those using MySQL as their backend) is that updates to MySQL can improve things quite significantly as well. In my work environment I"m the main MySQL user so I had setup a dedicated MySQL 5.5 server a few years ago that I hadn't upgraded to any newer versions since then (hey it wasn't broke right?). But recently I had been looking into upgrading just because it felt like it was time, but earlier this week I was checking out some performance degradation on one of our sites and noticed in my local copy it was actually running quite a bit faster. Investigating further, it seems that in the newer versions of MySQL (in my case, my local XAMPP was running MariaDB 10.1.x) the performance has improved quite a bit, particularly for the types of queries I was running on this site (which used a number of subqueries and GROUP BY clauses). Without any sort of application level caching making this single switch from MySQL 5.5 to MariaDB 10.1.19 improved load times from about 3.0 seconds to 1.0 seconds and I'm going to add some application level caching as well to improve things further. This was all without switching PHP versions on this particular site (which is still using PHP 5.4.45)...just thought I'd share since sometimes the slowness isn't always improved as much just by upgrading PHP (which is something I'd like to do too for this site, but at the moment the framework I'm using on the site isn't ready for PHP 7 so it'd be quite a bit of work to switch it out).
- 0xmohit 10y agoComplete list of new features in MySQL 5.7 [0] (in bullet form) would show scores of performance improvements. The performance improvements from 5.5 to 5.6 were significant and 5.7 is much much better. [0] http://www.thecompletelistoffeatures.com/ http://www.thecompletelistoffeatures.com/
- orware 10y agoThanks for sharing that link!
- dijit 10y agoOn the flip side there were severe performance degradations for certain types of queries. Notably Zabbix[0] was affected. [0]: https://m.reddit.com/r/zabbix/comments/3txgov/poor_performances_with_mysql_57/ https://m.reddit.com/r/zabbix/comments/3txgov/poor_performan...
- Judson 10y agoIn addition to latency and cpu usage improvements, we also saw a substantial drop in memory usage for code that allocated a large number of objects. After the initial migration, PHP7 has been very solid in production.
- uses 10y agoWe use the Rackspace Cloud Sites PAAS. They recently released a PHP 7 beta. For our sites running Bolt - a PHP CMS which makes heavy use of autoloaded classes - we saw a performance improvement between 45 and 55 percent. For Wordpress, it was around 30-40%.
- matart 10y agoWere there major improvements to autoloading in PHP7?
- ghurtado 10y agoI can't imagine that any of those performance gains were related to autoloading.
- bkanber 10y agoIt's possible that when switching to PHP7 opcache was enabled by default, whereas it may not have been beforehand. Most likely opcache is responsible for the autoloading improvement. That said, a faster parser and intepreter would do autoloading faster as well, so it may not be opcache at all and just by virtue that the autoloaded classes are interpreted faster.
- Zachery 10y agoHow are you finding bolt? I was looking into it for a personal project and the requirements that composer introduced for auto installing addons made life complicated. Though I guess that is really a composer issue, the inability to not use something like curl when allow_url_fopen wasn't available seems insane to me. allow_url_fopen is not a great thing to have enabled in production.
- uses 10y agoI've found bolt to be completely awesome. I've made 5 or 6 sites with it, made a couple utility extensions, and used the local extension system to do stuff like custom search, a basic shopping cart, and a custom data export feature. Aside from the technology stuff it's got a positive community, good documentation, and active user base on the forum and chat.
- angry-hacker 10y agoDespite all the negativity about PHP, I sincerely thank all the team behind it. Thanks to PHP and its easy way of start building stuff, I started learning programming. While I have moved on, not because it's hip to do so, I hope the community keeps rocking. Thank you again and congratulations.
- tiffanyh 10y agoIs there anymore major performance improvements left to make to PHP or is everything else just dimishing returns? No disrespect to the huge amount of work the PHP team has already completed, they should be praised. Just curious to know if we can expect anymore major performance improvements like we saw from v5 to v7. EDIT: After further searching, appears PHP 8 will have some sort of JIT (with the hope that it'll continue to bring significant perf improvements. More info at http://news.php.net/php.internals/95531 http://news.php.net/php.internals/95531
- progforlyfe 10y agoYes, the next major performance improvements will come from a JIT style machine, similar to what HHVM does.
- tiffanyh 10y agoI'm confused, so PHP 7 today does not have a JIT yet its performance is already on-par with HHVM (which has a JIT). Are you then suggesting that PHP 8 (with a JIT) will be significantly faster than HHVM?
- TazeTSchnitzel 10y agoNot necessarily. It may mean that a lot of HHVM's performance improvements were not related to JIT.
- otto_ortega 10y agoI'm also confused. Php 7 has Opcache, which according to the documentation: "OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request." How would JIT features come into play with it?
- deleted 10y ago[deleted]
- 10y ago
- otto_ortega 10y agoPhp 7 for the win!
- stefs 10y ago> As you can see, the latency dropped to less than half, and the load average at peak is now lower than it’s previous lowest point! the graph they're referencing shows the peak at higher than the previously lowest load. i guess "peak average" is the key to this.
- rampage101 10y agoPHP 7 is the next upgrade from PHP 5? I am very new to PHP and learning from a book which is PHP 5.
- philo23 10y agoYes, but more or less everything you know about PHP 5 is still true and will work just fine in PHP 7. https://wiki.php.net/rfc/php6#historical_context https://wiki.php.net/rfc/php6#historical_context http://php.net/manual/en/migration70.incompatible.php http://php.net/manual/en/migration70.incompatible.php
- oneweekwonder 10y agoTry `print false;` and see if you get the result you expect[0]. Because it differs compared to node, perl, python(Yes Yes first char uppercase) and other languages I can not think of. Also good luck with the param ordering of `array_map` compared to `array_filter` and `array_reduce`. Actually get use to the word array. Because in 2009 the PHP developers did not think array is a important data type that needs a short hand array() vs [], and all their function names `array_` shows this ugliness. I would advice rather spend your time learning python or javascript. But I acknowledge PHP became a de facto standard with MediaWiki, WordPress, Facebook, dragging the broken language into the 21st century. [0]: http://pastebin.com/raw/P6BTmceL http://pastebin.com/raw/P6BTmceL
- oneweekwonder 10y agoFor the down voters please see [Petty Issues I have with PHP!](petty); and please reply. I would really like to talk about this constructively. [petty]: https://gist.github.com/Morabaraba/3e93d7d21e16b6eb8266ee1ccbdf77f8 https://gist.github.com/Morabaraba/3e93d7d21e16b6eb8266ee1cc... ps. can you not edit your comment anymore... could you ever edit your comment?
- grzm 10y agoOnce the comment gets to a certain age (an hour?), it's no longer editable.
- sigi45 10y agoI like the performance of php 7 very much. It has/will have an impact on global warming. The only frustrating thing about it is, that there was so much potential unused for so long. Manh k/mwatts of power for nothing.
- rawoke083600 10y agoWe at www.pricecheck.co.za switched early this year. We were supersized how easy the transition was. We definitely saw a decrease in cpu usage about 20%. Also most of our php-extension(nothing exotic) was also supported already...
- libraryatnight 10y agoUnrelated question: I couldn't find any HN discussions on, what's Tumblr's future since the Verizon purchase? Yahoo let it be, it seems, has Verizon mentioned it?
- elcct 10y agoSorry for being a bit ignorant, but is there a point to use PHP 7 if you have HHVM?