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.

37169c5c58e9add105cda1c63584b9f3?s=128

Jason Cosper

June 06, 2015
Tweet

Transcript

  1. Duty Now for the Future

  2. In the past this information has been suppressed but now

    it can be told
  3. We're all Devo

  4. We're all Devs

  5. Let's look to the future

  6. The futch

  7. PHP 7

  8. PHP 7 Beta June 2015

  9. PHP 7 Release November 2015 (Probably)

  10. There's a PHP 7 Vagrant

  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
  12. Caveat

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

  14. Let's look at PHP 5 adoption

  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.
  16. Let that sink in...

  17. 71.5% of all PHP sites are powered by versions that

    will be dead by the end of Summer 2015
  18. Legacy PHP bad

  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.
  20. PHP 5.5 will be End of Life'd by this time

    next year
  21. How long will it be until enough hosts support PHP

    7?
  22. How long can we wait?

  23. There is another

  24. HHVM

  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.
  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
  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.
  28. But don't let that scare you There are large companies

    already using HHVM in production • Facebook • Wikipedia • Etsy • Box
  29. HHVM-ready Hosts • WP Engine • DreamHost • Pagely •

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

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

  32. Built by WP Engine for our Mercury platform

  33. No matter where you host your site, you can use

    HGV to test your code
  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
  35. Installing HGV is easyish

  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
  37. Install git clone --recursive https://github.com/wpengine/hgv.git cd hgv vagrant up

  38. While HGV installs, make yourself a drink It should only

    take about 30 minutes
  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/
  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
  41. So we've got that goin' for us, which is nice

  42. Questions?

  43. It's time to go beyond the normal thing. It's time

    to do the super thing. Follow @boogah on Twitter.