google app engine (gae) 演進史
TRANSCRIPT
Google App Engine (GAE) 演進史
GAE is one of Google Cloud Platform project for provide full google management application feature...
Simon Su / GCPUG.TW co-organizer
Cage Chung / GCPUG.TW
Google Cloud Platform Already Here
https://www.facebook.com/groups/GCPUG.TW/
https://plus.google.com/u/0/communities/116100913832589966421
[您知道”GCPUG”要怎麼唸嗎?為什麼會有一隻狗在 Logo裡面呢? ]
Google Cloud Platform User Group的縮寫是GCPUGGCPUG直接唸成G.C.P.U.G?當然可以!
但它也可以分開來,唸成 G.C. PUG喔~
Pug,指的是巴哥犬,所以 GCPUG的Logo中間才會有一隻可愛的巴哥犬喲。
下次聽到別人說G.C. PUG 的時候,您就可以大聲說:「我也是G.C. PUG社團成員!」
您的Web架構還是這樣嗎?
GAE是Googler的御用開發工具
從支援Python語言到 Java、Go、PHP
Google的服務舉凡Gmail, Drive等等都是開發在GAE上
今天我們來介紹GAE (Google App Engine)
Angry Birds
Khan Academy
Royal Wedding
Snaptchat
EA Games
Forbes
Bestbuy
Who is using it?
GAE BeforeFrontend, Backend, Frontend Cache, Memcache, Datastore, TaskQueue…
● Runtimes and framework
● Reliability and Support
● Bulk downloading
GAE Features
看GAE如何提供服務 - GAE Architecture
Closest Google Data
Center
Edge Cache
Google Frontend
App Engine Data Center
App Master(App Engine Management Layer)
Static Servers
App Engine
Frontend
App Servers
Application Instances
Application Instances
Application Instances
Google’s FiberISP
MemcacheGAE
User
Datastore
Task Queues
GAE
Scheduled Tasks
GAE
Search APIGAE
Logs APIGAE
https://code.google.com/p/googleappengine/wiki/SdkReleaseNotes
● Frontend instance (not App Engine Front End)○ Dynamically created and deleted = low cost○ Enforce fast response and stateless design○ Suitable for processing short-lived requests
● Backend instance○ Statically created and deleted = higher cost○ No limit for response time, supports stateful design○ Suitable for batch processing
Frontend Instance vs. Backend Instance
Modulesdispatch:
- url: "*/favicon.ico"
module: default
- url: "*/notice/*"
module: notice
- url: "*/waypoints/*"
module: optimal-waypoints
- url: "*/screenshot/*"
module: screenshot
- url: "*/google40fc41ccc276e5c5.html"
module: ownership
- url: "*/*"
module: "default"
dispatch.yaml
Application hierarchy
[App Engine Modules in Python](https://goo.gl/p3nl48)
● Developers have read-only access to the filesystem on App Engine. Applications can use only virtual
filesystems, like gae-filestore.[20]
● App Engine can only execute code called from an HTTP request (scheduled background tasks allow for self
calling HTTP requests).
● Users may upload arbitrary Python modules, but only if they are pure-Python; C and Pyrex modules are not
supported.
● Java applications may only use a subset (The JRE Class White List) of the classes from the JRE standard
edition.[21]
● Datastore cannot use inequality filters on more than one entity property per query.[22]
● A process started on the server to answer a request can't last more than 60 seconds (with the 1.4.0
release, this restriction does not apply to background jobs anymore).
● Does not support sticky sessions (a.k.a. session affinity), only replicated sessions are supported
including limitation of the amount of data being serialized and time for session serialization.
GAE Restrictions[edit]
Google joined Cloud @ 2014
Cloud ComputingCompute
PaasIaaS
ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking
ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking
Saas
ApplicationDataRuntimeMiddlewareOSVirtualizationServersStorageNetworking
Infrastructure as a Service Platform as a Service Service as a Service
You manage Google manage
GAE NowModules, Managed VM, Container integrated
Managed VMs
App Engine
Beta
What’s Docker?
[什麼是 Docker | 《Docker —— 從入門到實踐 》正體中文版](http://philipzheng.gitbooks.io/docker_practice/content/introduction/what.html)
Managed VMsCompute | Managed VMs
● Extension of App Engine● Use Docker to run containers● Can Use
○ Google configured containers○ Custom containers
Managed VM
Dockerfile
app.yaml
$ gcloud preview app run
$ gcloud preview app deploy
gcloud SDK
Docker registry
container
dockerd
VM*
* A VM running docker
Dockerfile
FROM google/appengine-python27
# Install pandas
RUN apt-get update && apt-get install -y -q --no-install-
recommends python-pandas python-numpy
# Install Google Map APIs, Google Client Library
ADD requirements.txt /app/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
ADD . /app
Create the App Engine
[Managed VMs - App Engine — Google Cloud Platform](https://goo.gl/4FFSmm)
application: waldo-gcp
module: optimal-waypoints
version: 1
runtime: python27
api_version: 1
threadsafe: yes
vm: true
automatic_scaling:
min_num_instances: 1
max_num_instances: 5
cool_down_period_sec: 60
cpu_utilization:
target_utilization: 0.5
Create the App Engine | app.yaml
application: waldo-gcp
module: screenshot
version: 1
runtime: custome
api_version: 1
threadsafe: yes
vm: true
resources:
cpu: .5
memory_gb: 1.3
manual_scaling:
instances: 1
Standard runtime Custom runtime
Managed VM Standard Runtime vs. Custom Runtime
Behind the scenes
gcloud deploy
gcloud build
Your awesome docker images
your laptop
Google App Engine
Your awesome docker images
docker container
private Google Cloud Storage
bucket
update start Google Compute Engine Instance
usinggoogle/docker-registry
container
docker run
usinggoogle/docker-registry
container
docker push
docker pull
App Engine for Docker
Simple to manage
Private Registry bucket
APIs and SDK
Loadbalancing
Autoscaling
Use any library
Run any code
Transparency
New runtimes, build your own
registry.hub.docker.com
Docker for App Engine
GAE Other FeaturesApp Engine APIs, Cloud Endpoint, Project generator...
● Storage
○ Cloud Storage
○ Cloud SQL
○ Cloud Datastore
● Memcache
● Task Queue
● Cloud Endpoints
App Engine APIs
Find more https://cloud.google.com/appengine/
Cloud Endpoint
Getting Started
# 安裝 gcloud SDK
$ curl https://sdk.cloud.google.com | bash
# 更新 gcloud SDK
$ gcloud components update
Find more https://cloud.google.com/appengine/
Project Generator
https://github.com/yozo1984/generator-py-gae
npm install -g yo
npm install -g generator-py-gae
mkdir your-project && cd your-project
yo py-gae
dev_appserver.py .
appcfg.py update .
GAE webapp2 starter
# clone repo from github
$ git clone https://github.com/cage1016/gae-webapp2-starter
# install pip packages
$ pip -r requirements.txt -t lib
# install bower packages
$ bower install
# install npm packages
$ npm install
# build assets resources
$ gulp
[GAE webapp2 starter](https://github.com/cage1016/gae-webapp2-starter)
http://gcpug.tw
Thanks you!