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. 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
  2. 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.
  3. 71.5% of all PHP sites are powered by versions that

    will be dead by the end of Summer 2015
  4. 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.
  5. 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.
  6. 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
  7. 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.
  8. But don't let that scare you There are large companies

    already using HHVM in production • Facebook • Wikipedia • Etsy • Box
  9. 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
  10. 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
  11. 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/
  12. 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
  13. It's time to go beyond the normal thing. It's time

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