com presentations: HHVM and MongoDB talk for PHP UK: hhvmmongo-phpuk16.xml slides/mongodb/api-new.xml slides/mongodb/benchmark-bson.png slides/mongodb/benchmark-bson.xml slides/mongodb/benchmark-compiling.png slides/mongodb/benchmark-lib.xml slides/mongodb/benchmark-library.png slides/mongodb/benchmark-phongo-test.png slides/mongodb/benchmark-php7-vs-hhvm.xml slides/mongodb/driver-current-status.xml slides/mongodb/engines-hhvm-deploying.xml slide
[email protected] (Derick Rethans) Thu, 18 Feb 2016 11:30:01 +0000
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: 0bc5ba3be3535fe94b750872851adaee4c22d62c Author: Derick Rethans <[email protected]> Thu, 18 Feb 2016 11:30:01 +0000 Parents: 0bbac7e4efdffce6b35a34cccb52be18651453a1 Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=0bc5ba3be3535fe94b750872851adaee4c22d62c Log: HHVM and MongoDB talk for PHP UK Changed paths: A hhvmmongo-phpuk16.xml M slides/mongodb/api-new.xml A slides/mongodb/benchmark-bson.png A slides/mongodb/benchmark-bson.xml A slides/mongodb/benchmark-compiling.png A slides/mongodb/benchmark-lib.xml A slides/mongodb/benchmark-library.png A slides/mongodb/benchmark-phongo-test.png A slides/mongodb/benchmark-php7-vs-hhvm.xml M slides/mongodb/driver-current-status.xml A slides/mongodb/engines-hhvm-deploying.xml A slides/mongodb/engines-hhvm-long1.xml A slides/mongodb/engines-hhvm-long2.xml A slides/mongodb/engines-hhvm-performance-php7.xml A slides/mongodb/engines-hhvm-performance.xml A slides/mongodb/ghost-bug.xml A slides/mongodb/ghost-fix.png A slides/mongodb/hack-lang1.xml A slides/mongodb/hack.png A slides/mongodb/hhvm-perf-php5.png A slides/mongodb/hhvm-perf-php7.png A slides/mongodb/hhvmmongo.xml M slides/mongodb/hippo-impl-def.xml A slides/mongodb/library-test-benchmark.png M slides/mongodb/me.xml M slides/mongodb/new-current-status.xml M slides/mongodb/phongo-php5-7.xml A slides/mongodb/php7-vs-hhvm.png M slides/mongodb/the-engines.xml A slides/mongodb/useless-benchmarks.xml A templates/default/small.ezt
diff_0bc5ba3be3535fe94b750872851adaee4c22d62c.txt
(text/plain, 18 KB)
diff --git a/hhvmmongo-phpuk16.xml b/hhvmmongo-phpuk16.xml new file mode 100644 index 0000000..4e5fe87 --- /dev/null +++ b/hhvmmongo-phpuk16.xml @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="utf-8"?> +<presentation css="10gen-strict.css"> +<topic>MongoDB</topic> +<title>HHVM and MongoDB — the perfect combination</title> +<event>PHP UK Confernce</event> +<location>London, UK</location> +<date>Feb 18th, 2016</date> +<speaker>Derick Rethans</speaker> +<email>[email protected]</email> +<twitter>derickr</twitter> +<url>http://derickrethans.nl/talks.html</url> +<joindin>https://joind.in/talk/057d8</joindin> +<slide>slides/mongodb/hhvmmongo.xml</slide> +<slide>slides/mongodb/me.xml</slide> +<slide>slides/mongodb/what-is-mongodb.xml</slide> +<slide>slides/mongodb/databasefield.xml</slide> + +<!-- +In this talk we will discuss using HHVM and MongoDB together. In the last +months I have written an HHVM extension for MongoDB, that mimics the API of a +similar PHP extension. On top of each extension we have a layer in PHP that +provides the more user friendly aspects of the driver. The PHP part of the +driver gets accelerated to nearly the same speed as the extension written in +C++, while being vastly easier to update and maintain. We will dive in to the +architecture of the whole setup, HHVM's JIT and extension APIs as well as some +comparisons between running your app on PHP+MongoDB and HHVM+MongoDB. +--> + +<slide>slides/mongodb/driver-current-status.xml</slide> +<slide>slides/mongodb/new-driver-goals.xml</slide> + +<!-- THE ENGINES --> +<slide>slides/mongodb/the-engines.xml</slide> + +<!-- PHP 5 --> +<slide>slides/mongodb/engines-php5.xml</slide> + +<!-- PHP 7 --> +<slide>slides/mongodb/engines-php7.xml</slide> + +<!-- HHVM + +HHVM - PERFORMANCE +- Is it actually much faster? +- YES! +- But of course it depends ! +- Without JIT, it isn’t (in CLI for example) +- JIT needs some warm up requests to find the hot paths +- The more your scripts do, the more you gain. + +- Repo Authoritive Mode + + - Preanalyse files + - PHP files assumed unchanged + - Delete cache manually + +Hack +• A statically typed language for HHVM +• Comparable with PHP: + – Interoperates with no overhead + – Same representation at runtime +• Evolved from PHP: + – If you know PHP, you know Hack! +• Designed for incremental adoption : + – Gradual typing + +HACK - TYPE HINTING +- Scalars +- bool, int, float, num, string +- Return typehints +- Typed properties +- Constructor arg promotion +- Static analyzer (hh_client/hh_server) looks for mismatches and errors without running code + +HACK - TYPE CHECKER +- hh_client / hh_server +- Only runs on linux right now, needs OCaml +- hh_client spawns hh_server +- hh_server watches file system on each save +- makes hh_client really fast +- doesn’t check with < ?php ! +- Integration for vim and emacs available, more should come + +Hack Type System + +• What must be annotated? + – Class members + – Function parameters + – Return types +• What is inferred? + – All the rest +• Annotating is an incremental process + + +Hack Types + +• Nullable : ? int , ? MyClassName +• Tuples: ( int , bool , X) +• Closures: (function( int): int) +• CollecAons: Vector< int > , Map<string, int > +• Generics: A<T> , foo<T>(T $x): T +• Constraints: foo<T as A>(T $x): T +• Type aliasing: [new]type t = ... +• Extensible records: shape(‘x’ => int) + +Hack is written in Ocaml ! + +• OCaml was a good choice: + – Ideal for symbolic computation + – Excellent performance + – Can be compiled to JS + – Interoperates well with C + +• The challenge: + – The runtime doesn’t support multicore + +HHVM - WRITING EXTENSIONS +- It’s not that hard (compared to PHP extensions anyway) +- You can write the “easy” stuff in PHP/Hack +- And switch to C++ for the harder stuff +- We wrote an extension to use New Relic with HHVM +- See blog.liip.ch/archive/2014/03/27/hhvm-and-new-relic.html for details + + +HHVM - DRAWBACKS? +- Not every library works yet (eg. Doctrine DBAL only in dev branch) +- Not really open dev model, Facebook controls it totally (and CLA needed for contribution), the far future is unknown +- Still kind of moving target +- Type Checker only really useful, when all your important classes are converted to < ?hh +- No easy way back, when you start using Hack. +- If you need exotic extensions ... +- No PHP 7 support yet +- Under PHP license, hard to separate +- Dev team is active on IRC (freenode #hhvm) +--> + + + +<slide>slides/mongodb/engines-hhvm-long1.xml</slide> +<slide>slides/mongodb/engines-hhvm-long2.xml</slide> +<slide>slides/mongodb/engines-hhvm-deploying.xml</slide> +<slide>slides/mongodb/engines-hhvm-performance.xml</slide> + +<!-- HACK --> +<slide>slides/mongodb/hack-lang1.xml</slide> + +<!-- NEW ARCHITECTURE --> + +libbson, libmongoc, Hippo, Phongo and Phplib (flip?) +Other packages on top (GridFS) +Composer + +<slide>slides/mongodb/new-architecture.xml</slide> + +- MongoDB vs Mongo extension + +<slide>slides/mongodb/phongo.xml</slide> + +<slide>slides/mongodb/hippo.xml</slide> +<slide>slides/mongodb/hippo-impl-def.xml</slide> +<slide>slides/mongodb/hippo-impl.xml</slide> +<slide>slides/mongodb/hippo-impl-2.xml</slide> +<slide>slides/mongodb/hippo-vs-phongo.xml</slide> + +<slide>slides/mongodb/api-new.xml</slide> +<slide>slides/mongodb/phplib.xml</slide> +<slide>slides/mongodb/phplib-usage-2.xml</slide> +<slide>slides/mongodb/api-new.xml</slide> + +HHVM is not mature, and certainly not documented. + +- Slow going, mention the hhvm cookbook +- issues with cursor and foreach iteration + +<slide>slides/mongodb/hhvm-maturity.xml</slide> +<slide>slides/mongodb/ghost-bug.xml</slide> + +<!-- CURRENT STATUS --> + +<slide>slides/mongodb/new-current-status.xml</slide> + +- PHP 7... + +<slide>slides/mongodb/phongo-php5-7.xml</slide> +<slide>slides/mongodb/engines-hhvm-performance-php7.xml</slide> + +<slide>slides/mongodb/useless-benchmarks.xml</slide> +<slide>slides/mongodb/benchmark-bson.xml</slide> +<slide>slides/mongodb/benchmark-lib.xml</slide> +<slide>slides/mongodb/benchmark-php7-vs-hhvm.xml</slide> + +phongo tests: +hhvm: 127 for 235; php 5.6: 51 for 260; php 7.0: 51 for 261 + +compiling: +phongo: 3.5sec (29.2), hippo: 12.8sec (2m41) + +library tests: +7.0: Time: 5.88 seconds, Memory: 12.00Mb +5.6: Time: 6.63 seconds, Memory: 18.00Mb +hhvm: Time: 8.39 seconds, Memory: 35.21Mb + + + +<slide>slides/mongodb/resources.xml</slide> + + +</presentation> diff --git a/slides/mongodb/api-new.xml b/slides/mongodb/api-new.xml index 08019b3..b8be6bc 100644 --- a/slides/mongodb/api-new.xml +++ b/slides/mongodb/api-new.xml @@ -1,5 +1,5 @@ <slide> -<title>Phongo API (mongodb.so)</title> +<title>Driver API</title> <example><![CDATA[<?php $m = new MongoDB\Driver\Manager("mongodb://localhost:27017"); diff --git a/slides/mongodb/benchmark-bson.png b/slides/mongodb/benchmark-bson.png new file mode 100644 index 0000000..ba3c91a Binary files /dev/null and b/slides/mongodb/benchmark-bson.png differ diff --git a/slides/mongodb/benchmark-bson.xml b/slides/mongodb/benchmark-bson.xml new file mode 100644 index 0000000..09ff128 --- /dev/null +++ b/slides/mongodb/benchmark-bson.xml @@ -0,0 +1,6 @@ +<slide> +<title>Benchmarks: BSON encoding</title> + +<image filename="benchmark-bson.png"/> + +</slide> diff --git a/slides/mongodb/benchmark-compiling.png b/slides/mongodb/benchmark-compiling.png new file mode 100644 index 0000000..c4d47f1 Binary files /dev/null and b/slides/mongodb/benchmark-compiling.png differ diff --git a/slides/mongodb/benchmark-lib.xml b/slides/mongodb/benchmark-lib.xml new file mode 100644 index 0000000..1d1ead3 --- /dev/null +++ b/slides/mongodb/benchmark-lib.xml @@ -0,0 +1,6 @@ +<slide> +<title>Benchmarks: with/without library</title> + +<image filename="benchmark-library.png"/> + +</slide> diff --git a/slides/mongodb/benchmark-library.png b/slides/mongodb/benchmark-library.png new file mode 100644 index 0000000..920221a Binary files /dev/null and b/slides/mongodb/benchmark-library.png differ diff --git a/slides/mongodb/benchmark-phongo-test.png b/slides/mongodb/benchmark-phongo-test.png new file mode 100644 index 0000000..ef4b338 Binary files /dev/null and b/slides/mongodb/benchmark-phongo-test.png differ diff --git a/slides/mongodb/benchmark-php7-vs-hhvm.xml b/slides/mongodb/benchmark-php7-vs-hhvm.xml new file mode 100644 index 0000000..6dd2398 --- /dev/null +++ b/slides/mongodb/benchmark-php7-vs-hhvm.xml @@ -0,0 +1,6 @@ +<slide> +<title>Benchmarks: PHP 7 vs HHVM</title> + +<image filename="php7-vs-hhvm.png"/> + +</slide> diff --git a/slides/mongodb/driver-current-status.xml b/slides/mongodb/driver-current-status.xml index 1c93c7d..5f5807d 100644 --- a/slides/mongodb/driver-current-status.xml +++ b/slides/mongodb/driver-current-status.xml @@ -1,5 +1,5 @@ <slide> -<title>MongoDB driver — current</title> +<title>"Mongo" driver</title> <list> <bullet> diff --git a/slides/mongodb/engines-hhvm-deploying.xml b/slides/mongodb/engines-hhvm-deploying.xml new file mode 100644 index 0000000..f6974a4 --- /dev/null +++ b/slides/mongodb/engines-hhvm-deploying.xml @@ -0,0 +1,15 @@ +<slide> +<title>HHVM in production</title> + +<list> + <bullet>Drop in replacement for PHP-FPM via FastCGI</bullet> + <bullet>Current version is 3.12.0 ("LTS")</bullet> + <bullet>Supports almost all standard PHP frameworks and many more extensions</bullet> + <bullet>Easy to run on 64 bit Linux Debian/Ubuntu</bullet> + <bullet>Worksish on Mac OSX</bullet> + <bullet>Good luck compiling it</bullet> +</list> + +<break lines="2"/> +<image filename="hhvm.png"/> +</slide> diff --git a/slides/mongodb/engines-hhvm-long1.xml b/slides/mongodb/engines-hhvm-long1.xml new file mode 100644 index 0000000..bdd1e6b --- /dev/null +++ b/slides/mongodb/engines-hhvm-long1.xml @@ -0,0 +1,15 @@ +<slide> +<title>HipHop for PHP</title> + +<list> + <bullet>From Facebook</bullet> + <bullet>Started out as HipHop for PHP</bullet> + <bullet>Compiles PHP to (a huge) binary via C++</bullet> + <bullet>Dynamic typing makes this difficult</bullet> + <bullet>Function parity lacking</bullet> + <bullet>Deprecated in 2013</bullet> +</list> + +<break lines="2"/> +<image filename="hhvm.png"/> +</slide> diff --git a/slides/mongodb/engines-hhvm-long2.xml b/slides/mongodb/engines-hhvm-long2.xml new file mode 100644 index 0000000..b162a4b --- /dev/null +++ b/slides/mongodb/engines-hhvm-long2.xml @@ -0,0 +1,14 @@ +<slide> +<title>HHVM</title> + +<list> + <bullet>Development started in 2010</bullet> + <bullet>A JIT engine, first to byte code, than to native code</bullet> + <bullet>Support for PHP 5.4 and newer features</bullet> + <bullet>Also supports Hack language, "Xdebug", etc...</bullet> + <bullet>Written in C++, and OCAML, and others</bullet> +</list> + +<break lines="2"/> +<image filename="hhvm.png"/> +</slide> diff --git a/slides/mongodb/engines-hhvm-performance-php7.xml b/slides/mongodb/engines-hhvm-performance-php7.xml new file mode 100644 index 0000000..6ff2888 --- /dev/null +++ b/slides/mongodb/engines-hhvm-performance-php7.xml @@ -0,0 +1,9 @@ +<slide> +<title>HHVM performance</title> + +<list> + <bullet>Is it actually much faster than PHP *7*?</bullet> +</list> + +<image filename="hhvm-perf-php7.png"/> +</slide> diff --git a/slides/mongodb/engines-hhvm-performance.xml b/slides/mongodb/engines-hhvm-performance.xml new file mode 100644 index 0000000..91c6dbb --- /dev/null +++ b/slides/mongodb/engines-hhvm-performance.xml @@ -0,0 +1,9 @@ +<slide> +<title>HHVM performance</title> + +<list> + <bullet>Is it actually much faster than PHP?</bullet> +</list> + +<image filename="hhvm-perf-php5.png"/> +</slide> diff --git a/slides/mongodb/ghost-bug.xml b/slides/mongodb/ghost-bug.xml new file mode 100644 index 0000000..48ad1f0 --- /dev/null +++ b/slides/mongodb/ghost-bug.xml @@ -0,0 +1,11 @@ +<slide> +<title>The Ghost Bug</title> + +<div effect="fade-out"> +<image filename="ghost.png"/> +</div> + +<div effect="fade-in"> +<image filename="ghost-fix.png"/> +</div> +</slide> diff --git a/slides/mongodb/ghost-fix.png b/slides/mongodb/ghost-fix.png new file mode 100644 index 0000000..ccbfebb Binary files /dev/null and b/slides/mongodb/ghost-fix.png differ diff --git a/slides/mongodb/hack-lang1.xml b/slides/mongodb/hack-lang1.xml new file mode 100644 index 0000000..44004fd --- /dev/null +++ b/slides/mongodb/hack-lang1.xml @@ -0,0 +1,14 @@ +<slide> +<title>Introducing Hack</title> + +<list> + <bullet>A statically typed language for HHVM</bullet> + <bullet>Type Hinting</bullet> + <bullet>Static anaylyser (hh_client/hh_server)</bullet> + <bullet>Comparable with PHP, Evolved from PHP</bullet> + <bullet>Impossible to Google</bullet> + <bullet>Integrates with extension writing</bullet> +</list> + +<image filename="hack.png"/> +</slide> diff --git a/slides/mongodb/hack.png b/slides/mongodb/hack.png new file mode 100644 index 0000000..c42c9ee Binary files /dev/null and b/slides/mongodb/hack.png differ diff --git a/slides/mongodb/hhvm-perf-php5.png b/slides/mongodb/hhvm-perf-php5.png new file mode 100644 index 0000000..9c0d87f Binary files /dev/null and b/slides/mongodb/hhvm-perf-php5.png differ diff --git a/slides/mongodb/hhvm-perf-php7.png b/slides/mongodb/hhvm-perf-php7.png new file mode 100644 index 0000000..17677d1 Binary files /dev/null and b/slides/mongodb/hhvm-perf-php7.png differ diff --git a/slides/mongodb/hhvmmongo.xml b/slides/mongodb/hhvmmongo.xml new file mode 100644 index 0000000..23e02c6 --- /dev/null +++ b/slides/mongodb/hhvmmongo.xml @@ -0,0 +1,8 @@ +<slide type="title"> +<break lines="2"/> +<blurb class="event-title">HHVM & MongoDB,<br/><small>the perfect combination</small></blurb> +<break lines="1"/> +<blurb class="event-presenter">:-:speaker:-:</blurb> +<blurb class="pres-url-small">:-:email:-:—@:-:twitter:-:</blurb> +<blurb class="pres-url-small">:-:joindin:-:</blurb> +</slide> diff --git a/slides/mongodb/hippo-impl-def.xml b/slides/mongodb/hippo-impl-def.xml index c86bd7f..31568cd 100644 --- a/slides/mongodb/hippo-impl-def.xml +++ b/slides/mongodb/hippo-impl-def.xml @@ -4,6 +4,9 @@ <blurb>%ext_mongo.php% (extract)</blurb> <example><![CDATA[<?hh namespace MongoDB\Driver; + +<<__NativeData("MongoDBDriverManager")>> +class Manager { <<__Native>> public function __construct(string $dsn = "localhost", array $options = array(), array $driverOptions = array()); diff --git a/slides/mongodb/library-test-benchmark.png b/slides/mongodb/library-test-benchmark.png new file mode 100644 index 0000000..a6fd8ab Binary files /dev/null and b/slides/mongodb/library-test-benchmark.png differ diff --git a/slides/mongodb/me.xml b/slides/mongodb/me.xml index 7d61a8b..50941a1 100644 --- a/slides/mongodb/me.xml +++ b/slides/mongodb/me.xml @@ -6,9 +6,9 @@ <blurb>Derick Rethans</blurb> <list> - <bullet>I'm Dutch/British living in London</bullet> - <bullet>One of the PHP/HHVM MongoDB driver maintainers</bullet> - <bullet>Author of the PHP debugger tool Xdebug, PHP's Date/Time/Timezone support, and a bunch of other PHP extensions</bullet> + <bullet>I'm *Dutch/British* living in London</bullet> + <bullet>One of the PHP/HHVM *MongoDB* driver maintainers</bullet> + <bullet>Author of the PHP debugger tool *Xdebug*, PHP's Date/Time/Timezone support, and a bunch of other PHP extensions</bullet> <bullet>I ♥🌍 maps </bullet> <bullet>I ♥🍺 beer </bullet> </list> diff --git a/slides/mongodb/new-current-status.xml b/slides/mongodb/new-current-status.xml index 7cf60d7..2f5c830 100644 --- a/slides/mongodb/new-current-status.xml +++ b/slides/mongodb/new-current-status.xml @@ -2,8 +2,8 @@ <title>Current status</title> <list> - <bullet>phongo has been released as 1.1.0<br/>%pecl install mongodb%</bullet> - <bullet>hippo has a release candidate<br/>%https://github.com/mongodb-labs/mongo-hhvm-driver-prototype/releases/tag/1.1.0RC1%</bullet> + <bullet>phongo has been released as 1.1.3<br/>%pecl install mongodb%</bullet> + <bullet>hippo has been released as 1.1.0<br/>%https://github.com/mongodb-labs/mongo-hhvm-driver-prototype/releases/tag/1.1.0%</bullet> <bullet>phplib has been released as 1.0.0<br/>%https://packagist.org/packages/mongodb/mongodb%</bullet> </list> diff --git a/slides/mongodb/phongo-php5-7.xml b/slides/mongodb/phongo-php5-7.xml index 0216db6..4a16390 100644 --- a/slides/mongodb/phongo-php5-7.xml +++ b/slides/mongodb/phongo-php5-7.xml @@ -8,6 +8,6 @@ <bullet>Order of elements in structs</bullet> <bullet>%char *% vs. %zend_string%</bullet> <bullet>zend_hash changes</bullet> - <bullet>Not coming out until: after 1.0 for hippo and phongo; PHP 7 is actually released; throrough review</bullet> + <bullet>We released support in 1.1.1, after PHP 7 came out, just before Christmas</bullet> </list> </slide> diff --git a/slides/mongodb/php7-vs-hhvm.png b/slides/mongodb/php7-vs-hhvm.png new file mode 100644 index 0000000..dbaf361 Binary files /dev/null and b/slides/mongodb/php7-vs-hhvm.png differ diff --git a/slides/mongodb/the-engines.xml b/slides/mongodb/the-engines.xml index 7b41a3e..4f0e67d 100644 --- a/slides/mongodb/the-engines.xml +++ b/slides/mongodb/the-engines.xml @@ -20,7 +20,7 @@ <tr> <td><div effect="fade-in"><blurb>PHP ---5.3--- 5.4 and higher</blurb></div></td> <td><div effect="fade-in"><blurb>HHVM 3.9 and higher</blurb></div></td> - <td><div effect="fade-in"><blurb>It's not out yet (Nov 12?)</blurb></div></td> + <td><div effect="fade-in"><blurb>It's new!</blurb></div></td> </tr> </table> </slide> diff --git a/slides/mongodb/useless-benchmarks.xml b/slides/mongodb/useless-benchmarks.xml new file mode 100644 index 0000000..181d1db --- /dev/null +++ b/slides/mongodb/useless-benchmarks.xml @@ -0,0 +1,11 @@ +<slide> +<title>Benchmarks</title> + +<table> +<tr> +<td><image filename="library-test-benchmark.png"/></td> +<td><image filename="benchmark-phongo-test.png"/></td> +<td><image filename="benchmark-compiling.png"/></td> +</tr> +</table> +</slide> diff --git a/templates/default/small.ezt b/templates/default/small.ezt new file mode 100644 index 0000000..7b7e9af --- /dev/null +++ b/templates/default/small.ezt @@ -0,0 +1,4 @@ +{use $node} +{foreach $node->childNodes as $child} +<small>{$child->nodeValue}</small> +{/foreach}