Google スケールで実現する!
ゲーム&分析基盤
Google Cloud Platform 概要紹介
福田 潔
Google Cloud Platform セールスエンジニア
Google for Work 部門
#gcpja
Google Cloud Platform とは
ゲームのバックエンドサーバとして利用する
ログ収集/解析基盤として利用する
事例
アジェンダ
1
2
3
4
Googleは過去15年間にわたり、地
球上で最も高速でパワフルそして
高品質なクラウドインフラストラク
チャを構築してきました
世界を駆け巡るGoogle バックボーンネットワーク
Building what’s next 8
33カ国
70箇所のエッジロケーション
クラウドプロバイダーの中で最大
Google-Grade Networking
2012 2015
MapReduce
Spanner
2003 2006 2010 2011
GFS
Borg
Colossus
Dremel
Bigtable
Chubby
2004
15年間クラウドインフラストラクチャを運用してくれば、何がうまく
いって、何がうまくいかないかはよく分かる
Urs Holzle
SVP, Technical Infrastructure, 2013
”“
もともとは自分たちのためにより良いクラウドを作っ
てきた
それを皆様にも使っていただきたい
GOOGLE CONFIDENTIAL
今日のクラウドは今までと同じ選択肢が異なるロケーションから提供さ
れているに過ぎない
GOOGLE CONFIDENTIAL
我々は何ができるかを変えたいと考えています
どこでやるかではなくて
管理 モバイル開発ツール
コンピュート
ネットワーク
ビッグデー
タ
ストレージ
ゲームのバックエンドサーバとして利用する
モバイルバックエンド
?
Building what’s next 17
Complete Range of Compute
Compute Engine
Google Cloud Platform
高速なインスタンス起動
低コスト
● VMあたり20秒から40
秒程度で起動
● クラスタサイズを増や
しても変わらない
ブートしてSSH可能になるまでの時間
クラスタサイズ
VMあたりの起動時間(秒)
最低10 分より1分単位で課金
使った分だけの課金
• 使えば使うほど、単価が安くなる
• 自動的に適用される
• 事前に支払う必要なし
• ロックインされることもない
• 複雑な計画も必要ない
使いつづけると自動的に割引が適用
プリエンプティブルVM
• データセンターの予備リソースを利
用するため、通常のVM費用の70%
オフで利用可能
• 起動後24時間で停止
• システムイベントにより停止する可能性が
ある
• ライブマイグレーション未対応
• 短期間のバッチジョブに最適
• 価格は固定VMインスタンスを作成するときに、フラグを付けることでプリエンプティ
ブルVMになる
価格の優位性
● ロードバランサーは
“google.com”と同じインフ
ラを使用
● 準備時間の必要なく100万
QPSのリクエストに対応可
能
100万 QPS トータルコスト
10 USD
4秒で起動
120秒以内に
安定
source: Google
高性能なロードバランサー
source: Google
透過的なメンテナンス
Container Engine
Google Cloud Platform
Googleでは毎週20億コンテナを作成
軽量
軽量でシンプル、容易にアク
セス可能
ポータブル
マルチクラウドに対応、パブ
リック、プライベート、ハイブ
リッド
拡張性
カプセル化されており、
容易に交換可能
なぜコンテナなのか?
Kubernetes
κυβερνήτης: Greek for “pilot” or “helmsman of a ship”
the open source cluster manager from Google
Kubernetes
Compute
最適化されたクラスタを実行、管理
Kubernetes
Open Source
Workload
API & Tools
Google Container Engine (GKE)
Google Container Engine
Kubernetes
● コミュニティにて開発
● Linux コンテナをサポート
● Open source のオーケストレーショ
ン
構築および管理
Container Engine
● クラスタをすぐに起動可能
● クラスタ環境の最適化
● Kubernetesを実行管理する
GKE
マスタ
GKE ノード
Compute
Engine
VMs
ログ収集/解析基盤として利用する
Building what’s next 34
Googleではビッグデータを
特別な用語で呼んでいます。
Building what’s next 35
データ。
Confidential & ProprietaryGoogle Cloud Platform 36
150万60億 200億 9億
BigQuery
Google Cloud Platform
Google Cloud Platform
BigQuery とは
● 億件レベルの大規模データセットに対する高速クエ
リー
● 分析用のデータウェアハウス
○ NO INSERT/DELETE/UPDATE
● セットアップ、パフォーマンスチューニングやクラスタ
拡張といったインフラ作業不要
● ストレージ容量無制限。自動スケールアウト
Google Cloud Platform
BigQuery とは
● BIツールを使って非技術者でも操作可能
○ Tableau, QlickView, Google Spreadsheet /
Microsoft Excel
● ETL
○ クエリー結果をテーブルに出力可能
○ JSON関数/正規表現関数
● データ処理エンジンとの連携
○ Hadoop, Cloud Dataflow
ログ収集/分析基盤としてのBigQuery
BigQuery
Cloud Storage
ログ収集/分析基盤
Cloud Logging
App Engine
Analytics Server
Google Analytics
Compute Engine
On-premise / 他社クラウド
Google
Spreadsheet
Google confidential | Do not distribute
BigQuery UI
Google confidential | Do not distribute
BigQuery UIBigQuery UIBigQuery UI
17億件(72.7GB)のフルスキャンが6.7秒!
早さの秘訣: カラム指向ストレージ
早さの秘訣 : 多段の処理ツリー
新機能
Cloud Dataflow
Google Cloud Platform
8/12 正式リリース (GA)!
Google Cloud Platform
Cloud Dataflow とは
● 並列化されたデータ処理パイプラインを作るための
プログラムフレームワークおよびSDK
● それを実行するためのマネージドサービス
● Java、将来的にはPythonに対応
● 異なるRunnerを使用可能
● バッチでもストリームでも
ハッシュタグのオートコンプリートの実装例
入力した文字列 サジェストするリスト
#ar #argentina, #arugularocks, #argylesocks
#arg #argentina, #argylesocks, #argonauts
#arge #argentina, #argentum, #argentine
{a->[apple, art, argentina], ar->[art, argentina, armenia],...}
Count
ExpandPrefixes
Top(3)
Write
Read
ExtractTags
{a->(argentina, 5M), a->(armenia, 2M), …, ar->
(argentina, 5M), ar->(armenia, 2M), ...}
{#argentina scores!, watching #armenia vs
#argentina, my #art project, …}
{argentina, armenia, argentina, art, ...}
{argentina->5M, armenia->2M, art->90M, ...}
Tweets
Predictions
Count
ExpandPrefixes
Top(3)
Write
Read
ExtractTags
Tweets
Predictions
Pipeline p = Pipeline.create(new PipelineOptions());
p.begin()
p.run();
.apply(ParDo.of(new ExtractTags()))
.apply(Top.largestPerKey(3))
.apply(Count.perElement())
.apply(ParDo.of(new ExpandPrefixes())
.apply(TextIO.Write.to(“gs://…”));
.apply(TextIO.Read.from(“gs://…”))
class ExpandPrefixes … {
public void processElement(ProcessContext c) {
String word = c.element().getKey();
for (int i = 1; i <= word.length(); i++) {
String prefix = word.substring(0, i);
c.output(KV.of(prefix, c.element()));
}
}
}
Google Cloud Dataflow
最適化
スケジューリング
GCS GCS
ユーザコードとSDK モニタリングUI
パイプラインの流れ
Pipeline p = Pipeline.create(new PipelineOptions());
p.begin()
.apply(PubsubIO.Read.topic(“input_topic”))
.apply(Window.into(SlidingWindows.of(
Duration.standardMinutes(60)))
.apply(ParDo.of(new ExtractTags()))
.apply(Count.perElement())
.apply(ParDo.of(new ExpandPrefixes())
.apply(Top.largestPerKey(3))
.apply(PubsubIO.Write.topic(“output_topic”));
p.run();
ストリーム処理への変更
ビッグデータ基盤の全体像
Google Cloud Platform
Cloud Logs
Google App
Engine
Google Analytics
Premium
Cloud Pub/Sub
BigQuery
(テーブル)
Cloud Bigtable
(NoSQL)
Cloud Storage
(ファイル)
Cloud Dataflow
BigQuery Analytics
(SQL)
キャプチャ 保存 解析
バッチ
Cloud
DataStore
処理
ストリー
ム
Cloud
Monitoring
Cloud
Bigtable
リアルタイムアナリティクスおよびア
ラート
Cloud Dataflow
事例
700million
“App Engine enabled us to focus on developing the
application. We wouldn’t have gotten here without the
ease of development that App Engine gave us.”
Bobby Murphy, CTO
Snapchat sends
photos and videos each day Google App Engine
scaled seamlessly
during growth to
millions of users
Small team is able
to innovate quickly
and expand
globally
どこから始めるか
さあ、始めてみましょう!
$300、60日間無料でお試しいただけます
https://cloud.google.com/free-trial/
cloud.google.com
http://goo.gl/ua5fQw
googlecloudplatform-japan.blogspot.jp
Thank you!
ありがとうございました
#gcpja twitter.com/kiyo0123

CEDEC 2015: Google スケールで実現する!ゲーム&分析基盤