Serverless on Google Cloud Platform

Ccf846b231e34dfef7774f6171a9891a?s=47 SokoP Urasoko
November 03, 2017
1.3k

Serverless on Google Cloud Platform

Serverlessconf Tokyo 2017

Ccf846b231e34dfef7774f6171a9891a?s=128

SokoP Urasoko

November 03, 2017
Tweet

Transcript

  1. Serverless on Google Cloud Platform Google Cloud Platform で実現する Serverless

    の今 Serverlessconf Tokyo 2017 Hiroyuki “SokoP” Urasoko Customer Engineer, Google Cloud
  2. Confidential & Proprietary Agenda • Serverless Architecture on Google Cloud

    Platform • Serverless Data Analysis on Google Cloud Platform • Serverless Machine Learning on Google Cloud Platform ◦ 今一度 Google Cloud Platform における Serverless を考えてみます • Serverless with Site Reliability Engineering ◦ 半ば強引にSREと紐付けてみます
  3. Confidential & Proprietary About Me 浦底 “そこぴー” 博幸 Hiroyuki “SokoP”

    Urasoko sokop@google.com twitter:@urasoko facebook:h.urasoko • History ◦ Sales @ Partner of a Cloud Provider ◦ Evangelist @ Cloud Integrator ▪ SoftLayer ▪ Chef ◦ System Engineer of Java ◦ Selling, Cashier @ GAP • Hobby ◦ Jog freak ◦ Snowboarding ◦ Skateboarding
  4. Confidential & Proprietary All opinions[] = My(own);

  5. Confidential & Proprietary Serverless Architecture on Google Cloud Platform •

    Good presentation from Google Cloud Next Tokyo ‘17 ◦ Google Cloud Platform で実現する! サーバーレス・コンピューティング ▪ https://youtu.be/N1tg5gENNuI • About 30min. • Today’s session is all.
  6. Confidential & Proprietary code();

  7. Confidential & Proprietary Serverless Architecture on Google Cloud Platform 2013

    2008 2010 BigQuery App Engine Cloud Storage Cloud Datastore 2015 2016 2017 Cloud Functions Cloud Machine Learning Engine 2014 Cloud Dataflow Cloud Pub/Sub Firebase Firestore https://cloud.google.com/serverless/ https://cloud.google.com/serverless/whitepaper/
  8. Confidential & Proprietary Serverless at App Engine • No need

    to even think about servers ◦ サーバー管理不要 • No upfront provisioning; scales as needed ◦ 構築不要、自動でスケール • Stateless / ephemeral ◦ 状態保持はあっても一時的 • Pay for what you use ◦ 使った分だけ課金
  9. Confidential & Proprietary And at Serverless Architecture • Also applies

    to non-compute (storage, databases) ◦ ファンクションに特化しましょう • Event-based ◦ イベント駆動
  10. Confidential & Proprietary Serverless on GCP App Engine (Paas) Events

    are manual ちょっと面倒 Scales at app ランタイムスケール Per minute billing 時間課金 Multiple code languages golangやろうぜ Traffic splitting/versioning これ便利よ Cloud Endpoints integration ちょっと面倒 Cloud Functions (Faas) Event-triggered イベント駆動 Scales at function ファンクションスケール Usage-based billing 処理量課金 Node.js Only... APIs 直HTTP
  11. Confidential & Proprietary Serverless on GCP

  12. Confidential & Proprietary Serverless on GCP • BigQuery ◦ 説明不要

    • Shared Managed Service ◦ 共有型マネージドサービス • Scaled by Google ◦ インフラコストを考えなくていい効能 https://cloud.google.com/bigquery/
  13. Confidential & Proprietary Serverless on GCP • Pub/Sub ◦ スケーラブルメッセージング

    • Event & Stream ◦ サービス/データ連携に活用 • Scaled by Google ◦ リアルタイム、ストリームデータも https://cloud.google.com/pubsub/
  14. Confidential & Proprietary Serverless on GCP • Dataflow ◦ 統合型マネージド

    • Instances Based ◦ サーバーレスじゃなくね? • Code Based ◦ コードに集中できる https://cloud.google.com/dataflow/
  15. Confidential & Proprietary Serverless Data Analysis

  16. Confidential & Proprietary Serverless Data Analysis

  17. Confidential & Proprietary Serverless Data Analysis Lightweight ETL • Image

    processing • Video processing • Indexing • Entity extraction • Content sanitation
  18. Confidential & Proprietary Serverless Machine Learning

  19. Confidential & Proprietary Machine Learning on GCP Use your own

    data to train models Ready to use Machine Learning models Cloud Vision API Cloud Translation API Cloud Natural Language API Cloud Speech API Cloud Machine Learning Engine TensorFlow Cloud Jobs API Cloud Video Intelligence API
  20. Confidential & Proprietary Serverless Machine Learning Cloud Storage (full length

    videos) Cloud Video Intelligence API Video Metadata Frontend built on App Engine Cloud Functions Cloud Storage (video annotation JSON) Video content Similar Tutorial https://cloud.google.com/functions/docs/tutorials/ocr
  21. Confidential & Proprietary Serverless Machine Learning BigQuery BigQuery data to

    .csv Cloud Storage Cloud Functions Pixels to column data Cloud Functions Cloud Storage Cloud Functions Cloud ML Engine Push to Prediction Service Submit .csv to Cloud ML Engine Cloud ML Engine HTTP request Cloud Functions Export newly trained model Cloud Storage saved_model.pb
  22. Confidential & Proprietary Using Cloud Functions

  23. Confidential & Proprietary Types of Cloud Functions Cloud Storage Cloud

    Pub/Sub HTTPS
  24. Confidential & Proprietary Local development • Open source emulator •

    Full compatibility with public API • Supports integration with popular IDEs for debugging https://cloud.google.com/functions/docs/emulator
  25. Confidential & Proprietary More about Cloud Functions • Handling Dependencies

    ◦ Using package.json ▪ https://cloud.google.com/functions/docs/deploying/repo • Deploying from Source Control ◦ Deploy from Github/Bitbucket with Cloud Source Repositories ▪ https://cloud.google.com/functions/docs/deploying/repo
  26. Confidential & Proprietary • HTTP requests • Cloud Storage •

    Cloud Pub/Sub • Firebase (DB, Storage, Analytics, Auth) • Stackdriver Logging Supported services Supported APIs Currently, Cloud Functions can write/read from the following services: Supported Event Providers Currently, Cloud Functions can be triggered by events provided by the following services: • Cloud Storage • Cloud Bigtable • Cloud Spanner • Cloud Datastore • Cloud Machine Learning Platform • Cloud Natural Language API • Cloud Speech API • Cloud Translation API • Cloud Vision API • Cloud BigQuery • Cloud Pub/Sub • Stackdriver Logging • Firebase (DB, Storage, Analytics, Auth)
  27. Confidential & Proprietary API endpoints Cloud Functions use cases Lightweight

    ETL Webhooks IoT React to cloud infra changes
  28. Confidential & Proprietary Microservices & Webhooks • Microservices • Data

    ingestion APIs • Callbacks from external services Microservice Webhook API
  29. Confidential & Proprietary Bots & actions • Messaging bot •

    Google assistant action • Home automation
  30. Confidential & Proprietary Services for Serverless • Firebase ◦ https://firebase.google.com/

    • Dialogflow ◦ https://dialogflow.com/ • Apigee ◦ https://cloud.google.com/apigee-api-management/ • Cloud Endpoint ◦ https://cloud.google.com/endpoints/
  31. Confidential & Proprietary Logging • console.log() ⇒ Stackdriver Logging •

    Uncaught exceptions ⇒ Stackdriver Errors • Logs accessible via: ◦ gcloud (CLI) ◦ Cloud Console (UI) ◦ REST API Monitoring • Essential telemetry is reported by default: ◦ Invocations ◦ Execution Time ◦ Memory Usage
  32. Confidential & Proprietary Serverless with Site Reliability Engineering

  33. Confidential & Proprietary Service Level • 4章 サービスレベル目標 (SLO)

  34. Service Level • サービスレベル指標 ◦ SLI • サービスレベル目標 ◦ SLO

    • (サービスレベル規約) ◦ (SLA)
  35. Confidential & Proprietary サービス レベル インジケータ(SLI) …提供されるサービス レベルの 特定の側面について注意深く 定義された定量的尺度

    “ ”
  36. Confidential & Proprietary SLIの種類 リクエスト率 エラー率 レイテンシー スループット 耐久性 可用性

    Request rate Error rate Latency Throughput Durability Availability Types of SLI
  37. Confidential & Proprietary SLI集約 時間(秒、分、時) スペース(サーバー、ゾーン、 地域、グローバル) リクエストタイプ (GET, POSTなど)

    顧客 平均値または分布 (例えば99パーセンタイル) Time (second, minute, hour) Space (server, zone, region, global) Request Type (GET, POST, etc.) Customer Average or Distribution (e.g 99th percentile) SLI Aggregation
  38. Confidential & Proprietary …SLI で測定されるサービス レベルの目標値または目標値範囲 サービス レベル 目標 (SLO)

    ” “
  39. Confidential & Proprietary SLOの例 99.99%の可用性 過去90日 スライディングウィンドウ 可用性の定義が必要 99.99% availability

    over 90 days sliding window what is available? SLO Example
  40. Confidential & Proprietary SLOの例 可用性は: 99.9%の成功率 正しいGETリクエスト 5分の期間 地域別 Available

    is: 99.9% success rate for valid GET requests 5 minute period by region SLO Example
  41. SLO and SLI on Serverless • Define your SLO ◦

    ステークホルダ全体の理解と合意 • Define SLI can explain your SLO ◦ 提供サービス観点と利用サービス観点の双方から定義する • ex. End to End Req. & Res. / Capacity Planning & Monitoring ◦ リクエストを追うためのログ設計 ◦ リソースモニターはキャパシティプランのために ▪ 予測される需要 ▪ あり得ない負荷
  42. Confidential & Proprietary and...

  43. Confidential & Proprietary We want you!! Google Cloud チームのご紹介 https://twitter.com/urasoko/status/930408388441153538

    https://youtu.be/DjKWoPq2x7k
  44. Confidential & Proprietary Thank you!