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

Google App Engine - a PHP PaaS from Prototyping...

Google App Engine - a PHP PaaS from Prototyping to Production

App Engine is a container-based, auto-scaling hosting environment (PaaS really), running PHP.

It let’s you get off the ground quickly, for FREE - then grow to a much, much larger scale with little or no effort.

It went “Generally Available” in 2015, so has both free and commercial support from Google.

I'll talk about Scaling and Performance options for your application. What’s free and what’s not, Data storage, Databases, Background processing, Task queues, Crons, Memcache, Full text search, communication in & out of App Engine, Community & Commercial support and Deployments. Maybe a bit on modules and how to use the Google-provided SDK to build and develop locally.

I’ll try and point out some of the pitfalls too.

You should leave the talk knowing if App Engine is likely to help you save time and money or add something useful to your already bulging toolkit!

Tom Walder

June 01, 2016
Tweet

More Decks by Tom Walder

Other Decks in Technology

Transcript

  1. Tom Walder | @tom_walder Google App Engine - a PHP

    PaaS from Prototyping to Production
  2. 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
  3. 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?
  4. 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.)
  5. 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
  6. 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)
  7. App Engine - PaaS by Google • Worthwhile FREE tier

    • Documentation • Support (community & paid) • PAYG above free tier • SLA
  8. Big Names • Sony Music • Best Buy • Snapchat

    • Rovio (Angry Birds) • Khan Academy https://cloud.google.com/customers/
  9. 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
  10. 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
  11. 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
  12. Memcache $memcache = new Memcache; return $memcache->get(‘key’); • No connection

    details needed (IP/port) • Magic RPC (Protocol Buffers) • make_call()
  13. Task queues (new PushTask( ‘/some/worker', ['payload' => ‘data'] ))->add(); •

    Magic RPC (Protocol Buffers) • HTTP POST • Named Queues, Delays, Processing Rates
  14. 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
  15. User authentication - url: .*
 script: main.php
 login: required
 secure:

    always • Any Google Account (or Admin only) • $_SERVER
  16. Challenges • Read-only file system • PHP 5.5 (Standard Runtime)

    • MySQL costs money • PHP extensions limited • Gone in 60 seconds
  17. Scaling & Performance Options • Instance types - RAM, CPU

    • Idle instances • Scaling configurations • Auto, Basic, Manual • Rules, latencies etc.
  18. Scaling Demo application: conf-demo
 version: alpha1
 runtime: php55
 api_version: 1


    threadsafe: yes
 
 handlers:
 
 - url: .*
 script: main.php app.yaml <?php file_get_contents( ‘https://firebase../<instance-id>/request.json‘, false, stream_context_create([ 'http' => [
 'method' => 'PUT',
 'header' => 'Content-type: application/json',
 'content' => json_encode($_SERVER)
 ]]) ); main.php
  19. What’s next for App Engine? • Flexible Runtimes • in

    BETA • Runs Docker images • So ANYTHING you want • Including PHP 7
  20. 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*