Skip to content
Go back

[Google Cloud] GCP App Engine

Published:  at  04:32 PM

Table of contents

Open Table of contents

Giới thiệu

Untitled

So sánh với Compute Engine

Tìm hiểu chi tiết App Engine

Phân loại

FeatureStandardFlexible
Pricing FactorsInstance hoursvCPU, Memory & Persistent Disks
ScalingManual, Basic, AutomaticManual, Automatic
Scaling to zeroYesNo. Minimum one instance
Instance startup timeSecondsMinutes
Rapid ScalingYesNo
Max. request timeout1 to 10 minutes60 minutes
Local diskMostly(except for Python, PHP). Can write to /tmp.Yes. Ephemeral. New Disk on startup.
SSH for debuggingNoYes

Standard - là loại triển khai ứng dụng trên một số ngôn ngữ chỉ định bởi GCP.

Flexible - là loại ứng dụng sẽ được triển khai trong môi trường Docker containers.

Cấu trúc các thành phần của App Engine

Untitled

Tìm hiểu tính năng chính của App Engine

Scaling Instances

Có 03 mode scaling instances như sau:

Request Routing

Có thể sử dụng kết hợp cả 03 cách tiếp cận sau:

Split traffic between multiple versions

Một số kiểu chạy App Engine tham khảo

App thông thường

runtime: python28 #The name of the runtime environment that is used by your app
api_version: 1 #RECOMMENDED - Specify here - gcloud app deploy -v [YOUR_VERSION_ID]
instance_class: F1
service: service-name
#env: flex

inbound_services:
  - warmup

env_variables:
  ENV_VARIABLE: "value"

handlers:
  - url: /
    script: home.app

automatic_scaling:
  target_cpu_utilization: 0.65
  min_instances: 5
  max_instances: 100
  max_concurrent_requests: 50
#basic_scaling:
#max_instances: 11
#idle_timeout: 10m
#manual_scaling:
#instances: 5

Cron Job

cron:
	- description: "daily summary job"
	  url: /tasks/summary
	  schedule: every 24 hours

Dispatch

dispatch:
  - url: "*/mobile/*"
    service: mobile-frontend
  - url: "*/work/*"
    service: static-backend

Queue

queue:
  - name: fooqueue
    rate: 1/s
    retry_parameters:
      task_retry_limit: 7
      task_age_limit: 2d

Tổng kết

App Engine - Scenarios

ScenarioSolution
I want to create two Google App Engine Apps in the same projectNot possible. You can only have one App Engine App per project. However you can have multiple services and multiple version for each service.
I want to create two Google App Engine Services inside the same AppYup. You can create multiple services under the same app. Each service can have multiple versions as well.
I want to move my Google App Engine App to a different regionApp Engine App is region specific. You CANNOT move it to different region. Create a new project and create new app engine app in the new region.
Perform Canary deploymentsDeploy v2 without shifting traffic (gcloud app deploy —no-promote)Shift some traffic to V2 (gcloud app services set-traffic s1 —splits v1=0.9,v2=0.1)

Tham khảo chi tiết cách Deploying new versions without downtime


Suggest Changes

Previous Post
[Google Cloud] GCP Cloud Functions
Next Post
[Google Cloud] GCP Compute Engine