Duty Now for the Future

43
Duty Now for the Future

Transcript of Duty Now for the Future

Page 1: Duty Now for the Future

Duty Now for the Future

Page 2: Duty Now for the Future

In the past this information has been suppressed

but now it can be told

Page 3: Duty Now for the Future

We're all Devo

Page 4: Duty Now for the Future

We're all Devs

Page 5: Duty Now for the Future

Let's look to the future

Page 6: Duty Now for the Future

The futch

Page 7: Duty Now for the Future

PHP 7

Page 8: Duty Now for the Future

PHP 7 BetaJune 2015

Page 9: Duty Now for the Future

PHP 7 ReleaseNovember 2015

(Probably)

Page 10: Duty Now for the Future

There's a PHP 7 Vagrant

Page 11: Duty Now for the Future

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

Page 12: Duty Now for the Future

Caveat

Page 13: Duty Now for the Future

PHP version adoption stinks(Especially at the host level)

Page 14: Duty Now for the Future

Let's look at PHP 5 adoption

Page 15: Duty Now for the Future

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.

Page 16: Duty Now for the Future

Let that sink in...

Page 17: Duty Now for the Future

71.5% of all PHP sitesare powered by versions

that will be deadby the end of Summer 2015

Page 18: Duty Now for the Future

Legacy PHP bad

Page 19: Duty Now for the Future

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.

Page 20: Duty Now for the Future

PHP 5.5 will be

End of Life'dby this time next year

Page 21: Duty Now for the Future

How long will it beuntil enough hosts support PHP 7?

Page 22: Duty Now for the Future

How long can we wait?

Page 23: Duty Now for the Future

There is another

Page 24: Duty Now for the Future

HHVM

Page 25: Duty Now for the Future

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.

Page 26: Duty Now for the Future

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

Page 27: Duty Now for the Future

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.

Page 28: Duty Now for the Future

But don't let that scare you

There are large companies already using HHVM in production

• Facebook

• Wikipedia

• Etsy

• Box

Page 29: Duty Now for the Future

HHVM-ready Hosts• WP Engine

• DreamHost

• Pagely

• SiteGround

• Kinsta

Page 30: Duty Now for the Future

There's an HHVM VagrantAnd it's made for WordPress development

Page 31: Duty Now for the Future

HGVhttps://github.com/wpengine/hgv

Page 32: Duty Now for the Future

Built by WP Enginefor our Mercury platform

Page 33: Duty Now for the Future

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

Page 34: Duty Now for the Future

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

Page 35: Duty Now for the Future

Installing HGV is easyish

Page 36: Duty Now for the Future

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 gitbrew install caskroom/cask/brew-caskbrew cask install vagrantbrew cask install virtualboxvagrant plugin install vagrant-hostsupdater

Page 37: Duty Now for the Future

Installgit clone --recursive https://github.com/wpengine/hgv.gitcd hgvvagrant up

Page 38: Duty Now for the Future

While HGV installs, make yourself a drinkIt should only take about 30 minutes

Page 39: Duty Now for the Future

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/

Page 40: Duty Now for the Future

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

Page 41: Duty Now for the Future

So we've got that goin' for us,

which is nice

Page 42: Duty Now for the Future

Questions?

Page 43: Duty Now for the Future

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