LoginSignup
50
38

More than 5 years have passed since last update.

App Engine Flexible Environment

Last updated at Posted at 2016-07-29
1 / 23

sinmetal.png


What is App Engine FE?


App Engine Architecture

appengine.png


App Engine Standard Environment

  • 限定されたコンテナ
  • runtime 縛り (Java, Python, Go, PHP)
  • CPUはシングルコアのみ
  • メモリの最大は1GB

App Engine Standard Environment

  • ミドルウェア利用不可
  • local file systemに書き込み不可
  • 好きなportをlistenできない

App Engine Flexible Environment

  • Compute Engine上にコンテナを立てる
  • Dockerコンテナ
  • 自由な世界
  • App EngineのAPIをそのまま使える
  • ミドルウェアインストール可能

App Engine FE Architecture

appengine_fe.png


FEで用意済みのRuntime

  • Go
  • Java 8 / Servlet 3.1 / Jetty 9
  • Python 2.7 and Python 3.4
  • Node.js
  • Ruby

Demo


Custom Runtime

  • 好きなDockerfileを書いて動かす

App Engine FEの使いどころ

  • WebSocket (ただし、めんどう。。。)
  • マルチコアCPU, 豊富なメモリ
  • ImageMagickなどミドルウェアが必要な時
  • standard runtime以外が使いたい時

FEでClientからのリクエストを受け取る


WebSocketはなぜめんどうか?

  • App Engine FrontendはWetSocketが使えない
  • FEが動いているGCEのグローバルIPAddrに接続する必要がある

client_gce.png


FEは好きなportをlistenできる?

  • Yes
  • しかし、やっぱり、App Engine Frontendは通れない

client_gce.png


SEでできないことをFEに頼る


SEでできないことをFEに頼る

  • ユーザからのリクエストはSEで受け、後ろのバッチはFEで回す
  • Example : サムネイル作成 ...

Screen Shot 2016-07-28 at 21.44.56.png


FEで失われた物

  • spinup speed - SE:10ms ~ 7000ms, FE:1min
  • price - SE:豊富な無料枠, FE:Compute Engineの料金に準拠

FEの不便なところ

  • Preemptible VMが使えない
  • 1VM 1コンテナ
  • 最低インスタンス台数 = 1

Preemptible VMを使ったバッチ処理

  • TaskはQueueで管理し、Preemptible Instanceがshutdonwされても、別のWokerでTaskをリトライする
  • Taskの数に応じてWorkerの数を調整

Screen Shot 2016-08-25 at 00.27.00.png


Preemptible VMを使う利点

安い


僕が欲しかったFE

  • 1 VM マルチコンテナ
  • 負荷に応じて、コンテナをスケールさせる

Screen Shot 2016-07-28 at 21.48.40.png


Resources

50
38
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
50
38