Slide 1

Slide 1 text

Tom Walder | @tom_walder Google App Engine - a PHP PaaS from Prototyping to Production

Slide 2

Slide 2 text

Tom Walder CTO at Docnet+Venditan in Manchester, UK PHP, E-commerce (a developer at heart) Open source, App Engine @tom_walder docnet.nu | venditan.com Compulsory (old) Holiday Photo

Slide 3

Slide 3 text

I am going to talk about… • What I have learned using Google App Engine from Prototyping to Production • What is a PaaS, Google App Engine? • Who uses it, where is the value? • Feature overview • Some key features in more detail • Challenges, pit falls • Scaling & performance • Live scaling demo* • What’s next for App Engine?

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

A full stack application What might a traditional full stack application look like?

Slide 6

Slide 6 text

A full stack application Application server (PHP) Database server (MySQL) Load Balancers Memcached Server/Daemon Your Code Deploy tool (e.g. Capistrano) Provision (e.g. Puppet) Hardware (or VMs) Apache/nginx Security, users, patching Firewall logrotate Monitoring Centralised logging crontab Queue system (Rabbit?) Search (Elastic/Solr/etc.)

Slide 7

Slide 7 text

A PaaS application? Your Code

Slide 8

Slide 8 text

With a PaaS… • You write code, deploy applications • Without researching, selecting, provisioning, maintaining, supporting or updating the infrastructure • You have to work with some (pretty acceptable) limitations

Slide 9

Slide 9 text

App Engine - PaaS by Google • Around since 2008 • Your Code runs in containers • Google servers, data centres (EU/US) • PHP, Python, Java, Go (Standard runtimes)

Slide 10

Slide 10 text

App Engine - PaaS by Google • Worthwhile FREE tier • Documentation • Support (community & paid) • PAYG above free tier • SLA

Slide 11

Slide 11 text

Big Names • Sony Music • Best Buy • Snapchat • Rovio (Angry Birds) • Khan Academy https://cloud.google.com/customers/

Slide 12

Slide 12 text

Where’s the value? “If we didn't have App Engine, we'd be spending a lot more time figuring out server setup and working on routers” Khan Academy “Developing apps on App Engine takes one-fourth to one-tenth of the resources and one-fourth of the time compared to building something ourselves” Best Buy “App Engine allows us to launch games very quickly with teams of one or two developers. Because Google manages all the servers, there is little required of us in terms of maintenance” Rovio “It's hard to imagine that this app would have been possible, so quickly, working with anything except App Engine” Sony

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

What is Google App Engine? • Hosting Platform (in Google’s cloud) • Removes (DevOps) headaches • Makes scaling trivial • Prototype/alpha/beta/production • Helps you develop applications faster

Slide 15

Slide 15 text

Some of what you get • Memcache • Cron jobs • Task queues • Load balancing • Auto-scaling • Versions • Traffic splitting • Services (was modules) • HTTP/2 • 28 instance hours FREE • Cloud console • IAM

Slide 16

Slide 16 text

Memcache $memcache = new Memcache; return $memcache->get(‘key’); • No connection details needed (IP/port) • Magic RPC (Protocol Buffers) • make_call()

Slide 17

Slide 17 text

Cron jobs cron: - description: summary job url: /tasks/summary schedule: every 5 minutes • cron.yaml • HTTP GET

Slide 18

Slide 18 text

Task queues (new PushTask( ‘/some/worker', ['payload' => ‘data'] ))->add(); • Magic RPC (Protocol Buffers) • HTTP POST • Named Queues, Delays, Processing Rates

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Cloud Console

Slide 21

Slide 21 text

More of what you get • Geo location headers • Centralised logging • Inbound email (POST) • Traces • Local development SDK • Custom domains • SNI SSL • User authentication • GCS stream handler • Free private git • Security Scanner • Decent documentation

Slide 22

Slide 22 text

Geo headers

Slide 23

Slide 23 text

Traces

Slide 24

Slide 24 text

Traces

Slide 25

Slide 25 text

User authentication - url: .*
 script: main.php
 login: required
 secure: always • Any Google Account (or Admin only) • $_SERVER

Slide 26

Slide 26 text

And more… • Datastore (NoSQL) https://github.com/tomwalder/php-gds • Full text search https://github.com/tomwalder/php-appengine-search

Slide 27

Slide 27 text

Challenges • Read-only file system • PHP 5.5 (Standard Runtime) • MySQL costs money • PHP extensions limited • Gone in 60 seconds

Slide 28

Slide 28 text

Scaling & Performance Options • Instance types - RAM, CPU • Idle instances • Scaling configurations • Auto, Basic, Manual • Rules, latencies etc.

Slide 29

Slide 29 text

Scaling Demo application: conf-demo
 version: alpha1
 runtime: php55
 api_version: 1
 threadsafe: yes
 
 handlers:
 
 - url: .*
 script: main.php app.yaml /request.json‘, false, stream_context_create([ 'http' => [
 'method' => 'PUT',
 'header' => 'Content-type: application/json',
 'content' => json_encode($_SERVER)
 ]]) ); main.php

Slide 30

Slide 30 text

Live Demo*

Slide 31

Slide 31 text

Pit falls Avoid vendor lock-in Inject your dependencies

Slide 32

Slide 32 text

Summary

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

What’s next for App Engine? • Flexible Runtimes • in BETA • Runs Docker images • So ANYTHING you want • Including PHP 7

Slide 35

Slide 35 text

Questions?

Slide 36

Slide 36 text

Google App Engine - a PHP PaaS from Prototyping to Production • Feedback IPC app or https://joind.in/talk/ce88a • Projects https://github.com/tomwalder • Twitter @tom_walder • Email [email protected] • Thanks to IPC for having me and to Docnet/Venditan for letting me out! • Slides here: *RECURSION*