1 of 11

App Engine Modules

appengine ja night #26

2 of 11

@shin1ogawa

Google Developer Expert / Cloud Team

  • Google App Engine, Google Apps API

株式会社トップゲート CTO

  • Google App Engine, Google Apps API
    • Java / JavaScript / Golang / Objective-C
    • Enterprise Web Applications, iOS, Android

https://www.google.com/profiles/shin1ogawa

3 of 11

App Engine Modules

  • 1.8.2でリリースされた
  • これまでの Application と Versions の間にくるような概念のもの
  • Datastoreなどの領域はこれまでと同様

4 of 11

Admin Console

  • Admin Consoleで見ると

5 of 11

Cases

  • メインのアプリケーションとは違うスケールの設定で配備したい処理を分離する
    • スケールが必要ない管理者向けの機能
    • 定期的に処理をするバッチ処理
    • 外部のシステムと連動するために接続されるインターフェース
  • Backendsを使っている機能を分離する
    • もともと従来のBackendsも、Classの設定やスケールの設定を持っており、ほぼModuleと同じように使えていた

6 of 11

Configuration

earの構造に似た構造で、application.xmlとweb module(war)を使うようだが…

7 of 11

Configuration

既存のappengine-web.xmlにmodulesに関する設定を追加するだけでも、別moduleとしてdeployできて手軽です(?)

<?xml version="1.0" encoding="utf-8"?>

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">

<application>gaej-2011</application>

<module>m1</module>

<version>m1-v1</version>

<instance-class>F1</instance-class>

<automatic-scaling>

<max-idle-instances>1</max-idle-instances>

<max-pending-latency>1.0s</max-pending-latency>

</automatic-scaling>

...

automatic-scaling or basic-scaling or manual-scaling

8 of 11

Configuration *-scaling

  • automatic, basic, manualの違いはVM Runtimeの説明の通り
  • Admin Console / Application Settingsに、現在の設定の定義が生成されているのでそれも参考に

9 of 11

Routing

  • http://instance.version.module.app-id.appspot.com
  • http://version.module.app-id.appspot.com
  • http://module.app-id.appspot.com
  • http://version.app-id.appspot.com

10 of 11

Modules Service

ModulesService service = ModulesServiceFactory.getModulesService();

  • String getCurrentModule()
  • String getCurrentVersion()
  • String getCurrentInstanceId()
  • String getModuleHostName(module, version[, instance]) -> RPC(Sync)
  • Set<String> getModules() -> RPC(Sync)

※ UnitTest環境では動作しない

(LocalModuleServiceTestConfigが提供されていない)

11 of 11

ご清聴ありがとうございました