Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Duty Now for the Future

Duty Now for the Future

WordPress developers have been refining their development workflows and toolkits for 12 years now. As game changing server technologies like Facebook's HHVM start to creep into the WordPress hosting space — WP Engine, Pagely & Kinsta all offer HHVM-ready plans — those workflows need to be expanded.

I'll be introducing you to a new Vagrant-based WordPress development environment (HGV) that includes debugging and profiling tools and allows you to test your code in both PHP & HHVM environments.

In order to follow along, a passing familiarity with the command line helps, but isn't a hard requirement.

Jason Cosper

June 06, 2015
Tweet

More Decks by Jason Cosper

Other Decks in Technology

Transcript

  1. Duty Now for the Future

    View Slide

  2. In the past this information has been suppressed
    but now it can be told

    View Slide

  3. We're all Devo

    View Slide

  4. We're all Devs

    View Slide

  5. Let's look to the future

    View Slide

  6. The futch

    View Slide

  7. PHP 7

    View Slide

  8. PHP 7 Beta
    June 2015

    View Slide

  9. PHP 7 Release
    November 2015
    (Probably)

    View Slide

  10. There's a PHP 7 Vagrant

    View Slide

  11. Vagrant is a tool for building
    complete development
    environments. With an easy-to-use
    workflow and focus on automation,
    Vagrant lowers development
    environment setup time, increases
    development/production parity,
    and makes the "works on my
    machine" excuse a relic of the past.
    — About Vagrant

    View Slide

  12. Caveat

    View Slide

  13. PHP version adoption stinks
    (Especially at the host level)

    View Slide

  14. Let's look at PHP 5 adoption

    View Slide

  15. The Majority 1
    • PHP 5.3 — 41.4%
    • Release Date: June 30, 2009
    • End of Life: August 14, 2014
    • PHP 5.4 — 30.1%
    • Release Date: March 1, 2012
    • End of Life: September 12, 2015
    1 Numbers from w3Techs as of June 2, 2015.

    View Slide

  16. Let that sink in...

    View Slide

  17. 71.5% of all PHP sites
    are powered by versions
    that will be dead
    by the end of Summer 2015

    View Slide

  18. Legacy PHP bad

    View Slide

  19. The Minority 1
    • PHP 5.5 — 9.3%
    • Release date: June 20, 2013
    • End of Life: June 20, 2016
    • PHP 5.6 — 1.5%
    • Release Date: August 28, 2014
    • End of Life: August 28, 2017
    1 Numbers from w3Techs as of June 2, 2015.

    View Slide

  20. PHP 5.5 will be
    End of Life'd
    by this time next year

    View Slide

  21. How long will it be
    until enough hosts support PHP 7?

    View Slide

  22. How long can we wait?

    View Slide

  23. There is another

    View Slide

  24. HHVM

    View Slide

  25. How is HHVM better?
    HHVM compiles PHP to an intermediate bytecode. The
    bytecode then gets translated to machine code by a just-in-
    time (JIT) compiler. Doing this removes the usual interpreted
    execution bottlenecks that come with using native PHP.
    On top of that, HHVM analyzes your code as it
    runs. After it collects enough data, HHVM
    performs optimizations on what it considers to be
    frequently invoked and expensive pieces of code.
    TL;DR: It's fast. And smart.

    View Slide

  26. But how much faster?
    WordPress 4.1.x with 20 concurrent users.
    • Requests per second
    • PHP 5.5: 256
    • PHP 7: 627
    • HHVM 3.7: 666
    • Latency
    • PHP 5.5: 78 milliseconds
    • PHP 7: 32 milliseconds
    • HHVM 3.7: 30 milliseconds

    View Slide

  27. So what's the catch?
    • The HHVM compiler is strict.
    • If you're using poorly written code, things
    can go sideways. Fast.
    • The occasional memory leak.
    • Long running PHP processes can chew up
    tons of RAM.
    • Scheduled restarts of HHVM processes are
    not uncommon.

    View Slide

  28. But don't let that scare you
    There are large companies already using HHVM
    in production
    • Facebook
    • Wikipedia
    • Etsy
    • Box

    View Slide

  29. HHVM-ready Hosts
    • WP Engine
    • DreamHost
    • Pagely
    • SiteGround
    • Kinsta

    View Slide

  30. There's an HHVM Vagrant
    And it's made for WordPress development

    View Slide

  31. HGV
    https://github.com/wpengine/hgv

    View Slide

  32. Built by WP Engine
    for our Mercury platform

    View Slide

  33. No matter where you host your site,
    you can use HGV to test your code

    View Slide

  34. HGV
    • Built with members of the 10up team
    • Work on your code under PHP 5.5 & HHVM at the same time
    • Debugging & benchmarking tools
    • Xdebug
    • XHProf
    • Siege
    • query-monitor
    • debug-objects
    • debug-bar

    View Slide

  35. Installing HGV is easyish

    View Slide

  36. Prerequisites
    • Git
    • VirtualBox or VMware
    • Vagrant
    • The Vagrant::Hostsupdater plugin
    https://goo.gl/KpA928
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew install git
    brew install caskroom/cask/brew-cask
    brew cask install vagrant
    brew cask install virtualbox
    vagrant plugin install vagrant-hostsupdater

    View Slide

  37. Install
    git clone --recursive https://github.com/wpengine/hgv.git
    cd hgv
    vagrant up

    View Slide

  38. While HGV installs, make yourself a drink
    It should only take about 30 minutes

    View Slide

  39. Get to work
    • Local file access
    • Use your favorite text editor!
    • [HGV_dir]/hgv_data/sites/[hhvm|php]/
    • [HGV_dir]/hgv_data/sites/[hhvm|php]/wp-content/
    [plugins|themes]/
    • SSH
    • vagrant ssh
    • phpMyAdmin
    • admin.hgv.dev/phpmyadmin/

    View Slide

  40. Coming Soon in HGV 1.3
    • One Vagrant to rule them all
    • Configure multiple installs & domains
    • Adds the domains to your hosts file
    • Provisioned via a YML file
    ---
    enviro: trunk
    hhvm_domains:
    - hhvm.trunk.hgv.dev
    php_domains:
    - trunk.hgv.dev

    View Slide

  41. So we've got that goin' for us,
    which is nice

    View Slide

  42. Questions?

    View Slide

  43. It's time to go beyond the normal thing.
    It's time to do the super thing.
    Follow @boogah on Twitter.

    View Slide