past to present -...

27
Google's serverless journey: past to present Wesley Chun (@wescpy) Sr. Developer Advocate, Google Spring 2019 About the speaker Mission Enable current and future developers and their technical management everywhere to be successful using Google Cloud and other Google developer tools & APIs. Previous experience / background Soſtware engineer & architect for 20+ years One of the original Yahoo!Mail engineers Author of bestselling "Core Python" books (corepython.com) Technical trainer, teacher, instructor, adjunct CS faculty Fellow of the Python Soſtware Foundation G Suite Dev Show goo.gl/JpBQ40

Upload: others

Post on 25-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Google's serverless journey:past to present

Wesley Chun (@wescpy)Sr. Developer Advocate, GoogleSpring 2019

About the speaker

Mission

● Enable current and future developers and their technical management everywhere to be successful using Google Cloud and other Google developer tools & APIs.

Previous experience / background

● Software engineer & architect for 20+ years● One of the original Yahoo!Mail engineers● Author of bestselling "Core Python" books (corepython.com)● Technical trainer, teacher, instructor, adjunct CS faculty● Fellow of the Python Software Foundation

G Suite Dev Showgoo.gl/JpBQ40

Agenda & takeaways

● Introduction● Platforms● Inspiration● Summary

● What● How● Why● When

01IntroductionWhy are you here?

Serverless computing means opinionated logic-hosting containers in

the cloud.

Serverless: the what● Misnomer● "No worries"● According to Forbes*:

○ Developers focus on writing code & solving business problems without having to worry about infrastructure.

○ Servers (physical & virtual) completely abstracted away from the user.

* source: Forbes (May 2018)

Serverless: the why

● Fastest growing segment of cloud*

● $1.9B (2016) and $4.25B (2018) ⇒ $7.7B (2021) and $14.93B (2023)

● What if you go viral?● What if you don't?

* in USD; source: Research and Markets (Feb 2017) & (Aug 2018)

Broad ecosystem

Compute

Data Analytics ML & AI

Database & Storage

Smart assistants &

chat

DevOps

Messaging

G Suite APIs

02PlatformsGCP + G Suite

Google App EngineApp-hosting in the cloud

Why does App Engine exist?

App Engine to the rescue!!

● Focus on app not DevOps● Enhance productivity● Deploy globally● Fully-managed● Auto-scaling● Pay-per-use● Familiar standard runtimes

Hello World (3 files: Python "MVP")app.yaml

runtime: python37

main.py

from flask import Flaskapp = Flask(__name__)

@app.route('/')def hello(): return 'Hello World!'

requirements.txt

Flask==1.0.2

Deploy:$ gcloud app deploy

Access globally:https://PROJECT_ID.appspot.com

Popular App Engine use-cases

● Mobile/tablet○ App backends○ Cloud persistence

● Social/gaming○ Speed, scale○ API integrations○ Personals/dating

● Consumer web apps○ Unpredictable traffic○ Scale (up or down)

● Business apps○ Enterprise○ Java & PHP runtimes○ Web or mobile

Google Cloud FunctionsFunction-hosting in the cloud

Why does Cloud Functions exist?● Don't have full app

○ No framework "overhead" (LAMP, MEAN...)○ Microservices

● Event-driven○ Triggered via HTTP or background events○ Auto-scaling & highly-available○ Pay per use

● Familiar development environment○ Cmd-line or developer console

● Cloud Functions for Firebase

main.py

def hello_world(request):

return 'Hello World!'

Deploy:$ gcloud functions deploy hello --runtime python37 --trigger-http

Access globally:https://GCP_REGION-PROJECT_ID.cloudfunctions.net/hello

Hello World (Python "MVP")

Google Apps ScriptCustomized JS runtime for automation, extension, and integration with G Suite and other Google or external services

Sheets-bound “Hello World!”

Apps Script introgoo.gl/1sXeuD

Sheets-bound “Hello World!”

What can you do with this?

Accessing maps from spreadsheets?!?goo.gl/oAzBN9

This… with help from Google Maps & Gmailfunction sendMap() { var sheet = SpreadsheetApp.getActiveSheet(); var address = sheet.getRange("A2").getValue(); var map = Maps.newStaticMap().addMarker(address); GmailApp.sendEmail('[email protected]', 'Map', 'See below.', {attachments:[map]});}

JS

Google App MakerLow-code assistive development for custom business apps

Got app licenses for sales, marketing & operations?

BUT...

Who builds my app? If no resources, how do I do it myself?

Custom business apps: still no easy solutions

Who will pay for it?

What platform should I use?

Where do I host my data?

Is my app compliant?

Who has access to my app?

● Low-code assistive development environment; Cloud SQL default

● Go from idea to app in minutes ● Drag-n-drop app building● Many pre-made template apps● Generates Apps Script code● Requires at least G Suite Business

Google App Maker

Operational / Process

Employee directory

Room scheduling

Budget tracking

Project & task tracking

Meeting planning

Security dashboard

Travel approvals

Line of Business (LOB)

Lender limits

Inventory management

Content management

Legal contracts

Student progress

Custom apps across use-cases

Google Cloud RunContainer-hosting in the cloud

The rise of containers ● Any language

● Any library

● Any binary

● Ecosystem of base images

● Industry standard

“We can’t be locked in.”

“How can we use existing binaries?”

“Why do I have to choose between containers and serverless?”

“Can you support language _______ ?”

Serverless not accessible to everyone...

● Fully-managed serverless "CaaS"○ Flexibility and portability of containers, but

with the convenience of serverless○ You app, your bundled container○ Auto-scale, -provision, -config○ Pay-per-use

● Anti-vendor lock-in, portable to:○ Google-managed Kubernetes cluster (GKE)○ Or your self-managed Kubernetes cluster

Google Cloud Run to the rescue!

Code, build, deploy.js .rb .go

.sh.py ...

● Any language, library, binary

○ HTTP port, stateless

● Bundle into container

○ Build w/Docker or

○ Google Cloud Build

○ From Container Registry...

● Deploy to Cloud Run

StateHTTP

https://yourservice.run.app

03InspirationSample apps & case studies

Custom intelligence in GmailAnalyze G Suite data with GCP

Gmail message processing with GCP

Gmail

CloudPub/Sub

Cloud Functions

Cloud Vision

G Suite GCP

Star message

Message notification

Trigger function

Extract images

Categorize images

Inbox augmented with Cloud Function

Big data analysis to slide presentationAccess GCP tools from G Suite

Store big data results

Visualize big data results

Ingest data from Sheets

Link to chart in Sheets

Supercharge G Suite with GCP

G Suite GCP

BigQuery

Apps Script

Slides Sheets

Application request

Big data analytics

04What's Next?

Summary● Google knows serverless

○ Over a decade of experience○ Been doing it before term existed○ Variety of products serving different business needs

● Inspiration○ Big data-to-slide deck: bit.ly/2OcptaG○ Gmail intelligence: cloud.google.com/blog/products/application-

development/adding-custom-intelligence-to-gmail-with-serverless-on-gcp

● Products○ 2008: cloud.google.com/appengine○ 2009: developers.google.com/apps-script○ 2016: cloud.google.com/functions○ 2016: gsuite.google.com/appmaker○ 2019: cloud.google.com/run

Thank you!

Wesley Chun@wescpy

Progress bars: goo.gl/69EJVw