Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Google Cloud NEXT'19 わいわい報告会 - Cloud Run について
Search
avvmoto
April 17, 2019
Technology
410
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Google Cloud NEXT'19 わいわい報告会 - Cloud Run について
Google Cloud NEXT'19 で発表された、Cloud Run についての概要です。
avvmoto
April 17, 2019
More Decks by avvmoto
See All by avvmoto
Go Conference 2019 Autumn Go で超高速な 経路探索エンジンをつくる/Go Conference 2019 Autumn go-ch
avvmoto
14
26k
gRPC Streaming によるスケーラブルな常時接続型 API の構築
avvmoto
14
7k
Go Conference 2018 Autumn 大規模ウェブサービスにおけるコード レビュー観点
avvmoto
2
2.1k
Effective streaming in Golang
avvmoto
6
5.9k
Other Decks in Technology
See All in Technology
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
150
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
12k
2026-09-18 gotanda.sre Terraformで複数環境作ったり、複数Stateに分割したりそれとTerragrunt / Terraform multi envs and multi states
masasuzu
4
730
データ_AIの事業の勝敗をわけるもの
nek0128
1
480
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
570
AIは推し活である。
kurazuuuuuu
1
970
10年欲しかった音楽管理アプリを、AIと一緒に作りはじめた
judau
1
110
Mastering Agentic Development: Harness Engineering for Effective Coding Agents
konippi
3
520
PQC移行の今 -- IETF からみた現在地
satokan
3
190
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
4
1.3k
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
140
GoのInterface内部構造から学ぶ!最高パフォーマンスを出すコード設計
yappli_developers
1
290
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
25k
Embracing the Ebb and Flow
colly
88
5.2k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
730
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Believing is Seeing
oripsolob
1
220
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
480
エンジニアに許された特別な時間の終わり
watany
109
250k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
470
Producing Creativity
orderedlist
PRO
348
41k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
540
Transcript
Google Cloud NEXT'19 わいわい報告会 Cloud Run について 井本裕 オートモーティブ事業本部 モビリティ・インテリジェンス開発部
株式会社ディー・エヌ・エー
目次 2 Cloud Run Cloud Run on GKE 開発Tips 1
2 3 Severless Compute Service 各種比較 4
Cloud Run 3
Cloud Run (BETA) • サーバーレスの Computing Service • Cloud Function,
GAE と同様 • HTTP リクエスト経由でコンテナを実行 • マネージドサービスであり、インフラは抽象化されている • ただし自分の GKE Cluster 上で実行できる Cloud Run on GKE もある(後述) • オートスケール • トラフィックに応じて自動的にゼロからNまで増減 • デモだと 1min で 0 → 15000 concurrency までスケールしてた 4
Serverlessとは Google の定義によると 5 https://youtu.be/xVuuvZkYiNM
ユースケース - 認証なし ( Public ) - Website / API
のフロントエンド - Mobile Backend - Webhook - 認証あり (Private) - マイクロサービス - 画像変換等々 - コンテナなので任意のバイナリ、ライブラリが使える - 非同期処理 - Pub/Sub, Cloud Schedulerから発火 6
特徴 - コンテナベース 7 https://youtu.be/xVuuvZkYiNM
アーキテクチャ 8 https://youtu.be/xVuuvZkYiNM
アーキテクチャ 9 Source: https://twitter.com/ahmetb/status/1116041166359654400
認証について • 前段に IAM で認証ができ、Cloud Run の Service に入る前に GCP
側でチェックしてくれる • Service Account を指定したり、特定のユーザーを指定したり • Firebase 連携もある 10 https://youtu.be/xVuuvZkYiNM
認証 / PubSub - Pub/Sub から Cloud Run へ認証つきで Push
する例 11 https://youtu.be/xVuuvZkYiNM
Concurrency - 1~80 (default:80) - Cloud Functions, AWS labda は
1 なので有利なポイント 12 https://youtu.be/xVuuvZkYiNM
インスタンスのリソース - CPU - 1vCPU固定 - Cloud Run on GKEでは任意
- メモリ - 128MB ~ 2G - default 128MB 13
価格 - 100ms単位で課金 - 無料枠あり - 有料枠 ( BETA期間中の今なら無料 )
- 約 $2 / vCPU /日 - 約 $0.2 / GB(メモリ) / 日 14 https://cloud.google.com/run/pricing cf. GAE SE f2 instance (1.2 GHz 256 MB) $ 2.4 / 日
価格 - リクエストをさばいている間のみ課金 - インスタンスの起動時間には寄らない - concurrency が大きいとコストで有利に 15 https://youtu.be/xVuuvZkYiNM
制約 - これらが問題となる場合は Cloud Run on GKEだと存在しない - また、Cloud Run
は region も us-central1 のみ(すぐ追加されるとセッション中で話していた) - どちらも Knative Serving API を使えるので、移行は簡単(らしい) 16 https://youtu.be/xVuuvZkYiNM
Knative Serving API Spec: https://github.com/knative/serving/tree/master/docs/spec 17 https://youtu.be/xVuuvZkYiNM
その他制約 18 https://cloud.google.com/run/quotas
Cloud Run on GKE 19
Cloud Run on GKE • Google Kubernetes Engineクラスタへのアドオン • 自前の
GKE Cluster に Google が Knative をインストールしてくれるというもの • Cloud Run の一部の制約がない • Cloud Run on GKEの制約 • GKE Cluster の料金の発生 • 自分でSSL証明書の管理が必要 • 自動スケーリングはGKEクラスタの 容量内 20 Source: https://twitter.com/ahmetb/status/1116041166359654400
Cloud Run 開発 Tips 21 https://cloud.google.com/run/docs/tips?hl=en
開発Tips • 一般 • リクエスト終了後のバックグラウンドアクティビティは避ける • 一時ファイルの削除 • エラー発生時にサービスをクラッシュさせない •
コールドスタート • サービスの起動を速くする • コンテナイメージサイズの最小化 • 依存ライブラリのロードを最小化する • 重い初期化等は、グローバル変数でインスタンス内で共用化 • グローバル変数の遅延初期化の実行 • Concurrency • 適切なConcurrency、そしてそれに応じた適切なメモリサイズの設定 • mutex/lockに注意 • コンテナセキュリティ(略) 22
サーバーレス各種比較 23
24 https://youtu.be/xVuuvZkYiNM
まとめ 25
まとめ • Cloud Run, Cloud Run on GKE が出た •
コンテナベースなオートスケールするマネージドなサービス • コンテナなので好きな言語、ライブラリが使えて便利 • 認証、ロギング、SSL、などなど便利機能と連携多数 26
個人的な所管 - GAE における min_idle_instance は設定できない - コールドスタート時のレイテンシ悪化がちょっと心配 - 今後設定項目に追加されることを勝手に期待している
- Cloud Run - Cloud SQL等使えない現状だと、本当に画像変換処理とかの用途になりそう - 無料の今のうちに遊んでみよう - いくつか制約に関してアップデートが予告されているので今後に注目 - 複雑な k8s に触らずシュッとオートスケールでコンテナ動かせるの良さそう 27
参考文献 - https://cloud.withgoogle.com/next/sf/sessions?session=SVR302 - https://cloud.google.com/run/ - https://twitter.com/ahmetb/status/1116041166359654400 - https://youtu.be/xVuuvZkYiNM 28