Google App Engine
Upcoming SlideShare
Loading in...5

Google App Engine



Google adp

Google adp



Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Google App Engine Google App Engine Presentation Transcript

  • Google App Engine Ensky
  • Outline - Today• GAE Introduction• GAE Hello world• Python• WebApp2 – A python-based Web development framework
  • Outline• Cloud(IaaS, PaaS, SaaS)• Google App Engine – Some features• NoSQL• Storage of GAE - Datastore
  • Cloud• Cloud 三兄弟 – IaaS (Infrastructure as a Service) – PaaS (Platform as a Service) – SaaS (Software as a Service)
  • Cloud 三兄弟• IaaS (Infrastructure as a Service) 直接給你虛擬主機用 優:很彈性,你想安裝任何軟體、採用任何架構 都很容易 缺:要管理主機、處理一大堆問題 (ex: 駭客攻擊、版本升級等等)• amazon AT&T HP• hinet 台灣大 遠傳
  • Cloud 三兄弟• PaaS (Platform as a Service) 規定你APP要怎麼寫,簡化你管理主機的步驟 有些工具的賣點是自動幫你處理擴充問題 優:管理方便,只需要focus在app開發 缺:寫法、使用工具、環境受到限制• Google app engine• Microsoft Azure
  • Cloud 三兄弟• SaaS (Software as a Service) 善用別人寫好的web app• Gmail, Google calendar, Facebook, …
  • Outline• Cloud(IaaS, PaaS, SaaS)• Google App Engine – Some features• NoSQL• Storage of GAE - Datastore
  • Google Cloud• Google cloud包含了四大部份,分別解決不同問題 – Google App Engine • Build your apps and websites on Google’s infrastructure with Google App Engine. – Google Compute Engine • Run Linux Virtual Machines in the cloud using Google Compute Engine (Limited Preview). – Google Cloud Storage • Store, access and manage your data on Google’s storage infrastructure. – Google BigQuery • Analyze Big Data in the cloud using SQL and get real-time business insights in seconds using Google BigQuery.
  • GAEIt’s PaaS• Features – Focus on Web service – 規模自動擴張 – 安全性 – 效能 – 支援Python and Java (and Go) – 完整的SDK
  • 安全 or 限制 ? – Sandbox• 對外的連線只能是HTTP / HTTPS的protocol 若要對外作任何操作都要透過HTTP 也不能作「listen某個port」的操作• 不能對file system作任何寫入操作(可以讀取) 你只能用Google提供的GAE datastore或其他服務• 不能fork一個process來用,也不能在連線結束之後執行別 的程式• 執行時間限制60秒以內要完成
  • Some useful features• DataStore – NoSQL schemaless object datastore• BlobStore – Let you store "Binary large object" (blob)• Memcache – Fast Caching server• URL Fetch – Get data from HTTP/HTTPS• Mail – Just a Mail sender• Images – Image Processing, like resize, rotate• User – Supply Google account login• Task Queue – Send heavy load job to queue• Cronjob – Schedule a job…. and more
  • Storage• GAE provide two major Storage engine, for difference usage. – App Engine Datastore • NoSQL schemaless object datastore – App Engine Blobstore • to store blob data
  • Not only SQL• Relational DB focus on relation – User • id, username, password, email, … – Comment • id, user_id, title, content, …
  • Not only SQL• NoSQL focus on scalability, speed, or something else. – document-oriented 沒有任何的schema, 適合存document • MongoDB – key-value database 只有key-value的形式, focus on speed, scalability • Redis, memcached
  • Not only SQL– Distributed database focus on distribution on servers • HBase, cassandra, …
  • Outline• Cloud(IaaS, PaaS, SaaS)• Google App Engine – Some features• NoSQL• Storage of GAE - Datastore
  • Entity - GAE Datastore• 一個帳號可以開很多個datastore• 一個Datastore可以有很多Entity ex: User 這個datastore可以有很多筆資料• 一個Entity可以有很多屬性(properties) – ensky, – lalala,
  • Key – GAE Datastore• 每一筆entity都會有一個unique key – 就很像SQL的Primary key一樣• 可以不設讓系統自動產生; 也可以自己設定• 刪除操作是用key來判斷
  • Types - GAE DatastoreProperty in PythonStringProperty str unicodeBooleanProperty boolIntegerProperty intFloatProperty floatDateTimeProperty datetime.datetimeListProperty listBlobProperty db.BlobTextProperty db.Text
  • Using Datastore• Create a model – 定義了該 datastore 的屬性有哪些• Use it like a ORM 資料皆為物件,對物件操作就是對資料操作 – Insert:新增一個物件,最後呼叫.put()方法儲存 – Update:先query出你想要修改的物件,直接修改該物 件,最後呼叫.put()方法儲存 – Delete:先query出你想要刪除的物件,直接呼 叫.delete()方法刪除之
  • Create – GAE Datastore
  • Get, Update, Delete – GAE Datastore
  • Reference•